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

Side by Side Diff: gm/colorfilters.cpp

Issue 1574023002: move declaration of CreateLightingFilter into SkColorMatrixFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: don't remove old impl yet Created 4 years, 11 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 | « no previous file | gm/textbloblooper.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 2014 Google Inc. 2 * Copyright 2014 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorMatrixFilter.h"
11 #include "SkGradientShader.h" 11 #include "SkGradientShader.h"
12 12
13 static SkShader* make_shader(const SkRect& bounds) { 13 static SkShader* make_shader(const SkRect& bounds) {
14 const SkPoint pts[] = { 14 const SkPoint pts[] = {
15 { bounds.left(), bounds.top() }, 15 { bounds.left(), bounds.top() },
16 { bounds.right(), bounds.bottom() }, 16 { bounds.right(), bounds.bottom() },
17 }; 17 };
18 const SkColor colors[] = { 18 const SkColor colors[] = {
19 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK, 19 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK,
20 SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, 20 SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
21 }; 21 };
22 return SkGradientShader::CreateLinear(pts, 22 return SkGradientShader::CreateLinear(pts,
23 colors, nullptr, SK_ARRAY_COUNT(colors ), 23 colors, nullptr, SK_ARRAY_COUNT(colors ),
24 SkShader::kClamp_TileMode); 24 SkShader::kClamp_TileMode);
25 } 25 }
26 26
27 typedef void (*InstallPaint)(SkPaint*, uint32_t, uint32_t); 27 typedef void (*InstallPaint)(SkPaint*, uint32_t, uint32_t);
28 28
29 static void install_nothing(SkPaint* paint, uint32_t, uint32_t) { 29 static void install_nothing(SkPaint* paint, uint32_t, uint32_t) {
30 paint->setColorFilter(nullptr); 30 paint->setColorFilter(nullptr);
31 } 31 }
32 32
33 static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) { 33 static void install_lighting(SkPaint* paint, uint32_t mul, uint32_t add) {
34 paint->setColorFilter(SkColorFilter::CreateLightingFilter(mul, add))->unref( ); 34 paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(mul, add))-> unref();
35 } 35 }
36 36
37 class ColorFiltersGM : public skiagm::GM { 37 class ColorFiltersGM : public skiagm::GM {
38 public: 38 public:
39 ColorFiltersGM() { 39 ColorFiltersGM() {
40 fName.set("lightingcolorfilter"); 40 fName.set("lightingcolorfilter");
41 } 41 }
42 42
43 protected: 43 protected:
44 virtual SkString onShortName() override { 44 virtual SkString onShortName() override {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 78
79 private: 79 private:
80 SkString fName; 80 SkString fName;
81 typedef GM INHERITED; 81 typedef GM INHERITED;
82 }; 82 };
83 83
84 84
85 ////////////////////////////////////////////////////////////////////////////// 85 //////////////////////////////////////////////////////////////////////////////
86 86
87 DEF_GM(return new ColorFiltersGM;) 87 DEF_GM(return new ColorFiltersGM;)
OLDNEW
« no previous file with comments | « no previous file | gm/textbloblooper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698