add rsxform runs to textblobs
Bug: skia:
Change-Id: I72a1921a0300dfdac567e25acbdf20cc168ac0be
Reviewed-on: https://skia-review.googlesource.com/c/175834
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/include/core/SkCanvasVirtualEnforcer.h b/include/core/SkCanvasVirtualEnforcer.h
index 87c153a..6664b0a 100644
--- a/include/core/SkCanvasVirtualEnforcer.h
+++ b/include/core/SkCanvasVirtualEnforcer.h
@@ -30,8 +30,6 @@
void onDrawPath(const SkPath& path, const SkPaint& paint) override = 0;
void onDrawRegion(const SkRegion& region, const SkPaint& paint) override = 0;
- void onDrawTextRSXform(const void* text, size_t byteLength, const SkRSXform xform[],
- const SkRect* cullRect, const SkPaint& paint) override = 0;
void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) override = 0;
diff --git a/include/core/SkOverdrawCanvas.h b/include/core/SkOverdrawCanvas.h
index 65998e7..eef2ef5 100644
--- a/include/core/SkOverdrawCanvas.h
+++ b/include/core/SkOverdrawCanvas.h
@@ -21,8 +21,6 @@
/* Does not take ownership of canvas */
SkOverdrawCanvas(SkCanvas*);
- void onDrawTextRSXform(const void*, size_t, const SkRSXform[], const SkRect*,
- const SkPaint&) override;
void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override;
void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode,
const SkPaint&) override;
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h
index a9f8834..6ead9d4 100644
--- a/include/core/SkTextBlob.h
+++ b/include/core/SkTextBlob.h
@@ -26,6 +26,7 @@
#include <atomic>
+struct SkRSXform;
struct SkSerialProcs;
struct SkDeserialProcs;
@@ -58,6 +59,8 @@
Pass nullptr for intervals to determine the size of the interval array.
+ Runs within the blob that contain SkRSXforms are ignored when computing intercepts.
+
@param bounds lower and upper line parallel to the advance
@param intervals returned intersections; may be nullptr
@param paint specifies stroking, SkPathEffect that affects the result; may be nullptr
@@ -128,6 +131,11 @@
const SkPoint pos[], const SkFont& font,
SkTextEncoding encoding = kUTF8_SkTextEncoding);
+ // Experimental
+ static sk_sp<SkTextBlob> MakeFromRSXform(const void* text, size_t byteLength,
+ const SkRSXform xform[], const SkFont& font,
+ SkTextEncoding encoding = kUTF8_SkTextEncoding);
+
/** Writes data to allow later reconstruction of SkTextBlob. memory points to storage
to receive the encoded data, and memory_size describes the size of storage.
Returns bytes used if provided storage is large enough to hold all data;
@@ -332,6 +340,9 @@
const RunBuffer& allocRunPos(const SkFont& font, int count,
const SkRect* bounds = nullptr);
+ // Experimental, RunBuffer.pos points to SkRSXforms
+ const RunBuffer& allocRunRSXform(const SkFont& font, int count);
+
private:
const RunBuffer& allocRunText(const SkFont& font,
int count,
@@ -346,6 +357,10 @@
const RunBuffer& allocRunTextPos(const SkFont& font, int count,
int textByteCount, SkString lang,
const SkRect* bounds = nullptr);
+ const RunBuffer& allocRunRSXform(const SkFont& font, int count,
+ int textByteCount, SkString lang,
+ const SkRect* bounds = nullptr);
+
void reserve(size_t size);
void allocInternal(const SkFont& font, SkTextBlob::GlyphPositioning positioning,
int count, int textBytes, SkPoint offset, const SkRect* bounds);