aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/core/SkDraw.cpp2
-rw-r--r--src/gpu/SkGpuDevice.cpp12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 4cc068d609..14e5a803cb 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1628,7 +1628,7 @@ void SkDraw::drawText(const char text[], size_t byteLength,
// apply the bias here, so we don't have to add 1/2 in the loop
fx += SK_FixedHalf;
fy += SK_FixedHalf;
- fy &= finalFYMask;
+ fyMask &= finalFYMask;
SkAutoKern autokern;
SkDraw1Glyph d1g;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7b70b50c62..2d50c3652d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1261,8 +1261,18 @@ static void SkGPU_Draw1Glyph(const SkDraw1Glyph& state,
if (NULL == procs->fFontScaler) {
procs->fFontScaler = get_gr_font_scaler(state.fCache);
}
+
+ /*
+ * Skia calls us with fx,fy already biased by 1/2. It does this to speed
+ * up rounding these, so that all of its procs (like us) can just call
+ * SkFixedFloor and get the "rounded" value.
+ *
+ * We take advantage of that for fx, where we pass a rounded value, but
+ * we want the fractional fy, so we have to unbias it first.
+ */
procs->fTextContext->drawPackedGlyph(GrGlyph::Pack(glyph.getGlyphID(), fx, 0),
- SkIntToFixed(SkFixedFloor(fx)), fy,
+ SkIntToFixed(SkFixedFloor(fx)),
+ fy - SK_FixedHalf,
procs->fFontScaler);
}