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

Side by Side Diff: gm/colorfilterimagefilter.cpp

Issue 1810813003: update callsites for Make image factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: start to take advantage of sk_sp drawImage Created 4 years, 9 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
« no previous file with comments | « gm/bleed.cpp ('k') | gm/colormatrix.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 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorMatrixFilter.h" 10 #include "SkColorMatrixFilter.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 return SkGradientShader::MakeLinear(pts, colors, nullptr, 3, SkShader::kRepe at_TileMode); 59 return SkGradientShader::MakeLinear(pts, colors, nullptr, 3, SkShader::kRepe at_TileMode);
60 } 60 }
61 61
62 static sk_sp<SkShader> sh_make_lineargradient1() { 62 static sk_sp<SkShader> sh_make_lineargradient1() {
63 const SkPoint pts[] = { { 0, 0 }, { 100, 100 } }; 63 const SkPoint pts[] = { { 0, 0 }, { 100, 100 } };
64 const SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE }; 64 const SkColor colors[] = { SK_ColorRED, 0x0000FF00, SK_ColorBLUE };
65 return SkGradientShader::MakeLinear(pts, colors, nullptr, 3, SkShader::kRepe at_TileMode); 65 return SkGradientShader::MakeLinear(pts, colors, nullptr, 3, SkShader::kRepe at_TileMode);
66 } 66 }
67 67
68 static sk_sp<SkShader> sh_make_image() { 68 static sk_sp<SkShader> sh_make_image() {
69 SkAutoTUnref<SkImage> image(GetResourceAsImage("mandrill_128.png")); 69 sk_sp<SkImage> image(GetResourceAsImage("mandrill_128.png"));
70 if (!image) { 70 if (!image) {
71 return nullptr; 71 return nullptr;
72 } 72 }
73 return image->makeShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileM ode); 73 return image->makeShader(SkShader::kRepeat_TileMode, SkShader::kRepeat_TileM ode);
74 } 74 }
75 75
76 static void sk_gm_get_shaders(SkTDArray<SkShader*>* array) { 76 static void sk_gm_get_shaders(SkTDArray<SkShader*>* array) {
77 if (auto shader = sh_make_lineargradient0()) { 77 if (auto shader = sh_make_lineargradient0()) {
78 *array->append() = shader.release(); 78 *array->append() = shader.release();
79 } 79 }
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 SkColorFilter* filter = x >= 0 ? filters[x] : nullptr; 213 SkColorFilter* filter = x >= 0 ? filters[x] : nullptr;
214 214
215 paint.setShader(shader->makeWithColorFilter(filter)); 215 paint.setShader(shader->makeWithColorFilter(filter));
216 canvas->drawRect(r, paint); 216 canvas->drawRect(r, paint);
217 canvas->translate(150, 0); 217 canvas->translate(150, 0);
218 } 218 }
219 canvas->restore(); 219 canvas->restore();
220 canvas->translate(0, 150); 220 canvas->translate(0, 150);
221 } 221 }
222 } 222 }
OLDNEW
« no previous file with comments | « gm/bleed.cpp ('k') | gm/colormatrix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698