diff options
author | reed <reed@google.com> | 2016-07-07 12:47:17 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-07 12:47:17 -0700 |
commit | 45561a0b15fe045ba272c328684c3f7ae290785a (patch) | |
tree | 185647ba5e92daf0899b1d8985dbf4a46a76f7b9 /include | |
parent | a76a10b730ae3fb2abb7c06839ca9c5d14df5ca7 (diff) |
drawTextRSXform
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2130643004
Review-Url: https://codereview.chromium.org/2130643004
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 10 | ||||
-rw-r--r-- | include/core/SkDevice.h | 2 | ||||
-rw-r--r-- | include/core/SkPicture.h | 3 | ||||
-rw-r--r-- | include/private/SkRecords.h | 7 | ||||
-rw-r--r-- | include/utils/SkDumpCanvas.h | 2 | ||||
-rw-r--r-- | include/utils/SkLuaCanvas.h | 2 | ||||
-rw-r--r-- | include/utils/SkNWayCanvas.h | 2 | ||||
-rw-r--r-- | include/utils/SkPaintFilterCanvas.h | 2 |
8 files changed, 29 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index ec14829ca8..7dd0189441 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -989,6 +989,14 @@ public: void drawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint& paint); + /** + * Draw the text with each character/glyph individually transformed by its xform. + * If cullRect is not null, it is a conservative bounds of what will be drawn + * taking into account the xforms and the paint) and will be used to accelerate culling. + */ + void drawTextRSXform(const void* text, size_t byteLength, const SkRSXform[], + const SkRect* cullRect, const SkPaint& paint); + /** Draw the text blob, offset by (x,y), using the specified paint. @param blob The text blob to be drawn @param x The x-offset of the text being drawn @@ -1324,6 +1332,8 @@ protected: virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint& paint); + virtual void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform[], + const SkRect* cullRect, const SkPaint& paint); virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint); diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index e06650036d..d23aa6916f 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -273,6 +273,8 @@ protected: virtual void drawTextOnPath(const SkDraw&, const void* text, size_t len, const SkPath&, const SkMatrix*, const SkPaint&); + virtual void drawTextRSXform(const SkDraw&, const void* text, size_t len, const SkRSXform[], + const SkPaint&); bool readPixels(const SkImageInfo&, void* dst, size_t rowBytes, int x, int y); diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index eb35ef6366..8e3d1c8019 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -206,10 +206,11 @@ private: // V43: Added DRAW_IMAGE and DRAW_IMAGE_RECT opt codes to serialized data // V44: Move annotations from paint to drawAnnotation // V45: Add invNormRotation to SkLightingShader. + // V46: Add drawTextRSXform // Only SKPs within the min/current picture version range (inclusive) can be read. static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M39. - static const uint32_t CURRENT_PICTURE_VERSION = 45; + static const uint32_t CURRENT_PICTURE_VERSION = 46; static_assert(MIN_PICTURE_VERSION <= 41, "Remove kFontFileName and related code from SkFontDescriptor.cpp."); diff --git a/include/private/SkRecords.h b/include/private/SkRecords.h index d6ef12fe6c..9ec2d2116c 100644 --- a/include/private/SkRecords.h +++ b/include/private/SkRecords.h @@ -72,6 +72,7 @@ namespace SkRecords { M(DrawPosTextH) \ M(DrawText) \ M(DrawTextOnPath) \ + M(DrawTextRSXform) \ M(DrawRRect) \ M(DrawRect) \ M(DrawTextBlob) \ @@ -344,6 +345,12 @@ RECORD(DrawTextOnPath, kDraw_Tag|kHasText_Tag, size_t byteLength; PreCachedPath path; TypedMatrix matrix); +RECORD(DrawTextRSXform, kDraw_Tag|kHasText_Tag, + SkPaint paint; + PODArray<char> text; + size_t byteLength; + PODArray<SkRSXform> xforms; + Optional<SkRect> cull); RECORD(DrawPatch, kDraw_Tag, SkPaint paint; PODArray<SkPoint> cubics; diff --git a/include/utils/SkDumpCanvas.h b/include/utils/SkDumpCanvas.h index 35d694eedb..fc058be657 100644 --- a/include/utils/SkDumpCanvas.h +++ b/include/utils/SkDumpCanvas.h @@ -87,6 +87,8 @@ protected: SkScalar constY, const SkPaint&) override; virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint&) override; + void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[], + const SkRect* cull, const SkPaint& paint) override; virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) override; virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], diff --git a/include/utils/SkLuaCanvas.h b/include/utils/SkLuaCanvas.h index 37e82be51d..64f285b26c 100644 --- a/include/utils/SkLuaCanvas.h +++ b/include/utils/SkLuaCanvas.h @@ -37,6 +37,8 @@ protected: SkScalar constY, const SkPaint&) override; virtual void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint&) override; + void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[], + const SkRect* cull, const SkPaint& paint) override; virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) override; diff --git a/include/utils/SkNWayCanvas.h b/include/utils/SkNWayCanvas.h index f2a99db802..a4b9c59412 100644 --- a/include/utils/SkNWayCanvas.h +++ b/include/utils/SkNWayCanvas.h @@ -49,6 +49,8 @@ protected: const SkMatrix* matrix, const SkPaint&) override; virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) override; + void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[], + const SkRect* cull, const SkPaint& paint) override; virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], const SkPoint texCoords[4], SkXfermode* xmode, const SkPaint& paint) override; diff --git a/include/utils/SkPaintFilterCanvas.h b/include/utils/SkPaintFilterCanvas.h index 909cf3b987..037bac6f73 100644 --- a/include/utils/SkPaintFilterCanvas.h +++ b/include/utils/SkPaintFilterCanvas.h @@ -95,6 +95,8 @@ protected: SkScalar constY, const SkPaint&) override; void onDrawTextOnPath(const void* text, size_t byteLength, const SkPath& path, const SkMatrix* matrix, const SkPaint&) override; + void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[], + const SkRect* cull, const SkPaint& paint) override; void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint) override; |