diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-07 16:22:47 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-07 16:22:47 +0000 |
commit | 2515242ee079af3b3555620ea0c92338f47620fd (patch) | |
tree | f30a704c6049e727d2bf6604631a5dcdf4e91aa4 /src | |
parent | fbd370572acd43253cd29190d68137dee17db1b8 (diff) |
Add SkCanvas::drawPosTextBounded.
This allows subclasses which need bounding box information to get it
from the caller if it has already been computed.
BUG=chromium:269080
R=reed@google.com, tomhudson@chromium.org, tomhudson@google.com
Author: jbroman@chromium.org
Review URL: https://chromiumcodereview.appspot.com/22585002
git-svn-id: http://skia.googlecode.com/svn/trunk@10612 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkBBoxRecord.cpp | 8 | ||||
-rw-r--r-- | src/core/SkBBoxRecord.h | 3 | ||||
-rw-r--r-- | src/core/SkCanvas.cpp | 6 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/core/SkBBoxRecord.cpp b/src/core/SkBBoxRecord.cpp index 52d599f57e..666e440958 100644 --- a/src/core/SkBBoxRecord.cpp +++ b/src/core/SkBBoxRecord.cpp @@ -176,6 +176,14 @@ void SkBBoxRecord::drawPosText(const void* text, size_t byteLength, } } +void SkBBoxRecord::drawPosTextBounded(const void* text, size_t byteLength, + const SkPoint pos[], const SkRect& bbox, + const SkPaint& paint) { + if (this->transformBounds(bbox, &paint)) { + INHERITED::drawPosText(text, byteLength, pos, paint); + } +} + void SkBBoxRecord::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint& paint) { SkRect bbox; diff --git a/src/core/SkBBoxRecord.h b/src/core/SkBBoxRecord.h index 9f796717e4..16dd8fff7a 100644 --- a/src/core/SkBBoxRecord.h +++ b/src/core/SkBBoxRecord.h @@ -49,6 +49,9 @@ public: const SkRect& dst, const SkPaint* paint) SK_OVERRIDE; virtual void drawPosText(const void* text, size_t byteLength, const SkPoint pos[], const SkPaint& paint) SK_OVERRIDE; + virtual void drawPosTextBounded(const void* text, size_t byteLength, + const SkPoint pos[], const SkRect& bbox, + const SkPaint& paint) SK_OVERRIDE; virtual void drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint& paint) SK_OVERRIDE; diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 5a9a56b2c1..232bee3375 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -1990,6 +1990,12 @@ void SkCanvas::drawPosText(const void* text, size_t byteLength, LOOPER_END } +void SkCanvas::drawPosTextBounded(const void* text, size_t byteLength, + const SkPoint pos[], const SkRect& bbox, + const SkPaint& paint) { + this->drawPosText(text, byteLength, pos, paint); +} + void SkCanvas::drawPosTextH(const void* text, size_t byteLength, const SkScalar xpos[], SkScalar constY, const SkPaint& paint) { |