Bug 1355612 - Make WrGlyphInstance hold a Point2D instead of raw x/y to match the Rust side. r?jrmuizel
MozReview-Commit-ID: 7OtctQ4gWyv
--- 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