OLD | NEW |
1 // SkPaints only have an SkPaintOptionsAndroid if SK_BUILD_FOR_ANDROID is true. | 1 // SkPaints only have an SkPaintOptionsAndroid if SK_BUILD_FOR_ANDROID is true. |
2 #ifdef SK_BUILD_FOR_ANDROID | 2 #ifdef SK_BUILD_FOR_ANDROID |
3 | 3 |
4 #include "SkPaintOptionsAndroid.h" | 4 #include "SkPaintOptionsAndroid.h" |
5 #include "SkOrderedReadBuffer.h" | 5 #include "SkOrderedReadBuffer.h" |
6 #include "SkOrderedWriteBuffer.h" | 6 #include "SkOrderedWriteBuffer.h" |
7 #include "SkPaint.h" | 7 #include "SkPaint.h" |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "TestClassDef.h" | |
10 | 9 |
11 static size_t Reconstruct(const SkPaint& src, SkPaint* dst) { | 10 static size_t Reconstruct(const SkPaint& src, SkPaint* dst) { |
12 SkOrderedWriteBuffer writer(64 /*arbitrary*/); | 11 SkOrderedWriteBuffer writer(64 /*arbitrary*/); |
13 src.flatten(writer); | 12 src.flatten(writer); |
14 | 13 |
15 const size_t size = writer.bytesWritten(); | 14 const size_t size = writer.bytesWritten(); |
16 SkAutoMalloc bytes(size); | 15 SkAutoMalloc bytes(size); |
17 writer.writeToMemory(bytes.get()); | 16 writer.writeToMemory(bytes.get()); |
18 | 17 |
19 SkOrderedReadBuffer reader(bytes.get(), size); | 18 SkOrderedReadBuffer reader(bytes.get(), size); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 SkPaint nonDefaultOptions; | 68 SkPaint nonDefaultOptions; |
70 nonDefaultOptions.setPaintOptionsAndroid(options); | 69 nonDefaultOptions.setPaintOptionsAndroid(options); |
71 | 70 |
72 SkPaint dummy; | 71 SkPaint dummy; |
73 | 72 |
74 REPORTER_ASSERT(reporter, | 73 REPORTER_ASSERT(reporter, |
75 Reconstruct(defaultOptions, &dummy) < Reconstruct(nonDefault
Options, &dummy)); | 74 Reconstruct(defaultOptions, &dummy) < Reconstruct(nonDefault
Options, &dummy)); |
76 } | 75 } |
77 | 76 |
78 #endif // SK_BUILD_FOR_ANDROID | 77 #endif // SK_BUILD_FOR_ANDROID |
OLD | NEW |