Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(393)

Unified Diff: src/utils/SkGatherPixelRefsAndRects.h

Issue 605533002: Fix SkTextBlob offset semantics. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: default run positioning fix Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkGatherPixelRefsAndRects.h
diff --git a/src/utils/SkGatherPixelRefsAndRects.h b/src/utils/SkGatherPixelRefsAndRects.h
index e1e5ccd92e22f55c2756a7b8a10c5fca5f5d1cce..0a4bb5b84c377e18d17b39c4ff8fa3cffb61ac7b 100644
--- a/src/utils/SkGatherPixelRefsAndRects.h
+++ b/src/utils/SkGatherPixelRefsAndRects.h
@@ -195,8 +195,8 @@ protected:
this->drawRect(draw, bounds, paint);
}
virtual void drawPosText(const SkDraw& draw, const void* text, size_t len,
- const SkScalar pos[], SkScalar constY,
- int scalarsPerPos, const SkPaint& paint) SK_OVERRIDE {
+ const SkScalar pos[], int scalarsPerPos,
+ const SkPoint& offset, const SkPaint& paint) SK_OVERRIDE {
SkBitmap bitmap;
if (!GetBitmapFromPaint(paint, &bitmap)) {
return;
@@ -209,18 +209,13 @@ protected:
// Similar to SkDraw asserts.
SkASSERT(scalarsPerPos == 1 || scalarsPerPos == 2);
- SkScalar y = scalarsPerPos == 1 ? constY : constY + pos[1];
-
- SkPoint min, max;
- min.set(pos[0], y);
- max.set(pos[0], y);
+ SkPoint min = SkPoint::Make(offset.x() + pos[0],
+ offset.y() + (2 == scalarsPerPos ? pos[1] : 0));
+ SkPoint max = min;
for (size_t i = 1; i < len; ++i) {
- SkScalar x = pos[i * scalarsPerPos];
- SkScalar y = constY;
- if (2 == scalarsPerPos) {
- y += pos[i * scalarsPerPos + 1];
- }
+ SkScalar x = offset.x() + pos[i * scalarsPerPos];
+ SkScalar y = offset.y() + (2 == scalarsPerPos ? pos[i * 2 + 1] : 0);
min.set(SkMinScalar(x, min.x()), SkMinScalar(y, min.y()));
max.set(SkMaxScalar(x, max.x()), SkMaxScalar(y, max.y()));
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkPictureUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698