Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Side by Side Diff: gm/colormatrix.cpp

Issue 175293002: Factory methods for heap-allocated SkColorFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gm/colorfilterimagefilter.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « gm/colorfilterimagefilter.cpp ('k') | gm/imagefiltersgraph.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698