Don't convert to Sk48Dot16 in DrawOneGlyph.

GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1831983002

Review URL: https://codereview.chromium.org/1831983002
This commit is contained in:
benjaminwagner 2016-03-25 11:24:30 -07:00 committed by Commit bot
parent d442d32335
commit 77a9cc1dea

View File

@ -1455,18 +1455,16 @@ public:
void operator()(const SkGlyph& glyph, SkPoint position, SkPoint rounding) { void operator()(const SkGlyph& glyph, SkPoint position, SkPoint rounding) {
position += rounding; position += rounding;
Sk48Dot16 fx = SkScalarTo48Dot16(position.fX);
Sk48Dot16 fy = SkScalarTo48Dot16(position.fY);
// Prevent glyphs from being drawn outside of or straddling the edge of device space. // Prevent glyphs from being drawn outside of or straddling the edge of device space.
if ((fx >> 16) > INT_MAX - (INT16_MAX + UINT16_MAX) || if (position.fX > INT_MAX - (INT16_MAX + UINT16_MAX) ||
(fx >> 16) < INT_MIN - (INT16_MIN + 0 /*UINT16_MIN*/) || position.fX < INT_MIN - (INT16_MIN + 0 /*UINT16_MIN*/) ||
(fy >> 16) > INT_MAX - (INT16_MAX + UINT16_MAX) || position.fY > INT_MAX - (INT16_MAX + UINT16_MAX) ||
(fy >> 16) < INT_MIN - (INT16_MIN + 0 /*UINT16_MIN*/)) { position.fY < INT_MIN - (INT16_MIN + 0 /*UINT16_MIN*/)) {
return; return;
} }
int left = Sk48Dot16FloorToInt(fx); int left = SkScalarFloorToInt(position.fX);
int top = Sk48Dot16FloorToInt(fy); int top = SkScalarFloorToInt(position.fY);
SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0); SkASSERT(glyph.fWidth > 0 && glyph.fHeight > 0);
left += glyph.fLeft; left += glyph.fLeft;