aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-21 19:44:24 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-05-21 19:44:24 +0000
commit5408f8ffdbca9efd787304d62dde6b142c3f0f82 (patch)
treede5a3ffee13d8cfc09c857987e835e1f5a3a7151 /src/gpu
parentb03be0b887facebc9f6a202c43a1347284655d75 (diff)
Remove 1/2 pixel offsets for distance field layout.
The 1/2 pixel offsets are for rounding when snapping the glyphs to integer boundaries. Since we're using subpixel layout and sampled textures, we shouldn't snap to integer boundaries. BUG=skia:2173 R=bungeman@google.com, reed@google.com Author: jvanverth@google.com Review URL: https://codereview.chromium.org/298753005 git-svn-id: http://skia.googlecode.com/svn/trunk@14828 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rwxr-xr-xsrc/gpu/GrDistanceFieldTextContext.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index afc2a47ff1..2d2f9a1443 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -416,8 +416,8 @@ void GrDistanceFieldTextContext::drawText(const GrPaint& paint, const SkPaint& s
y -= alignY;
}
- SkFixed fx = SkScalarToFixed(x) + SK_FixedHalf;
- SkFixed fy = SkScalarToFixed(y) + SK_FixedHalf;
+ SkFixed fx = SkScalarToFixed(x);
+ SkFixed fy = SkScalarToFixed(y);
SkFixed fixedScale = SkScalarToFixed(sizeRatio);
while (text < stop) {
const SkGlyph& glyph = glyphCacheProc(cache, &text, 0, 0);
@@ -426,8 +426,8 @@ void GrDistanceFieldTextContext::drawText(const GrPaint& paint, const SkPaint& s
this->drawPackedGlyph(GrGlyph::Pack(glyph.getGlyphID(),
glyph.getSubXFixed(),
glyph.getSubYFixed()),
- SkFixedFloorToFixed(fx),
- SkFixedFloorToFixed(fy),
+ fx,
+ fy,
fontScaler);
}
@@ -473,8 +473,8 @@ void GrDistanceFieldTextContext::drawPosText(const GrPaint& paint, const SkPaint
this->drawPackedGlyph(GrGlyph::Pack(glyph.getGlyphID(),
glyph.getSubXFixed(),
glyph.getSubYFixed()),
- SkScalarToFixed(x) + SK_FixedHalf, //d1g.fHalfSampleX,
- SkScalarToFixed(y) + SK_FixedHalf, //d1g.fHalfSampleY,
+ SkScalarToFixed(x),
+ SkScalarToFixed(y),
fontScaler);
}
pos += scalarsPerPosition;
@@ -492,10 +492,8 @@ void GrDistanceFieldTextContext::drawPosText(const GrPaint& paint, const SkPaint
this->drawPackedGlyph(GrGlyph::Pack(glyph.getGlyphID(),
glyph.getSubXFixed(),
glyph.getSubYFixed()),
- SkScalarToFixed(x) - (glyph.fAdvanceX >> alignShift)
- + SK_FixedHalf, //d1g.fHalfSampleX,
- SkScalarToFixed(y) - (glyph.fAdvanceY >> alignShift)
- + SK_FixedHalf, //d1g.fHalfSampleY,
+ SkScalarToFixed(x) - (glyph.fAdvanceX >> alignShift),
+ SkScalarToFixed(y) - (glyph.fAdvanceY >> alignShift),
fontScaler);
}
pos += scalarsPerPosition;