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
This commit is contained in:
reed@google.com 2011-04-08 15:42:19 +00:00
parent 0e2810be95
commit 39ce0ac09a
2 changed files with 12 additions and 2 deletions

View File

@ -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;

View File

@ -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);
}