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

Unified Diff: src/utils/SkGatherPixelRefsAndRects.h

Issue 609223003: Revert of Fix SkTextBlob offset semantics. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: 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 0a4bb5b84c377e18d17b39c4ff8fa3cffb61ac7b..e1e5ccd92e22f55c2756a7b8a10c5fca5f5d1cce 100644
--- a/src/utils/SkGatherPixelRefsAndRects.h
+++ b/src/utils/SkGatherPixelRefsAndRects.h
@@ -195,8 +195,8 @@
this->drawRect(draw, bounds, paint);
}
virtual void drawPosText(const SkDraw& draw, const void* text, size_t len,
- const SkScalar pos[], int scalarsPerPos,
- const SkPoint& offset, const SkPaint& paint) SK_OVERRIDE {
+ const SkScalar pos[], SkScalar constY,
+ int scalarsPerPos, const SkPaint& paint) SK_OVERRIDE {
SkBitmap bitmap;
if (!GetBitmapFromPaint(paint, &bitmap)) {
return;
@@ -209,13 +209,18 @@
// Similar to SkDraw asserts.
SkASSERT(scalarsPerPos == 1 || scalarsPerPos == 2);
- SkPoint min = SkPoint::Make(offset.x() + pos[0],
- offset.y() + (2 == scalarsPerPos ? pos[1] : 0));
- SkPoint max = min;
+ SkScalar y = scalarsPerPos == 1 ? constY : constY + pos[1];
+
+ SkPoint min, max;
+ min.set(pos[0], y);
+ max.set(pos[0], y);
for (size_t i = 1; i < len; ++i) {
- SkScalar x = offset.x() + pos[i * scalarsPerPos];
- SkScalar y = offset.y() + (2 == scalarsPerPos ? pos[i * 2 + 1] : 0);
+ SkScalar x = pos[i * scalarsPerPos];
+ SkScalar y = constY;
+ if (2 == scalarsPerPos) {
+ y += pos[i * scalarsPerPos + 1];
+ }
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