Bug 1355187 - Update some of the ExternalImage data types to be more similar in Rust and C++. r=rhunt
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 10 Apr 2017 17:38:02 -0400
changeset 400887 f8c97e12c904f86ca47caede00abc6215c307df9
parent 400886 223769fd889492f5a270559533bc5967ced40e09
child 400888 9c83023e46b0f108d068a77590b257db80cc0a1f
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1355187
milestone55.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 1355187 - Update some of the ExternalImage data types to be more similar in Rust and C++. r=rhunt The WrExternalImageId is currently a struct wrapping a uint64_t on the C++ side, which is unnecessary as we can just typedef it directly to a uint64_t. On the Rust side it's a tuple of (u64). Also the WrExternalImageIdType enum should be WrExternalImageType for consistency. MozReview-Commit-ID: DgOf4xfY9h3
gfx/webrender_bindings/RendererOGL.cpp
gfx/webrender_bindings/WebRenderTypes.h
gfx/webrender_bindings/webrender_ffi.h
--- a/gfx/webrender_bindings/RendererOGL.cpp
+++ b/gfx/webrender_bindings/RendererOGL.cpp
@@ -14,17 +14,17 @@
 #include "mozilla/widget/CompositorWidget.h"
 
 namespace mozilla {
 namespace wr {
 
 WrExternalImage LockExternalImage(void* aObj, WrExternalImageId aId)
 {
   RendererOGL* renderer = reinterpret_cast<RendererOGL*>(aObj);
-  RenderTextureHost* texture = renderer->GetRenderTexture(aId.id);
+  RenderTextureHost* texture = renderer->GetRenderTexture(aId);
 
   if (texture->AsBufferTextureHost()) {
     RenderBufferTextureHost* bufferTexture = texture->AsBufferTextureHost();
     MOZ_ASSERT(bufferTexture);
     bufferTexture->Lock();
 
     return RawDataToWrExternalImage(bufferTexture->GetDataForRender(),
                                     bufferTexture->GetBufferSizeForRender());
@@ -40,17 +40,17 @@ WrExternalImage LockExternalImage(void* 
                                           0, 0,
                                           size.width, size.height);
   }
 }
 
 void UnlockExternalImage(void* aObj, WrExternalImageId aId)
 {
   RendererOGL* renderer = reinterpret_cast<RendererOGL*>(aObj);
-  RenderTextureHost* texture = renderer->GetRenderTexture(aId.id);
+  RenderTextureHost* texture = renderer->GetRenderTexture(aId);
   MOZ_ASSERT(texture);
   texture->Unlock();
 }
 
 void ReleaseExternalImage(void* aObj, WrExternalImageId aId)
 {
 }
 
--- a/gfx/webrender_bindings/WebRenderTypes.h
+++ b/gfx/webrender_bindings/WebRenderTypes.h
@@ -343,37 +343,35 @@ static inline WrComplexClipRegion ToWrCo
   WrComplexClipRegion complex_clip;
   complex_clip.rect = wr::ToWrRect(rect);
   complex_clip.radii = wr::ToWrUniformBorderRadius(size);
   return complex_clip;
 }
 
 static inline WrExternalImageId ToWrExternalImageId(uint64_t aID)
 {
-  WrExternalImageId id;
-  id.id = aID;
-  return id;
+  return aID;
 }
 
 static inline WrExternalImage RawDataToWrExternalImage(const uint8_t* aBuff,
                                                        size_t size)
 {
   return WrExternalImage {
-    WrExternalImageIdType::RawData,
+    WrExternalImageType::RawData,
     0, 0.0f, 0.0f, 0.0f, 0.0f,
     aBuff, size
   };
 }
 
 static inline WrExternalImage NativeTextureToWrExternalImage(uint8_t aHandle,
                                                              float u0, float v0,
                                                              float u1, float v1)
 {
   return WrExternalImage {
-    WrExternalImageIdType::NativeTexture,
+    WrExternalImageType::NativeTexture,
     aHandle, u0, v0, u1, v1,
     nullptr, 0
   };
 }
 
 struct VecU8 {
   WrVecU8 inner;
   VecU8() {
--- a/gfx/webrender_bindings/webrender_ffi.h
+++ b/gfx/webrender_bindings/webrender_ffi.h
@@ -123,17 +123,17 @@ enum class WrImageRendering: uint32_t
 {
   Auto        = 0,
   CrispEdges  = 1,
   Pixelated   = 2,
 
   Sentinel /* this must be last, for IPC serialization purposes */
 };
 
-enum class WrExternalImageIdType: uint32_t
+enum class WrExternalImageType: uint32_t
 {
   NativeTexture, // Currently, we only support gl texture handle.
   RawData,
 
   Sentinel /* this must be last, for IPC serialization purposes */
 };
 
 enum class WrMixBlendMode: uint32_t
@@ -175,17 +175,17 @@ enum class WrRepeatMode : uint32_t
 
   Sentinel /* this must be last, for IPC serialization purposes */
 };
 
 // -----
 // Typedefs for struct fields and function signatures below.
 // -----
 
-typedef uint64_t WrImageIdType;
+typedef uint64_t WrExternalImageId;
 
 // -----
 // Structs used in C++ code with corresponding types in Rust code
 // -----
 
 struct WrItemRange
 {
   size_t start;
@@ -399,24 +399,19 @@ struct WrComplexClipRegion
 struct WrClipRegion
 {
   WrRect main;
   WrItemRange complex;
   WrImageMask image_mask;
   bool has_image_mask;
 };
 
-struct WrExternalImageId
-{
-  WrImageIdType id;
-};
-
 struct WrExternalImage
 {
-  WrExternalImageIdType type;
+  WrExternalImageType type;
 
   // external texture handle
   uint32_t handle;
   // external texture coordinate
   float u0, v0;
   float u1, v1;
 
   // external image buffer