diff options
author | fmalita <fmalita@chromium.org> | 2014-09-29 06:29:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-29 06:29:53 -0700 |
commit | 05c4a4322e7d4f3417b7df33825bab8603d52051 (patch) | |
tree | 79a22f660fe2b6b58bab4e9f8cc1c9f86f50d565 /src/pdf | |
parent | ee6631ef90fb5a9c80de6eacd37632f11367a088 (diff) |
Revert of Revert of Fix SkTextBlob offset semantics. (patchset #1 id:1 of https://codereview.chromium.org/609223003/)
Reason for revert:
Re-landing: Chromium-side fix to be landed with the roll (https://codereview.chromium.org/607853003/)
Original issue's description:
> Revert of Fix SkTextBlob offset semantics. (patchset #2 id:20001 of https://codereview.chromium.org/605533002/)
>
> Reason for revert:
> Breaking the Chrome builds with the error:
>
> [14:54:14.317833] ../../skia/ext/pixel_ref_utils.cc:221:16: error: 'drawPosText' marked 'override' but does not override any member functions
> [14:54:14.318022] virtual void drawPosText(const SkDraw& draw,
> [14:54:14.318082] ^
>
> Original issue's description:
> > Fix SkTextBlob offset semantics.
> >
> > Implement proper x/y drawTextBlob() handling by plumbing a
> > drawPosText() offset parameter (to act as an additional glyph pos
> > translation) throughout the device layer.
> >
> > The new offset superceeds the existing constY, with a minor semantic
> > tweak: whereas previous implementations were ignoring constY in 2D
> > positioning mode (scalarsPerGlyph == 2), now the offset is always
> > observed, in all positioning modes. We can do this because existing
> > drawPosText() clients always pass constY == 0 for full positioning mode.
> >
> > R=reed@google.com, jvanverth@google.com, robertphillips@google.com
> >
> > Committed: https://skia.googlesource.com/skia/+/c13bc571d3e61a43b87eb97f0719abd304cafaf2
>
> TBR=jvanverth@google.com,reed@google.com,bsalomon@google.com,fmalita@chromium.org
> NOTREECHECKS=true
> NOTRY=true
>
> Committed: https://skia.googlesource.com/skia/+/d46b8d2bab7cfba8458432248e1568ac377429e9
R=jvanverth@google.com, reed@google.com, bsalomon@google.com, robertphillips@google.com
TBR=bsalomon@google.com, jvanverth@google.com, reed@google.com, robertphillips@google.com
NOTREECHECKS=true
NOTRY=true
Author: fmalita@chromium.org
Review URL: https://codereview.chromium.org/607413003
Diffstat (limited to 'src/pdf')
-rw-r--r-- | src/pdf/SkPDFDevice.cpp | 9 | ||||
-rw-r--r-- | src/pdf/SkPDFDeviceFlattener.cpp | 8 | ||||
-rw-r--r-- | src/pdf/SkPDFDeviceFlattener.h | 4 |
3 files changed, 11 insertions, 10 deletions
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp index aa6b521887..bd9b1d7f7e 100644 --- a/src/pdf/SkPDFDevice.cpp +++ b/src/pdf/SkPDFDevice.cpp @@ -1144,8 +1144,8 @@ void SkPDFDevice::drawText(const SkDraw& d, const void* text, size_t len, } void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len, - const SkScalar pos[], SkScalar constY, - int scalarsPerPos, const SkPaint& paint) { + const SkScalar pos[], int scalarsPerPos, + const SkPoint& offset, const SkPaint& paint) { NOT_IMPLEMENTED(paint.getMaskFilter() != NULL, false); if (paint.getMaskFilter() != NULL) { // Don't pretend we support drawing MaskFilters, it makes for artifacts @@ -1177,8 +1177,9 @@ void SkPDFDevice::drawPosText(const SkDraw& d, const void* text, size_t len, continue; } fFontGlyphUsage->noteGlyphUsage(font, &encodedValue, 1); - SkScalar x = pos[i * scalarsPerPos]; - SkScalar y = scalarsPerPos == 1 ? constY : pos[i * scalarsPerPos + 1]; + SkScalar x = offset.x() + pos[i * scalarsPerPos]; + SkScalar y = offset.y() + (2 == scalarsPerPos ? pos[i * scalarsPerPos + 1] : 0); + align_text(glyphCacheProc, textPaint, glyphIDs + i, 1, &x, &y); set_text_transform(x, y, textPaint.getTextSkewX(), &content.entry()->fContent); diff --git a/src/pdf/SkPDFDeviceFlattener.cpp b/src/pdf/SkPDFDeviceFlattener.cpp index aea87f6546..477486413a 100644 --- a/src/pdf/SkPDFDeviceFlattener.cpp +++ b/src/pdf/SkPDFDeviceFlattener.cpp @@ -123,13 +123,13 @@ void SkPDFDeviceFlattener::drawText(const SkDraw& d, const void* text, size_t le } void SkPDFDeviceFlattener::drawPosText(const SkDraw& d, const void* text, size_t len, - const SkScalar pos[], SkScalar constY, - int scalarsPerPos, const SkPaint& paint) { + const SkScalar pos[], int scalarsPerPos, + const SkPoint& offset, const SkPaint& paint) { if (mustPathText(d, paint)) { - d.drawPosText_asPaths((const char*)text, len, pos, constY, scalarsPerPos, paint); + d.drawPosText_asPaths((const char*)text, len, pos, scalarsPerPos, offset, paint); return; } - INHERITED::drawPosText(d, text, len, pos, constY,scalarsPerPos, paint); + INHERITED::drawPosText(d, text, len, pos, scalarsPerPos, offset, paint); } void SkPDFDeviceFlattener::drawTextOnPath(const SkDraw& d, const void* text, size_t len, diff --git a/src/pdf/SkPDFDeviceFlattener.h b/src/pdf/SkPDFDeviceFlattener.h index f1047db3fc..bb15237996 100644 --- a/src/pdf/SkPDFDeviceFlattener.h +++ b/src/pdf/SkPDFDeviceFlattener.h @@ -37,8 +37,8 @@ public: virtual void drawText(const SkDraw&, const void* text, size_t len, SkScalar x, SkScalar y, const SkPaint&) SK_OVERRIDE; virtual void drawPosText(const SkDraw&, const void* text, size_t len, - const SkScalar pos[], SkScalar constY, - int scalarsPerPos, const SkPaint&) SK_OVERRIDE; + const SkScalar pos[], int scalarsPerPos, + const SkPoint& offset, const SkPaint&) SK_OVERRIDE; virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, const SkPath& path, const SkMatrix* matrix, const SkPaint& paint) SK_OVERRIDE; |