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

Side by Side Diff: gm/shadertext2.cpp

Issue 283273002: remove unused (by clients) SkUnitMapper (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix legacy call 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/shadertext.cpp ('k') | gm/shadertext3.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 #include "gm.h" 7 #include "gm.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 #include "SkUnitMappers.h"
11 10
12 namespace skiagm { 11 namespace skiagm {
13 12
14 static void makebm(SkBitmap* bm, int w, int h) { 13 static void makebm(SkBitmap* bm, int w, int h) {
15 bm->allocN32Pixels(w, h); 14 bm->allocN32Pixels(w, h);
16 bm->eraseColor(SK_ColorTRANSPARENT); 15 bm->eraseColor(SK_ColorTRANSPARENT);
17 16
18 SkCanvas canvas(*bm); 17 SkCanvas canvas(*bm);
19 SkScalar s = SkIntToScalar(SkMin32(w, h)); 18 SkScalar s = SkIntToScalar(SkMin32(w, h));
20 static const SkPoint kPts0[] = { { 0, 0 }, { s, s } }; 19 static const SkPoint kPts0[] = { { 0, 0 }, { s, s } };
21 static const SkPoint kPts1[] = { { s, 0 }, { 0, s } }; 20 static const SkPoint kPts1[] = { { s, 0 }, { 0, s } };
22 static const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; 21 static const SkScalar kPos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
23 static const SkColor kColors0[] = {0x40FF00FF, 0xF0FFFF00, 0x4000FFFF }; 22 static const SkColor kColors0[] = {0x40FF00FF, 0xF0FFFF00, 0x4000FFFF };
24 static const SkColor kColors1[] = {0xF0FF00FF, 0x80FFFF00, 0xF000FFFF }; 23 static const SkColor kColors1[] = {0xF0FF00FF, 0x80FFFF00, 0xF000FFFF };
25 24
26 25
27 SkPaint paint; 26 SkPaint paint;
28 27
29 SkUnitMapper* um = NULL;
30
31 um = new SkCosineMapper;
32
33 SkAutoUnref au(um);
34
35 paint.setShader(SkGradientShader::CreateLinear(kPts0, kColors0, kPos, 28 paint.setShader(SkGradientShader::CreateLinear(kPts0, kColors0, kPos,
36 SK_ARRAY_COUNT(kColors0), SkShader::kClamp_TileMode, um))->u nref(); 29 SK_ARRAY_COUNT(kColors0), SkShader::kClamp_TileMode))->unref ();
37 canvas.drawPaint(paint); 30 canvas.drawPaint(paint);
38 paint.setShader(SkGradientShader::CreateLinear(kPts1, kColors1, kPos, 31 paint.setShader(SkGradientShader::CreateLinear(kPts1, kColors1, kPos,
39 SK_ARRAY_COUNT(kColors1), SkShader::kClamp_TileMode))->unref (); 32 SK_ARRAY_COUNT(kColors1), SkShader::kClamp_TileMode))->unref ();
40 canvas.drawPaint(paint); 33 canvas.drawPaint(paint);
41 } 34 }
42 35
43 /////////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////////
44 37
45 struct LabeledMatrix { 38 struct LabeledMatrix {
46 SkMatrix fMatrix; 39 SkMatrix fMatrix;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 203
211 private: 204 private:
212 typedef GM INHERITED; 205 typedef GM INHERITED;
213 }; 206 };
214 207
215 /////////////////////////////////////////////////////////////////////////////// 208 ///////////////////////////////////////////////////////////////////////////////
216 209
217 static GM* MyFactory(void*) { return new ShaderText2GM; } 210 static GM* MyFactory(void*) { return new ShaderText2GM; }
218 static GMRegistry reg(MyFactory); 211 static GMRegistry reg(MyFactory);
219 } 212 }
OLDNEW
« no previous file with comments | « gm/shadertext.cpp ('k') | gm/shadertext3.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698