| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 #include "TestClassDef.h" | 9 #include "TestClassDef.h" |
| 10 #include "SkColor.h" | 10 #include "SkColor.h" |
| 11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
| 12 #include "SkColorFilter.h" | 12 #include "SkColorFilter.h" |
| 13 #include "SkLumaColorFilter.h" | 13 #include "SkLumaColorFilter.h" |
| 14 #include "SkRandom.h" | 14 #include "SkRandom.h" |
| 15 #include "SkXfermode.h" | 15 #include "SkXfermode.h" |
| 16 #include "SkOrderedReadBuffer.h" | 16 #include "SkOrderedReadBuffer.h" |
| 17 #include "SkOrderedWriteBuffer.h" | 17 #include "SkOrderedWriteBuffer.h" |
| 18 | 18 |
| 19 static SkColorFilter* reincarnate_colorfilter(SkFlattenable* obj) { | 19 static SkColorFilter* reincarnate_colorfilter(SkFlattenable* obj) { |
| 20 SkOrderedWriteBuffer wb(1024); | 20 SkOrderedWriteBuffer wb; |
| 21 wb.writeFlattenable(obj); | 21 wb.writeFlattenable(obj); |
| 22 | 22 |
| 23 size_t size = wb.size(); | 23 size_t size = wb.size(); |
| 24 SkAutoSMalloc<1024> storage(size); | 24 SkAutoSMalloc<1024> storage(size); |
| 25 // make a copy into storage | 25 // make a copy into storage |
| 26 wb.writeToMemory(storage.get()); | 26 wb.writeToMemory(storage.get()); |
| 27 | 27 |
| 28 SkOrderedReadBuffer rb(storage.get(), size); | 28 SkOrderedReadBuffer rb(storage.get(), size); |
| 29 return rb.readColorFilter(); | 29 return rb.readColorFilter(); |
| 30 } | 30 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 for (unsigned i = 1; i < 256; ++i) { | 119 for (unsigned i = 1; i < 256; ++i) { |
| 120 in = SkPackARGB32(i, i, i / 2, i / 3); | 120 in = SkPackARGB32(i, i, i / 2, i / 3); |
| 121 lf->filterSpan(&in, 1, &out); | 121 lf->filterSpan(&in, 1, &out); |
| 122 REPORTER_ASSERT(reporter, out != in); | 122 REPORTER_ASSERT(reporter, out != in); |
| 123 REPORTER_ASSERT(reporter, SkGetPackedA32(out) <= i); | 123 REPORTER_ASSERT(reporter, SkGetPackedA32(out) <= i); |
| 124 REPORTER_ASSERT(reporter, SkGetPackedR32(out) == 0); | 124 REPORTER_ASSERT(reporter, SkGetPackedR32(out) == 0); |
| 125 REPORTER_ASSERT(reporter, SkGetPackedG32(out) == 0); | 125 REPORTER_ASSERT(reporter, SkGetPackedG32(out) == 0); |
| 126 REPORTER_ASSERT(reporter, SkGetPackedB32(out) == 0); | 126 REPORTER_ASSERT(reporter, SkGetPackedB32(out) == 0); |
| 127 } | 127 } |
| 128 } | 128 } |
| OLD | NEW |