unbias fy in the gpu glyphproc, since skia has pre-added 1/2 to the value
(assuming we would call floor to get a rounded value.)
apply finalFYMask not to the initial fy, but to the fyMask (so it is always
applied in the loop) in drawText.
git-svn-id: http://skia.googlecode.com/svn/trunk@1084 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 4cc068d..14e5a80 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1628,7 +1628,7 @@
// 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 7b70b50..2d50c36 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1261,8 +1261,18 @@
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);
}