Bug 1461342 - Update WebRender bindings after changes in PR #2763. r=kats
authorNicolas Silva <nsilva@mozilla.com>
Fri, 18 May 2018 08:28:33 -0400
changeset 418826 4089ece97c08838db18710db1a28c63924a527d4
parent 418825 78a4a0e828808142b472d4dda6c2f991d244b8c2
child 418827 35f42e0346a7d340d42e56aee87d21ff90c3bbd1
push id34014
push useraciure@mozilla.com
push dateFri, 18 May 2018 22:04:52 +0000
treeherdermozilla-central@b54f574a1dd2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1461342
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1461342 - Update WebRender bindings after changes in PR #2763. r=kats MozReview-Commit-ID: 8GAAvPh41eP
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/src/moz2d_renderer.rs
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -283,18 +283,17 @@ pub struct WrImageDescriptor {
     pub height: u32,
     pub stride: u32,
     pub is_opaque: bool,
 }
 
 impl<'a> Into<ImageDescriptor> for &'a WrImageDescriptor {
     fn into(self) -> ImageDescriptor {
         ImageDescriptor {
-            width: self.width,
-            height: self.height,
+            size: DeviceUintSize::new(self.width, self.height),
             stride: if self.stride != 0 {
                 Some(self.stride)
             } else {
                 None
             },
             format: self.format,
             is_opaque: self.is_opaque,
             offset: 0,
--- a/gfx/webrender_bindings/src/moz2d_renderer.rs
+++ b/gfx/webrender_bindings/src/moz2d_renderer.rs
@@ -336,25 +336,25 @@ fn merge_blob_images(old_buf: &[u8], new
     assert!(old_reader.cache.is_empty());
 
     let result = result.finish();
     check_result(&result);
     result
 }
 
 impl BlobImageRenderer for Moz2dImageRenderer {
-    fn add(&mut self, key: ImageKey, data: BlobImageData, tiling: Option<TileSize>) {
+    fn add(&mut self, key: ImageKey, data: Arc<BlobImageData>, tiling: Option<TileSize>) {
         {
             let index = BlobReader::new(&data);
             assert!(index.reader.has_more());
         }
-        self.blob_commands.insert(key, (Arc::new(data), tiling));
+        self.blob_commands.insert(key, (Arc::clone(&data), tiling));
     }
 
-    fn update(&mut self, key: ImageKey, data: BlobImageData, dirty_rect: Option<DeviceUintRect>) {
+    fn update(&mut self, key: ImageKey, data: Arc<BlobImageData>, dirty_rect: Option<DeviceUintRect>) {
         match self.blob_commands.entry(key) {
             hash_map::Entry::Occupied(mut e) => {
                 let old_data = &mut e.get_mut().0;
                 *old_data = Arc::new(merge_blob_images(&old_data, &data,
                                                        dirty_rect.unwrap().into()));
             }
             _ => { panic!("missing image key"); }
         }
@@ -423,36 +423,35 @@ impl BlobImageRenderer for Moz2dImageRen
             let mut index = BlobReader::new(&commands);
             while index.reader.pos < index.reader.buf.len() {
                 let e  = index.read_entry();
                 process_fonts(BufReader::new(&commands[e.end..e.extra_end]), resources);
             }
         }
 
         self.workers.spawn(move || {
-            let buf_size = (descriptor.width
-                * descriptor.height
+            let buf_size = (descriptor.size.width
+                * descriptor.size.height
                 * descriptor.format.bytes_per_pixel()) as usize;
             let mut output = vec![0u8; buf_size];
 
             let result = unsafe {
                 if wr_moz2d_render_cb(
                     ByteSlice::new(&commands[..]),
-                    descriptor.width,
-                    descriptor.height,
+                    descriptor.size.width,
+                    descriptor.size.height,
                     descriptor.format,
                     option_to_nullable(&tile_size),
                     option_to_nullable(&request.tile),
                     option_to_nullable(&dirty_rect),
                     MutByteSlice::new(output.as_mut_slice())
                 ) {
 
                     Ok(RasterizedBlobImage {
-                        width: descriptor.width,
-                        height: descriptor.height,
+                        size: descriptor.size,
                         data: output,
                     })
                 } else {
                     panic!("Moz2D replay problem");
                 }
             };
 
             tx.send((request, result)).unwrap();