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

Side by Side Diff: gm/tilemodes_scaled.cpp

Issue 288313009: 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
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 #include "SkBlurMask.h" 16 #include "SkBlurMask.h"
17 17
18 // effects 18 // effects
19 #include "SkGradientShader.h" 19 #include "SkGradientShader.h"
20 #include "SkUnitMappers.h"
21 #include "SkBlurDrawLooper.h" 20 #include "SkBlurDrawLooper.h"
22 21
23 static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) { 22 static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
24 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType)); 23 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType));
25 bm->eraseColor(SK_ColorTRANSPARENT); 24 bm->eraseColor(SK_ColorTRANSPARENT);
26 25
27 SkCanvas canvas(*bm); 26 SkCanvas canvas(*bm);
28 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} }; 27 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h)} };
29 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; 28 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
30 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; 29 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
31 SkPaint paint; 30 SkPaint paint;
32 31
33 SkUnitMapper* um = NULL;
34
35 um = new SkCosineMapper;
36 // um = new SkDiscreteMapper(12);
37
38 SkAutoUnref au(um);
39
40 paint.setDither(true); 32 paint.setDither(true);
41 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, 33 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos,
42 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref() ; 34 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref();
43 canvas.drawPaint(paint); 35 canvas.drawPaint(paint);
44 } 36 }
45 37
46 static void setup(SkPaint* paint, const SkBitmap& bm, SkPaint::FilterLevel filte r_level, 38 static void setup(SkPaint* paint, const SkBitmap& bm, SkPaint::FilterLevel filte r_level,
47 SkShader::TileMode tmx, SkShader::TileMode tmy) { 39 SkShader::TileMode tmx, SkShader::TileMode tmy) {
48 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); 40 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy);
49 paint->setShader(shader)->unref(); 41 paint->setShader(shader)->unref();
50 paint->setFilterLevel(filter_level); 42 paint->setFilterLevel(filter_level);
51 } 43 }
52 44
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 private: 277 private:
286 typedef skiagm::GM INHERITED; 278 typedef skiagm::GM INHERITED;
287 }; 279 };
288 280
289 ////////////////////////////////////////////////////////////////////////////// 281 //////////////////////////////////////////////////////////////////////////////
290 282
291 DEF_GM( return new ScaledTilingGM(true); ) 283 DEF_GM( return new ScaledTilingGM(true); )
292 DEF_GM( return new ScaledTilingGM(false); ) 284 DEF_GM( return new ScaledTilingGM(false); )
293 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) 285 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); )
294 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) 286 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); )
OLDNEW
« no previous file with comments | « gm/tilemodes.cpp ('k') | gyp/SampleApp.gyp » ('j') | gyp/skia_for_chromium_defines.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698