aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-08 15:42:19 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-08 15:42:19 +0000
commit39ce0ac09a375aab18659b1a4ed0c503b0b81a4c (patch)
treeabf3bd986355f68ba52e40c2e5d1fc315f5c0477 /src
parent0e2810be95d3f1aa95c341521d3f514eb9e9ebde (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/core/SkDraw.cpp2
-rw-r--r--src/gpu/SkGpuDevice.cpp12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 4cc068d609..14e5a803cb 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -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;
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 7b70b50c62..2d50c3652d 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -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);
}