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

Side by Side Diff: gm/tilemodes.cpp

Issue 288343009: Remove unused (by clients) SkUnitMapper (https://codereview.chromium.org/283273002/) (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: SK_SUPPORT_LEGACY_DEADUNITMAPPERTYPE is unneeded 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/shadertext3.cpp ('k') | gm/tilemodes_scaled.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkPath.h" 9 #include "SkPath.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
11 #include "SkShader.h" 11 #include "SkShader.h"
12 #include "SkUtils.h" 12 #include "SkUtils.h"
13 #include "SkColorPriv.h" 13 #include "SkColorPriv.h"
14 #include "SkColorFilter.h" 14 #include "SkColorFilter.h"
15 #include "SkTypeface.h" 15 #include "SkTypeface.h"
16 16
17 // effects 17 // effects
18 #include "SkGradientShader.h" 18 #include "SkGradientShader.h"
19 #include "SkUnitMappers.h"
20 #include "SkBlurDrawLooper.h" 19 #include "SkBlurDrawLooper.h"
21 20
22 static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) { 21 static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
23 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType)); 22 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType));
24 bm->eraseColor(SK_ColorTRANSPARENT); 23 bm->eraseColor(SK_ColorTRANSPARENT);
25 24
26 SkCanvas canvas(*bm); 25 SkCanvas canvas(*bm);
27 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} }; 26 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} };
28 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; 27 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
29 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; 28 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
30 SkPaint paint; 29 SkPaint paint;
31 30
32 SkUnitMapper* um = NULL;
33
34 um = new SkCosineMapper;
35 // um = new SkDiscreteMapper(12);
36
37 SkAutoUnref au(um);
38
39 paint.setDither(true); 31 paint.setDither(true);
40 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, 32 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos,
41 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref() ; 33 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref();
42 canvas.drawPaint(paint); 34 canvas.drawPaint(paint);
43 } 35 }
44 36
45 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, 37 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
46 SkShader::TileMode tmx, SkShader::TileMode tmy) { 38 SkShader::TileMode tmx, SkShader::TileMode tmy) {
47 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); 39 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy);
48 paint->setShader(shader)->unref(); 40 paint->setShader(shader)->unref();
49 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi lterLevel); 41 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi lterLevel);
50 } 42 }
51 43
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 private: 257 private:
266 typedef skiagm::GM INHERITED; 258 typedef skiagm::GM INHERITED;
267 }; 259 };
268 260
269 ////////////////////////////////////////////////////////////////////////////// 261 //////////////////////////////////////////////////////////////////////////////
270 262
271 DEF_GM( return new TilingGM(true); ) 263 DEF_GM( return new TilingGM(true); )
272 DEF_GM( return new TilingGM(false); ) 264 DEF_GM( return new TilingGM(false); )
273 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) 265 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); )
274 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) 266 DEF_GM( return new Tiling2GM(make_grad, "gradient"); )
OLDNEW
« no previous file with comments | « gm/shadertext3.cpp ('k') | gm/tilemodes_scaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698