diff options
author | 2015-03-11 14:05:29 -0700 | |
---|---|---|
committer | 2015-03-11 14:05:29 -0700 | |
commit | 79738cc7bf12d212bef4ff80591d1bf6f383663d (patch) | |
tree | cb1d0da5197677a65209309a696b447f1c371f11 /src/device/xps | |
parent | dd8c637bc74be9a03c5738e6b37f62bbd653846b (diff) |
Glyph positions maintain 32 bit integer part.
A glyph position when mapped from canvas space to device space may land
outside the bounds of the current 16 bit integer part of device space.
Device space is already limited to 32 bits for the integer part,
but for a short space in drawText and drawPosText it is currently
limited to 16 bits (SkFixed). Raise this limit by moving to 48.16.
This matches the current similar fix for measureText.
BUG=chromium:375322
Review URL: https://codereview.chromium.org/977623002
Diffstat (limited to 'src/device/xps')
-rw-r--r-- | src/device/xps/SkXPSDevice.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/device/xps/SkXPSDevice.cpp b/src/device/xps/SkXPSDevice.cpp index 3bb87b32a3..2ca799ac37 100644 --- a/src/device/xps/SkXPSDevice.cpp +++ b/src/device/xps/SkXPSDevice.cpp @@ -2057,15 +2057,15 @@ public: }; static void xps_draw_1_glyph(const SkDraw1Glyph& state, - SkFixed x, SkFixed y, + Sk48Dot16 fx, Sk48Dot16 fy, const SkGlyph& skGlyph) { SkASSERT(skGlyph.fWidth > 0 && skGlyph.fHeight > 0); SkXPSDrawProcs* procs = static_cast<SkXPSDrawProcs*>(state.fDraw->fProcs); //Draw pre-adds half the sampling frequency for floor rounding. - x -= state.fHalfSampleX; - y -= state.fHalfSampleY; + SkScalar x = Sk48Dot16ToScalar(fx) - state.fHalfSampleX; + SkScalar y = Sk48Dot16ToScalar(fy) - state.fHalfSampleY; XPS_GLYPH_INDEX* xpsGlyph = procs->xpsGlyphs.append(); uint16_t glyphID = skGlyph.getGlyphID(); @@ -2073,14 +2073,14 @@ static void xps_draw_1_glyph(const SkDraw1Glyph& state, xpsGlyph->index = glyphID; if (1 == procs->xpsGlyphs.count()) { xpsGlyph->advanceWidth = 0.0f; - xpsGlyph->horizontalOffset = SkFixedToFloat(x) * procs->centemPerUnit; - xpsGlyph->verticalOffset = SkFixedToFloat(y) * -procs->centemPerUnit; + xpsGlyph->horizontalOffset = SkScalarToFloat(x) * procs->centemPerUnit; + xpsGlyph->verticalOffset = SkScalarToFloat(y) * -procs->centemPerUnit; } else { const XPS_GLYPH_INDEX& first = procs->xpsGlyphs[0]; xpsGlyph->advanceWidth = 0.0f; - xpsGlyph->horizontalOffset = (SkFixedToFloat(x) * procs->centemPerUnit) + xpsGlyph->horizontalOffset = (SkScalarToFloat(x) * procs->centemPerUnit) - first.horizontalOffset; - xpsGlyph->verticalOffset = (SkFixedToFloat(y) * -procs->centemPerUnit) + xpsGlyph->verticalOffset = (SkScalarToFloat(y) * -procs->centemPerUnit) - first.verticalOffset; } } |