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

Side by Side Diff: samplecode/SampleTiling.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 | « samplecode/SampleSlides.cpp ('k') | samplecode/SampleUnitMapper.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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "SkPaint.h" 11 #include "SkPaint.h"
12 #include "SkPath.h" 12 #include "SkPath.h"
13 #include "SkPictureRecorder.h" 13 #include "SkPictureRecorder.h"
14 #include "SkRegion.h" 14 #include "SkRegion.h"
15 #include "SkShader.h" 15 #include "SkShader.h"
16 #include "SkUtils.h" 16 #include "SkUtils.h"
17 #include "SkColorPriv.h" 17 #include "SkColorPriv.h"
18 #include "SkColorFilter.h" 18 #include "SkColorFilter.h"
19 #include "SkPicture.h" 19 #include "SkPicture.h"
20 #include "SkTypeface.h" 20 #include "SkTypeface.h"
21 21
22 // effects 22 // effects
23 #include "SkGradientShader.h" 23 #include "SkGradientShader.h"
24 #include "SkUnitMappers.h"
25 #include "SkBlurMask.h" 24 #include "SkBlurMask.h"
26 #include "SkBlurDrawLooper.h" 25 #include "SkBlurDrawLooper.h"
27 26
28 static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) { 27 static void makebm(SkBitmap* bm, SkColorType ct, int w, int h) {
29 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType)); 28 bm->allocPixels(SkImageInfo::Make(w, h, ct, kPremul_SkAlphaType));
30 bm->eraseColor(SK_ColorTRANSPARENT); 29 bm->eraseColor(SK_ColorTRANSPARENT);
31 30
32 SkCanvas canvas(*bm); 31 SkCanvas canvas(*bm);
33 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h) } }; 32 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(w), SkIntToScalar(h) } };
34 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; 33 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE };
35 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; 34 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 };
36 SkPaint paint; 35 SkPaint paint;
37 36
38 SkUnitMapper* um = NULL;
39
40 um = new SkCosineMapper;
41 // um = new SkDiscreteMapper(12);
42
43 SkAutoUnref au(um);
44
45 paint.setDither(true); 37 paint.setDither(true);
46 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos, 38 paint.setShader(SkGradientShader::CreateLinear(pts, colors, pos,
47 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode, um))->unref() ; 39 SK_ARRAY_COUNT(colors), SkShader::kClamp_TileMode))->unref();
48 canvas.drawPaint(paint); 40 canvas.drawPaint(paint);
49 } 41 }
50 42
51 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter, 43 static void setup(SkPaint* paint, const SkBitmap& bm, bool filter,
52 SkShader::TileMode tmx, SkShader::TileMode tmy) { 44 SkShader::TileMode tmx, SkShader::TileMode tmy) {
53 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy); 45 SkShader* shader = SkShader::CreateBitmapShader(bm, tmx, tmy);
54 paint->setShader(shader)->unref(); 46 paint->setShader(shader)->unref();
55 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi lterLevel); 47 paint->setFilterLevel(filter ? SkPaint::kLow_FilterLevel : SkPaint::kNone_Fi lterLevel);
56 } 48 }
57 49
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 } 162 }
171 163
172 private: 164 private:
173 typedef SampleView INHERITED; 165 typedef SampleView INHERITED;
174 }; 166 };
175 167
176 ////////////////////////////////////////////////////////////////////////////// 168 //////////////////////////////////////////////////////////////////////////////
177 169
178 static SkView* MyFactory() { return new TilingView; } 170 static SkView* MyFactory() { return new TilingView; }
179 static SkViewRegister reg(MyFactory); 171 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleSlides.cpp ('k') | samplecode/SampleUnitMapper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698