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

Side by Side Diff: tests/ColorFilterTest.cpp

Issue 137433003: Convert SkWriter32 to use an SkTDArray for its internal storage. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: of course 0's fine too... Created 6 years, 11 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 unified diff | Download patch
« no previous file with comments | « tests/AndroidPaintTest.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « tests/AndroidPaintTest.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698