| 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 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 fOnce = true; | 23 fOnce = true; |
| 24 return true; | 24 return true; |
| 25 } | 25 } |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 mutable bool fOnce; | 28 mutable bool fOnce; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 static void setColorMatrix(SkPaint* paint, const SkColorMatrix& matrix) { | 31 static void setColorMatrix(SkPaint* paint, const SkColorMatrix& matrix) { |
| 32 paint->setColorFilter(SkNEW_ARGS(SkColorMatrixFilter, (matrix)))->unref(); | 32 paint->setColorFilter(SkColorMatrixFilter::Create(matrix))->unref(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 static void setArray(SkPaint* paint, const SkScalar array[]) { | 35 static void setArray(SkPaint* paint, const SkScalar array[]) { |
| 36 paint->setColorFilter(SkNEW_ARGS(SkColorMatrixFilter, (array)))->unref(); | 36 paint->setColorFilter(SkColorMatrixFilter::Create(array))->unref(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace skiagm { | 39 namespace skiagm { |
| 40 | 40 |
| 41 class ColorMatrixGM : public GM { | 41 class ColorMatrixGM : public GM { |
| 42 SkDoOnce fOnce; | 42 SkDoOnce fOnce; |
| 43 void init() { | 43 void init() { |
| 44 if (fOnce.once()) { | 44 if (fOnce.once()) { |
| 45 fSolidBitmap = this->createSolidBitmap(64, 64); | 45 fSolidBitmap = this->createSolidBitmap(64, 64); |
| 46 fTransparentBitmap = this->createTransparentBitmap(64, 64); | 46 fTransparentBitmap = this->createTransparentBitmap(64, 64); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 SkBitmap fTransparentBitmap; | 166 SkBitmap fTransparentBitmap; |
| 167 typedef GM INHERITED; | 167 typedef GM INHERITED; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 ////////////////////////////////////////////////////////////////////////////// | 170 ////////////////////////////////////////////////////////////////////////////// |
| 171 | 171 |
| 172 static GM* MyFactory(void*) { return new ColorMatrixGM; } | 172 static GM* MyFactory(void*) { return new ColorMatrixGM; } |
| 173 static GMRegistry reg(MyFactory); | 173 static GMRegistry reg(MyFactory); |
| 174 | 174 |
| 175 } | 175 } |
| OLD | NEW |