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

Side by Side Diff: gm/textbloblooper.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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/tablecolorfilter.cpp ('k') | gm/textblobshader.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 2013 Google Inc. 2 * Copyright 2013 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 9
10 #include "Sk2DPathEffect.h" 10 #include "Sk2DPathEffect.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 SkPath path; 73 SkPath path;
74 path.addCircle(0, 0, SkIntToScalar(5)); 74 path.addCircle(0, 0, SkIntToScalar(5));
75 75
76 return SkPath2DPathEffect::Create(m, path); 76 return SkPath2DPathEffect::Create(m, path);
77 } 77 }
78 78
79 static void path_effect(SkPaint* paint) { 79 static void path_effect(SkPaint* paint) {
80 paint->setPathEffect(make_tile_effect())->unref(); 80 paint->setPathEffect(make_tile_effect())->unref();
81 } 81 }
82 82
83 static SkShader* make_shader(const SkRect& bounds) { 83 static sk_sp<SkShader> make_shader(const SkRect& bounds) {
84 const SkPoint pts[] = { 84 const SkPoint pts[] = {
85 { bounds.left(), bounds.top() }, 85 { bounds.left(), bounds.top() },
86 { bounds.right(), bounds.bottom() }, 86 { bounds.right(), bounds.bottom() },
87 }; 87 };
88 const SkColor colors[] = { 88 const SkColor colors[] = {
89 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK, 89 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorBLACK,
90 SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW, 90 SK_ColorCYAN, SK_ColorMAGENTA, SK_ColorYELLOW,
91 }; 91 };
92 return SkGradientShader::CreateLinear(pts, 92 return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(col ors),
93 colors, nullptr, SK_ARRAY_COUNT(colors ), 93 SkShader::kClamp_TileMode);
94 SkShader::kClamp_TileMode);
95 } 94 }
96 95
97 static void color_filter(SkPaint* paint) { 96 static void color_filter(SkPaint* paint) {
98 SkRect r; 97 SkRect r;
99 r.setWH(SkIntToScalar(kWidth), 50); 98 r.setWH(SkIntToScalar(kWidth), 50);
100 paint->setShader(make_shader(r))->unref(); 99 paint->setShader(make_shader(r));
101 paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(0xF0F0F0, 0) )->unref(); 100 paint->setColorFilter(SkColorMatrixFilter::CreateLightingFilter(0xF0F0F0, 0) )->unref();
102 } 101 }
103 102
104 static void kitchen_sink(SkPaint* paint) { 103 static void kitchen_sink(SkPaint* paint) {
105 color_filter(paint); 104 color_filter(paint);
106 path_effect(paint); 105 path_effect(paint);
107 mask_filter(paint); 106 mask_filter(paint);
108 107
109 } 108 }
110 109
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 SkAutoTUnref<const SkTextBlob> fBlob; 249 SkAutoTUnref<const SkTextBlob> fBlob;
251 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers; 250 SkTArray<SkAutoTUnref<SkLayerDrawLooper>, true> fLoopers;
252 251
253 typedef GM INHERITED; 252 typedef GM INHERITED;
254 }; 253 };
255 254
256 ////////////////////////////////////////////////////////////////////////////// 255 //////////////////////////////////////////////////////////////////////////////
257 256
258 DEF_GM(return new TextBlobLooperGM;) 257 DEF_GM(return new TextBlobLooperGM;)
259 } 258 }
OLDNEW
« no previous file with comments | « gm/tablecolorfilter.cpp ('k') | gm/textblobshader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698