round Y baseline for text, as we do in the raster case
http://code.google.com/p/chromium/issues/detail?id=83934
git-svn-id: http://skia.googlecode.com/svn/trunk@1528 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7166a07..ae8ab6c 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -1211,16 +1211,23 @@
}
/*
- * 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.
+ * What should we do with fy? (assuming horizontal/latin text)
*
- * 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.
+ * The raster code calls SkFixedFloorToFixed on it, as it does with fx.
+ * It calls that rather than round, because our caller has already added
+ * SK_FixedHalf, so that calling floor gives us the rounded integer.
+ *
+ * Test code between raster and gpu (they should draw the same)
+ *
+ * canvas->drawText("Hamburgefons", 12, 0, 16.5f, paint);
+ *
+ * Perhaps we should only perform this integralization if there is no
+ * fExtMatrix...
*/
+ fy = SkFixedFloorToFixed(fy);
+
procs->fTextContext->drawPackedGlyph(GrGlyph::Pack(glyph.getGlyphID(), fx, 0),
- SkIntToFixed(SkFixedFloor(fx)),
- fy - SK_FixedHalf,
+ SkFixedFloorToFixed(fx), fy,
procs->fFontScaler);
}