Remove run count field from SkTextBlob.
We can flag the last run record instead. Run iteration is always
sequential, so no penalty.
As a side effect, we can no longer allow instantiation of zero-run text
blobs - but that seems like a good idea anyway.
Change-Id: I7ca80c4780623d5a188f92dfe6d6fe152f20f666
Reviewed-on: https://skia-review.googlesource.com/9149
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/include/core/SkTextBlob.h b/include/core/SkTextBlob.h
index 8198f04..1d17f4d 100644
--- a/include/core/SkTextBlob.h
+++ b/include/core/SkTextBlob.h
@@ -60,7 +60,7 @@
friend class SkNVRefCnt<SkTextBlob>;
class RunRecord;
- SkTextBlob(int runCount, const SkRect& bounds);
+ explicit SkTextBlob(const SkRect& bounds);
~SkTextBlob();
@@ -78,8 +78,7 @@
friend class SkTextBlobBuilder;
friend class SkTextBlobRunIterator;
- const int fRunCount;
- const SkRect fBounds;
+ const SkRect fBounds;
const uint32_t fUniqueID;
SkDEBUGCODE(size_t fStorageSize;)
@@ -101,8 +100,10 @@
~SkTextBlobBuilder();
/**
- * Returns an immutable SkTextBlob for the current runs/glyphs. The builder is reset and
- * can be reused.
+ * Returns an immutable SkTextBlob for the current runs/glyphs,
+ * or nullptr if no runs were allocated.
+ *
+ * The builder is reset and can be reused.
*/
sk_sp<SkTextBlob> make();