Bug 1430829 - Update for removal of ImageFormat::Invalid in WR PR 2317. r?jrmuizel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 19 Jan 2018 12:33:58 -0500
changeset 722718 cafca518ebc3153db686e45e5732ac989cd83195
parent 722717 50b4a163c366bae2da951e50353dd913000ce775
child 722719 8022e678e2a9609e9dd29a72debe91185d0c7af1
push id96212
push userkgupta@mozilla.com
push dateFri, 19 Jan 2018 17:35:25 +0000
reviewersjrmuizel
bugs1430829
milestone59.0a1
Bug 1430829 - Update for removal of ImageFormat::Invalid in WR PR 2317. r?jrmuizel MozReview-Commit-ID: 5TFM7B652qG
gfx/layers/wr/WebRenderMessageUtils.h
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/src/bindings.rs
gfx/webrender_bindings/webrender_ffi_generated.h
--- a/gfx/layers/wr/WebRenderMessageUtils.h
+++ b/gfx/layers/wr/WebRenderMessageUtils.h
@@ -109,17 +109,17 @@ struct ParamTraits<mozilla::wr::Pipeline
   : public PlainOldDataSerializer<mozilla::wr::PipelineId>
 {
 };
 
 template<>
 struct ParamTraits<mozilla::wr::ImageFormat>
   : public ContiguousEnumSerializer<
         mozilla::wr::ImageFormat,
-        mozilla::wr::ImageFormat::Invalid,
+        mozilla::wr::ImageFormat::R8,
         mozilla::wr::ImageFormat::Sentinel>
 {
 };
 
 template<>
 struct ParamTraits<mozilla::wr::LayoutSize>
   : public PlainOldDataSerializer<mozilla::wr::LayoutSize>
 {
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -75,17 +75,16 @@ SurfaceFormatToImageFormat(gfx::SurfaceF
       // have it yet (cf. issue #732).
     case gfx::SurfaceFormat::B8G8R8A8:
       return Some(wr::ImageFormat::BGRA8);
     case gfx::SurfaceFormat::A8:
       return Some(wr::ImageFormat::R8);
     case gfx::SurfaceFormat::R8G8:
       return Some(wr::ImageFormat::RG8);
     case gfx::SurfaceFormat::UNKNOWN:
-      return Some(wr::ImageFormat::Invalid);
     default:
       return Nothing();
   }
 }
 
 inline gfx::SurfaceFormat
 ImageFormatToSurfaceFormat(ImageFormat aFormat) {
   switch (aFormat) {
@@ -97,17 +96,17 @@ ImageFormatToSurfaceFormat(ImageFormat a
       return gfx::SurfaceFormat::UNKNOWN;
   }
 }
 
 struct ImageDescriptor: public wr::WrImageDescriptor {
   // We need a default constructor for ipdl serialization.
   ImageDescriptor()
   {
-    format = wr::ImageFormat::Invalid;
+    format = (ImageFormat)0;
     width = 0;
     height = 0;
     stride = 0;
     is_opaque = false;
   }
 
   ImageDescriptor(const gfx::IntSize& aSize, gfx::SurfaceFormat aFormat)
   {
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -542,17 +542,17 @@ pub unsafe extern "C" fn wr_renderer_rea
                                               dst_buffer: *mut u8,
                                               buffer_size: usize) {
     assert!(is_in_render_thread());
 
     let mut slice = make_slice_mut(dst_buffer, buffer_size);
     renderer.read_pixels_into(DeviceUintRect::new(
                                 DeviceUintPoint::new(0, 0),
                                 DeviceUintSize::new(width, height)),
-                              ReadPixelsFormat::Bgra8,
+                              ReadPixelsFormat::Standard(ImageFormat::BGRA8),
                               &mut slice);
 }
 
 /// cbindgen:field-names=[mBits]
 #[repr(C)]
 pub struct WrDebugFlags {
     bits: u32,
 }
--- a/gfx/webrender_bindings/webrender_ffi_generated.h
+++ b/gfx/webrender_bindings/webrender_ffi_generated.h
@@ -90,17 +90,16 @@ enum class FontRenderMode : uint32_t {
   Mono = 0,
   Alpha = 1,
   Subpixel = 2,
 
   Sentinel /* this must be last for serialization purposes. */
 };
 
 enum class ImageFormat : uint32_t {
-  Invalid = 0,
   R8 = 1,
   BGRA8 = 3,
   RGBAF32 = 4,
   RG8 = 5,
 
   Sentinel /* this must be last for serialization purposes. */
 };