From 2515242ee079af3b3555620ea0c92338f47620fd Mon Sep 17 00:00:00 2001 From: "commit-bot@chromium.org" Date: Wed, 7 Aug 2013 16:22:47 +0000 Subject: 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 --- src/core/SkBBoxRecord.cpp | 8 ++++++++ src/core/SkBBoxRecord.h | 3 +++ src/core/SkCanvas.cpp | 6 ++++++ 3 files changed, 17 insertions(+) (limited to 'src') 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) { -- cgit v1.2.3