Bug 1355612 - Make WrGlyphInstance hold a Point2D instead of raw x/y to match the Rust side. r?jrmuizel draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 11 Apr 2017 17:27:18 -0400
changeset 560706 852576f4a63d95211685766fdfb5c732ec617e2c
parent 560705 e76defd02fd5f90f3864c811b39a02c52b8e24dd
child 560707 dea911fa83afd01ee78789a0e2947c0d5f1eef81
push id53528
push userkgupta@mozilla.com
push dateTue, 11 Apr 2017 21:28:04 +0000
reviewersjrmuizel
bugs1355612
milestone55.0a1
Bug 1355612 - Make WrGlyphInstance hold a Point2D instead of raw x/y to match the Rust side. r?jrmuizel MozReview-Commit-ID: 7OtctQ4gWyv
gfx/layers/wr/WebRenderBridgeChild.cpp
gfx/webrender_bindings/webrender_ffi.h
--- a/gfx/layers/wr/WebRenderBridgeChild.cpp
+++ b/gfx/layers/wr/WebRenderBridgeChild.cpp
@@ -192,18 +192,18 @@ WebRenderBridgeChild::PushGlyphs(wr::Dis
     GlyphArray glyph_array = aGlyphs[i];
     nsTArray<gfx::Glyph>& glyphs = glyph_array.glyphs();
 
     nsTArray<WrGlyphInstance> wr_glyph_instances;
     wr_glyph_instances.SetLength(glyphs.Length());
 
     for (size_t j = 0; j < glyphs.Length(); j++) {
       wr_glyph_instances[j].index = glyphs[j].mIndex;
-      wr_glyph_instances[j].x = glyphs[j].mPosition.x - aOffset.x;
-      wr_glyph_instances[j].y = glyphs[j].mPosition.y - aOffset.y;
+      wr_glyph_instances[j].point.x = glyphs[j].mPosition.x - aOffset.x;
+      wr_glyph_instances[j].point.y = glyphs[j].mPosition.y - aOffset.y;
     }
     aBuilder.PushText(wr::ToWrRect(aBounds),
                       clipRegion,
                       glyph_array.color().value(),
                       key,
                       Range<const WrGlyphInstance>(wr_glyph_instances.Elements(), wr_glyph_instances.Length()),
                       aFont->GetSize());
 
--- a/gfx/webrender_bindings/webrender_ffi.h
+++ b/gfx/webrender_bindings/webrender_ffi.h
@@ -176,16 +176,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 WrExternalImageId;
+typedef mozilla::gfx::Point Point2D;    // TODO: get rid of this somehow
 
 // -----
 // Structs used in C++ code with corresponding types in Rust code
 // -----
 
 struct WrItemRange
 {
   size_t start;
@@ -257,24 +258,22 @@ struct WrColor
     return r == aRhs.r && g == aRhs.g &&
            b == aRhs.b && a == aRhs.a;
   }
 };
 
 struct WrGlyphInstance
 {
   uint32_t index;
-  float x;
-  float y;
+  Point2D point;
 
   bool operator==(const WrGlyphInstance& other) const
   {
     return index == other.index &&
-           x == other.x &&
-           y == other.y;
+           point == other.point;
   }
 };
 
 // Note that the type is slightly different than
 // the definition in bindings.rs. WrGlyphInstance
 // versus GlyphInstance, but their layout is the same.
 // So we're really overlapping the types for the same memory.
 struct WrGlyphArray