OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkColorMatrixFilter.h" | 10 #include "SkColorMatrixFilter.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 drawClippedRect(canvas, r, paint, 3); | 110 drawClippedRect(canvas, r, paint, 3); |
111 canvas->translate(FILTER_WIDTH + MARGIN, 0); | 111 canvas->translate(FILTER_WIDTH + MARGIN, 0); |
112 } | 112 } |
113 { | 113 { |
114 SkAutoTUnref<SkImageFilter> blue(make_mode_blue()); | 114 SkAutoTUnref<SkImageFilter> blue(make_mode_blue()); |
115 paint.setImageFilter(blue.get()); | 115 paint.setImageFilter(blue.get()); |
116 drawClippedRect(canvas, r, paint, 5); | 116 drawClippedRect(canvas, r, paint, 5); |
117 canvas->translate(FILTER_WIDTH + MARGIN, 0); | 117 canvas->translate(FILTER_WIDTH + MARGIN, 0); |
118 } | 118 } |
119 } | 119 } |
| 120 |
| 121 DEF_SIMPLE_GM(colorfilterimagefilter_layer, canvas, 32, 32) { |
| 122 SkAutoCanvasRestore autoCanvasRestore(canvas, false); |
| 123 SkColorMatrix cm; |
| 124 cm.setSaturation(0.0f); |
| 125 SkAutoTUnref<SkColorFilter> cf(SkColorMatrixFilter::Create(cm)); |
| 126 SkAutoTUnref<SkImageFilter> imf(SkColorFilterImageFilter::Create(cf)); |
| 127 SkPaint p; |
| 128 p.setImageFilter(imf); |
| 129 canvas->saveLayer(NULL, &p); |
| 130 canvas->clear(SK_ColorRED); |
| 131 } |
OLD | NEW |