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

Side by Side Diff: gm/shaderbounds.cpp

Issue 287063009: Revert of remove unused (by clients) SkUnitMapper (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « gm/gradients_no_texture.cpp ('k') | gm/shadertext.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 2012 Google Inc. 2 * Copyright 2012 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkGradientShader.h" 8 #include "SkGradientShader.h"
9 9
10 namespace skiagm { 10 namespace skiagm {
11 11
12 static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate, 12 static SkShader* MakeLinear(SkScalar width, SkScalar height, bool alternate,
13 const SkMatrix& localMatrix) { 13 const SkMatrix& localMatrix) {
14 SkPoint pts[2] = { {0, 0}, {width, height}}; 14 SkPoint pts[2] = { {0, 0}, {width, height}};
15 SkColor colors[2] = {SK_ColorRED, SK_ColorGREEN}; 15 SkColor colors[2] = {SK_ColorRED, SK_ColorGREEN};
16 if (alternate) { 16 if (alternate) {
17 pts[1].fY = 0; 17 pts[1].fY = 0;
18 colors[0] = SK_ColorBLUE; 18 colors[0] = SK_ColorBLUE;
19 colors[1] = SK_ColorYELLOW; 19 colors[1] = SK_ColorYELLOW;
20 } 20 }
21 return SkGradientShader::CreateLinear(pts, colors, NULL, 2, 21 return SkGradientShader::CreateLinear(pts, colors, NULL, 2,
22 SkShader::kClamp_TileMode, 0, &localMatr ix); 22 SkShader::kClamp_TileMode, NULL, 0, &loc alMatrix);
23 } 23 }
24 24
25 /////////////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////////
26 26
27 class ShaderBoundsGM : public GM { 27 class ShaderBoundsGM : public GM {
28 public: 28 public:
29 typedef SkShader* (*ShaderGenFunc)(SkScalar width, SkScalar height, 29 typedef SkShader* (*ShaderGenFunc)(SkScalar width, SkScalar height,
30 bool alternate, const SkMatrix& localMatr ix); 30 bool alternate, const SkMatrix& localMatr ix);
31 ShaderBoundsGM(ShaderGenFunc maker, const SkString& name) 31 ShaderBoundsGM(ShaderGenFunc maker, const SkString& name)
32 : fShaderMaker(maker), 32 : fShaderMaker(maker),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 }; 101 };
102 102
103 /////////////////////////////////////////////////////////////////////////////// 103 ///////////////////////////////////////////////////////////////////////////////
104 104
105 static GM* MyFactory(void*) { 105 static GM* MyFactory(void*) {
106 return new ShaderBoundsGM(MakeLinear, SkString("shaderbounds_linear")); 106 return new ShaderBoundsGM(MakeLinear, SkString("shaderbounds_linear"));
107 } 107 }
108 static GMRegistry reg(MyFactory); 108 static GMRegistry reg(MyFactory);
109 109
110 } 110 }
OLDNEW
« no previous file with comments | « gm/gradients_no_texture.cpp ('k') | gm/shadertext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698