Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: tests/PaintTest.cpp

Issue 169183003: Revert of Merge tomhudson and mtklein SkPaint shrinking approaches. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PaintTest.cpp
diff --git a/tests/PaintTest.cpp b/tests/PaintTest.cpp
index 3a90c54aa37fa089376af475bd54c793a4597660..3210e77f19b74e060b8d949aa1f6dbbef0875c1d 100644
--- a/tests/PaintTest.cpp
+++ b/tests/PaintTest.cpp
@@ -11,11 +11,8 @@
#include "SkPaint.h"
#include "SkPath.h"
#include "SkRandom.h"
-#include "SkReadBuffer.h"
#include "SkTypeface.h"
#include "SkUtils.h"
-#include "SkWriteBuffer.h"
-#include "SkXfermode.h"
#include "Test.h"
static size_t uni_to_utf8(const SkUnichar src[], void* dst, int count) {
@@ -254,39 +251,3 @@
test_cmap(reporter);
}
}
-
-#define ASSERT(expr) REPORTER_ASSERT(r, expr)
-
-DEF_TEST(Paint_FlatteningTraits, r) {
- SkPaint paint;
- paint.setColor(0x00AABBCC);
- paint.setTextScaleX(1.0f); // Encoded despite being the default value.
- paint.setTextSize(19);
- paint.setXfermode(SkXfermode::Create(SkXfermode::kModulate_Mode));
- paint.setLooper(NULL); // Ignored.
-
- SkWriteBuffer writer;
- SkPaint::FlatteningTraits::Flatten(writer, paint);
- ASSERT(writer.bytesWritten() == 48);
-
- const uint32_t* written = writer.getWriter32()->contiguousArray();
- SkASSERT(written != NULL);
- ASSERT(*written == ((1<<0) | (1<<2) | (1<<3) | (1<<9))); // Dirty bits for our 4.
-
- SkReadBuffer reader(written, writer.bytesWritten());
- SkPaint other;
- SkPaint::FlatteningTraits::Unflatten(reader, &other);
- ASSERT(reader.offset() == writer.bytesWritten());
-
- // No matter the encoding, these must always hold.
- ASSERT(other.getColor() == paint.getColor());
- ASSERT(other.getTextScaleX() == paint.getTextScaleX());
- ASSERT(other.getTextSize() == paint.getTextSize());
- ASSERT(other.getLooper() == paint.getLooper());
-
- // We have to be a little looser and compare just the modes. Pointers might not be the same.
- SkXfermode::Mode otherMode, paintMode;
- ASSERT(other.getXfermode()->asMode(&otherMode));
- ASSERT(paint.getXfermode()->asMode(&paintMode));
- ASSERT(otherMode == paintMode);
-}
« no previous file with comments | « src/core/SkPicturePlayback.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698