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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorFilterImageFilter.h" | 10 #include "SkColorFilterImageFilter.h" |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 x += xOffset; | 157 x += xOffset; |
158 paint.setColorFilter(gColorFilterMakers[i]())->unref(); | 158 paint.setColorFilter(gColorFilterMakers[i]())->unref(); |
159 canvas->drawBitmap(bm, x, y, &paint); | 159 canvas->drawBitmap(bm, x, y, &paint); |
160 } | 160 } |
161 | 161 |
162 paint.setColorFilter(NULL); | 162 paint.setColorFilter(NULL); |
163 | 163 |
164 for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { | 164 for (unsigned i = 0; i < SK_ARRAY_COUNT(gColorFilterMakers); ++i) { |
165 SkAutoTUnref<SkColorFilter> colorFilter1(gColorFilterMakers[i]()
); | 165 SkAutoTUnref<SkColorFilter> colorFilter1(gColorFilterMakers[i]()
); |
166 SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilte
r::Create( | 166 SkAutoTUnref<SkImageFilter> imageFilter1(SkColorFilterImageFilte
r::Create( |
167 colorFilter1, NULL, NULL, 0)); | 167 colorFilter1, NULL, NULL)); |
168 | 168 |
169 // Move down to the next line and draw it | 169 // Move down to the next line and draw it |
170 // each draw being at xOffset of the previous one | 170 // each draw being at xOffset of the previous one |
171 y += yOffset; | 171 y += yOffset; |
172 x = 0; | 172 x = 0; |
173 for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j
) { | 173 for (unsigned j = 1; j < SK_ARRAY_COUNT(gColorFilterMakers); ++j
) { |
174 SkAutoTUnref<SkColorFilter> colorFilter2(gColorFilterMakers[
j]()); | 174 SkAutoTUnref<SkColorFilter> colorFilter2(gColorFilterMakers[
j]()); |
175 SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageF
ilter::Create( | 175 SkAutoTUnref<SkImageFilter> imageFilter2(SkColorFilterImageF
ilter::Create( |
176 colorFilter2, imageFilter1, NULL, 0)); | 176 colorFilter2, imageFilter1, NULL)); |
177 paint.setImageFilter(imageFilter2); | 177 paint.setImageFilter(imageFilter2); |
178 canvas->drawBitmap(bm, x, y, &paint); | 178 canvas->drawBitmap(bm, x, y, &paint); |
179 x += xOffset; | 179 x += xOffset; |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
183 // Move down one line to the beginning of the block for next bitmap | 183 // Move down one line to the beginning of the block for next bitmap |
184 y += yOffset; | 184 y += yOffset; |
185 } | 185 } |
186 } | 186 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "wacky"); ) | 286 DEF_GM( return new ComposeColorFilterGM(gColors0, gModes0, "wacky"); ) |
287 | 287 |
288 const SkColor gColors1[] = { 0x80FF0000, 0x8000FF00, 0x800000FF }; | 288 const SkColor gColors1[] = { 0x80FF0000, 0x8000FF00, 0x800000FF }; |
289 const SkXfermode::Mode gModes1[] = { | 289 const SkXfermode::Mode gModes1[] = { |
290 SkXfermode::kSrcOver_Mode, | 290 SkXfermode::kSrcOver_Mode, |
291 SkXfermode::kXor_Mode, | 291 SkXfermode::kXor_Mode, |
292 SkXfermode::kDstOut_Mode, | 292 SkXfermode::kDstOut_Mode, |
293 SkXfermode::kSrcATop_Mode, | 293 SkXfermode::kSrcATop_Mode, |
294 }; | 294 }; |
295 DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "alpha"); ) | 295 DEF_GM( return new ComposeColorFilterGM(gColors1, gModes1, "alpha"); ) |
OLD | NEW |