| 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 |
| 106 matrix.setIdentity(); | 107 matrix.setIdentity(); |
| 107 setColorMatrix(&paint, matrix); | 108 setColorMatrix(&paint, matrix); |
| 108 canvas->drawBitmap(bmps[i], 0, 0, &paint); | 109 canvas->drawBitmap(bmps[i], 0, 0, &paint); |
| 109 | 110 |
| 110 matrix.setRotate(SkColorMatrix::kR_Axis, 90); | 111 matrix.setRotate(SkColorMatrix::kR_Axis, 90); |
| 111 setColorMatrix(&paint, matrix); | 112 setColorMatrix(&paint, matrix); |
| 112 canvas->drawBitmap(bmps[i], 80, 0, &paint); | 113 canvas->drawBitmap(bmps[i], 80, 0, &paint); |
| 113 | 114 |
| 114 matrix.setRotate(SkColorMatrix::kG_Axis, 90); | 115 matrix.setRotate(SkColorMatrix::kG_Axis, 90); |
| 115 setColorMatrix(&paint, matrix); | 116 setColorMatrix(&paint, matrix); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 SkBitmap fTransparentBitmap; | 166 SkBitmap fTransparentBitmap; |
| 166 typedef GM INHERITED; | 167 typedef GM INHERITED; |
| 167 }; | 168 }; |
| 168 | 169 |
| 169 ////////////////////////////////////////////////////////////////////////////// | 170 ////////////////////////////////////////////////////////////////////////////// |
| 170 | 171 |
| 171 static GM* MyFactory(void*) { return new ColorMatrixGM; } | 172 static GM* MyFactory(void*) { return new ColorMatrixGM; } |
| 172 static GMRegistry reg(MyFactory); | 173 static GMRegistry reg(MyFactory); |
| 173 | 174 |
| 174 } | 175 } |
| OLD | NEW |