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

Side by Side Diff: gm/colormatrix.cpp

Issue 1821103004: Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/colorfilters.cpp ('k') | gm/dropshadowimagefilter.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"
11 #include "SkImage.h" 11 #include "SkImage.h"
12 12
13 #define WIDTH 500 13 #define WIDTH 500
14 #define HEIGHT 500 14 #define HEIGHT 500
15 15
16 static void set_color_matrix(SkPaint* paint, const SkColorMatrix& matrix) { 16 static void set_color_matrix(SkPaint* paint, const SkColorMatrix& matrix) {
17 paint->setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix.fMat )); 17 paint->setColorFilter(SkColorMatrixFilter::Create(matrix))->unref();
18 } 18 }
19 19
20 static void set_array(SkPaint* paint, const SkScalar array[]) { 20 static void set_array(SkPaint* paint, const SkScalar array[]) {
21 paint->setColorFilter(SkColorFilter::MakeMatrixFilterRowMajor255(array)); 21 paint->setColorFilter(SkColorMatrixFilter::Create(array))->unref();
22 } 22 }
23 23
24 class ColorMatrixGM : public skiagm::GM { 24 class ColorMatrixGM : public skiagm::GM {
25 public: 25 public:
26 ColorMatrixGM() { 26 ColorMatrixGM() {
27 this->setBGColor(sk_tool_utils::color_to_565(0xFF808080)); 27 this->setBGColor(sk_tool_utils::color_to_565(0xFF808080));
28 } 28 }
29 29
30 protected: 30 protected:
31 SkString onShortName() override { 31 SkString onShortName() override {
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 } 139 }
140 140
141 private: 141 private:
142 sk_sp<SkImage> fSolidImg; 142 sk_sp<SkImage> fSolidImg;
143 sk_sp<SkImage> fTransparentImg; 143 sk_sp<SkImage> fTransparentImg;
144 144
145 typedef skiagm::GM INHERITED; 145 typedef skiagm::GM INHERITED;
146 }; 146 };
147 DEF_GM( return new ColorMatrixGM; ) 147 DEF_GM( return new ColorMatrixGM; )
148 148
OLDNEW
« no previous file with comments | « gm/colorfilters.cpp ('k') | gm/dropshadowimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698