aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar hendrikw <hendrikw@chromium.org>2015-03-31 12:02:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-31 12:02:48 -0700
commite0f812a7a107986dfa72e6855c1608b077428136 (patch)
treed7f45e8b001a9a135c1163687e5b36d780c319b4 /src
parentc03391e792a55219ddcb033475dc6b80e6a3e2f9 (diff)
skia: Fix text subpixel half sample default for GPU rasterization
In software, SkDraw1Glyph::Proc SkDraw1Glyph::init initializes fHalfSampleX, fHalfSampleY to SkGlyph::kSubpixelRound. In hardware, however, these values were initialized to zero. Fix, match software's implementation BUG=471919 Review URL: https://codereview.chromium.org/1047803004
Diffstat (limited to 'src')
-rwxr-xr-xsrc/gpu/GrBitmapTextContext.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index dd01e7d2b8..4eeb172aa8 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -227,7 +227,6 @@ void GrBitmapTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip& clip,
const char* stop = text + byteLength;
SkTextAlignProc alignProc(fSkPaint.getTextAlign());
SkTextMapStateProc tmsProc(viewMatrix, offset, scalarsPerPosition);
- SkScalar halfSampleX = 0, halfSampleY = 0;
if (cache->isSubpixel()) {
// maybe we should skip the rounding if linearText is set
@@ -235,6 +234,8 @@ void GrBitmapTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip& clip,
SkFixed fxMask = ~0;
SkFixed fyMask = ~0;
+ SkScalar halfSampleX = SkFixedToScalar(SkGlyph::kSubpixelRound);
+ SkScalar halfSampleY = SkFixedToScalar(SkGlyph::kSubpixelRound);
if (kX_SkAxisAlignment == baseline) {
fyMask = 0;
halfSampleY = SK_ScalarHalf;
@@ -310,8 +311,8 @@ void GrBitmapTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip& clip,
SkPoint tmsLoc;
tmsProc(pos, &tmsLoc);
- Sk48Dot16 fx = SkScalarTo48Dot16(tmsLoc.fX + SK_ScalarHalf); //halfSampleX;
- Sk48Dot16 fy = SkScalarTo48Dot16(tmsLoc.fY + SK_ScalarHalf); //halfSampleY;
+ Sk48Dot16 fx = SkScalarTo48Dot16(tmsLoc.fX + SK_ScalarHalf);
+ Sk48Dot16 fy = SkScalarTo48Dot16(tmsLoc.fY + SK_ScalarHalf);
this->appendGlyph(GrGlyph::Pack(glyph.getGlyphID(),
glyph.getSubXFixed(),
glyph.getSubYFixed(),
@@ -334,8 +335,8 @@ void GrBitmapTextContext::onDrawPosText(GrRenderTarget* rt, const GrClip& clip,
SkPoint alignLoc;
alignProc(tmsLoc, glyph, &alignLoc);
- Sk48Dot16 fx = SkScalarTo48Dot16(alignLoc.fX + SK_ScalarHalf); //halfSampleX;
- Sk48Dot16 fy = SkScalarTo48Dot16(alignLoc.fY + SK_ScalarHalf); //halfSampleY;
+ Sk48Dot16 fx = SkScalarTo48Dot16(alignLoc.fX + SK_ScalarHalf);
+ Sk48Dot16 fy = SkScalarTo48Dot16(alignLoc.fY + SK_ScalarHalf);
this->appendGlyph(GrGlyph::Pack(glyph.getGlyphID(),
glyph.getSubXFixed(),
glyph.getSubYFixed(),