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 "SkColorMatrixFilter.h" | 9 #include "SkColorMatrixFilter.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 virtual void onDraw(SkCanvas* canvas) { | 96 virtual void onDraw(SkCanvas* canvas) { |
97 this->init(); | 97 this->init(); |
98 | 98 |
99 SkPaint paint; | 99 SkPaint paint; |
100 SkColorMatrix matrix; | 100 SkColorMatrix matrix; |
101 | 101 |
102 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 102 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
103 const SkBitmap bmps[] = { fSolidBitmap, fTransparentBitmap }; | 103 const SkBitmap bmps[] = { fSolidBitmap, fTransparentBitmap }; |
104 | 104 |
105 for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) { | 105 for (size_t i = 0; i < SK_ARRAY_COUNT(bmps); ++i) { |
106 | |
107 matrix.setIdentity(); | 106 matrix.setIdentity(); |
108 setColorMatrix(&paint, matrix); | 107 setColorMatrix(&paint, matrix); |
109 canvas->drawBitmap(bmps[i], 0, 0, &paint); | 108 canvas->drawBitmap(bmps[i], 0, 0, &paint); |
110 | 109 |
111 matrix.setRotate(SkColorMatrix::kR_Axis, 90); | 110 matrix.setRotate(SkColorMatrix::kR_Axis, 90); |
112 setColorMatrix(&paint, matrix); | 111 setColorMatrix(&paint, matrix); |
113 canvas->drawBitmap(bmps[i], 80, 0, &paint); | 112 canvas->drawBitmap(bmps[i], 80, 0, &paint); |
114 | 113 |
115 matrix.setRotate(SkColorMatrix::kG_Axis, 90); | 114 matrix.setRotate(SkColorMatrix::kG_Axis, 90); |
116 setColorMatrix(&paint, matrix); | 115 setColorMatrix(&paint, matrix); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 SkBitmap fTransparentBitmap; | 165 SkBitmap fTransparentBitmap; |
167 typedef GM INHERITED; | 166 typedef GM INHERITED; |
168 }; | 167 }; |
169 | 168 |
170 ////////////////////////////////////////////////////////////////////////////// | 169 ////////////////////////////////////////////////////////////////////////////// |
171 | 170 |
172 static GM* MyFactory(void*) { return new ColorMatrixGM; } | 171 static GM* MyFactory(void*) { return new ColorMatrixGM; } |
173 static GMRegistry reg(MyFactory); | 172 static GMRegistry reg(MyFactory); |
174 | 173 |
175 } | 174 } |
OLD | NEW |