Bug 1229202 (part 6) - Remove two nasty matrix reinterpret_casts. r=mattwoodrow.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 02 Dec 2015 15:32:17 -0800
changeset 275291 f07938cebd6f8a0c1bb6b21d6e1986d4dc2e432f
parent 275290 4addc9ac90eaa5162e71867c27d3d3343ab447f6
child 275292 3e1abfc084f08983da4c873d41f55429a0c00a2a
push id68809
push usernnethercote@mozilla.com
push dateWed, 02 Dec 2015 23:53:23 +0000
treeherdermozilla-inbound@3e1abfc084f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1229202
milestone45.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 1229202 (part 6) - Remove two nasty matrix reinterpret_casts. r=mattwoodrow.
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFontEntry.cpp
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2003,17 +2003,19 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint
         cairo_scaled_font_get_font_matrix(mScaledFont, &matrix);
         if (matrix.xy != 0) {
             // If this matrix applies a skew, which can happen when drawing
             // oblique fonts, we will set the DrawTarget matrix to apply the
             // skew. We'll need to move the glyphs by the inverse of the skew to
             // get the glyphs positioned correctly in the new device space
             // though, since the font matrix should only be applied to drawing
             // the glyphs, and not to their position.
-            mat = ToMatrix(*reinterpret_cast<gfxMatrix*>(&matrix));
+            mat = Matrix(matrix.xx, matrix.yx,
+                         matrix.xy, matrix.yy,
+                         matrix.x0, matrix.y0);
 
             mat._11 = mat._22 = 1.0;
             mat._21 /= GetAdjustedSize();
 
             aRunParams.dt->SetTransform(mat * oldMat);
 
             fontParams.matInv = mat;
             fontParams.matInv.Invert();
--- a/gfx/thebes/gfxFontEntry.cpp
+++ b/gfx/thebes/gfxFontEntry.cpp
@@ -339,17 +339,19 @@ gfxFontEntry::GetSVGGlyphExtents(gfxCont
     MOZ_ASSERT(mSVGInitialized,
                "SVG data has not yet been loaded. TryGetSVGData() first.");
     MOZ_ASSERT(mUnitsPerEm >= kMinUPEM && mUnitsPerEm <= kMaxUPEM,
                "font has invalid unitsPerEm");
 
     cairo_matrix_t fontMatrix;
     cairo_get_font_matrix(aContext->GetCairo(), &fontMatrix);
 
-    gfxMatrix svgToAppSpace = *reinterpret_cast<gfxMatrix*>(&fontMatrix);
+    gfxMatrix svgToAppSpace(fontMatrix.xx, fontMatrix.yx,
+                            fontMatrix.xy, fontMatrix.yy,
+                            fontMatrix.x0, fontMatrix.y0);
     svgToAppSpace.Scale(1.0f / mUnitsPerEm, 1.0f / mUnitsPerEm);
 
     return mSVGGlyphs->GetGlyphExtents(aGlyphId, svgToAppSpace, aResult);
 }
 
 bool
 gfxFontEntry::RenderSVGGlyph(gfxContext *aContext, uint32_t aGlyphId,
                              int aDrawMode, gfxTextContextPaint *aContextPaint)