From 3b139f5888e81a6b6b97e5250ac2a61888bb9770 Mon Sep 17 00:00:00 2001 From: "reed@google.com" Date: Tue, 7 Jun 2011 17:56:25 +0000 Subject: [PATCH] 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 --- src/gpu/SkGpuDevice.cpp | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 7166a07f51..ae8ab6c842 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -1211,16 +1211,23 @@ static void SkGPU_Draw1Glyph(const SkDraw1Glyph& state, } /* - * 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); }