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/tests/TextBlobTest.cpp b/tests/TextBlobTest.cpp
index 09389a4..3834116 100644
--- a/tests/TextBlobTest.cpp
+++ b/tests/TextBlobTest.cpp
@@ -105,7 +105,7 @@
// Explicit bounds.
{
sk_sp<SkTextBlob> blob(builder.make());
- REPORTER_ASSERT(reporter, blob->bounds().isEmpty());
+ REPORTER_ASSERT(reporter, !blob);
}
{
@@ -143,9 +143,8 @@
}
{
- // Verify empty blob bounds after building some non-empty blobs.
sk_sp<SkTextBlob> blob(builder.make());
- REPORTER_ASSERT(reporter, blob->bounds().isEmpty());
+ REPORTER_ASSERT(reporter, !blob);
}
// Implicit bounds
@@ -273,6 +272,10 @@
}
sk_sp<SkTextBlob> blob(builder.make());
+ REPORTER_ASSERT(reporter, (inCount > 0) == SkToBool(blob));
+ if (!blob) {
+ return;
+ }
SkTextBlobRunIterator it(blob.get());
for (unsigned i = 0; i < outCount; ++i) {