aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PaintTest.cpp
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-09-25 11:57:53 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-25 11:57:53 -0700
commit610a015fda84cd5d1e3f3f826bab393f1193bc0e (patch)
treebb8d9f1125490be5770283070c2d5eac13759bad /tests/PaintTest.cpp
parentb5fae93d72c7b6480f83fd8a7b534cd1fdfcd49a (diff)
Remove SkPaint dirty bits.
fDirtyBits is only used by SkPaint::FlatteningTraits, which in turn was only used as a smaller, faster format to flatten paints in-memory to dedup them in the old picture backend. SkRecord obsoleted all this. Neither flatten()/unflatten() (disk format) nor FlatteningTraits is used anywhere performance or size matters. Here I revert the deduping code back to using the disk format for flattened paints. We stil do have to flatten and unflatten paints while coverting from SkRecord backend to the old backend, so we can't just delete this all yet, but any faithful round trip flatten()/unflatten() pair will be fine, however slow. NOTRY=true BUG=skia: R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/604813003
Diffstat (limited to 'tests/PaintTest.cpp')
-rw-r--r--tests/PaintTest.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 57d028336a..cbb5dadcc5 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -315,7 +315,7 @@ DEF_TEST(Paint_regression_measureText, reporter) {
#define ASSERT(expr) REPORTER_ASSERT(r, expr)
-DEF_TEST(Paint_FlatteningTraits, r) {
+DEF_TEST(Paint_MoreFlattening, r) {
SkPaint paint;
paint.setColor(0x00AABBCC);
paint.setTextScaleX(1.0f); // Default value, ignored.
@@ -324,20 +324,11 @@ DEF_TEST(Paint_FlatteningTraits, r) {
paint.setLooper(NULL); // Default value, ignored.
SkWriteBuffer writer;
- SkPaint::FlatteningTraits::Flatten(writer, paint);
-
- // BEGIN white box asserts: if the impl changes, these asserts may change
- const size_t expectedBytesWritten = sizeof(void*) == 8 ? 32 : 28;
- ASSERT(expectedBytesWritten == writer.bytesWritten());
-
- const uint32_t* written = writer.getWriter32()->contiguousArray();
- SkASSERT(written != NULL);
- ASSERT(*written == ((1<<0) | (1<<1) | (1<<8))); // Dirty bits for our 3.
- // END white box asserts
+ paint.flatten(writer);
- SkReadBuffer reader(written, writer.bytesWritten());
+ SkReadBuffer reader(writer.getWriter32()->contiguousArray(), writer.bytesWritten());
SkPaint other;
- SkPaint::FlatteningTraits::Unflatten(reader, &other);
+ other.unflatten(reader);
ASSERT(reader.offset() == writer.bytesWritten());
// No matter the encoding, these must always hold.