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

Side by Side Diff: gm/pictureshader.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 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/perlinnoise.cpp ('k') | gm/samplerstress.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 2014 Google Inc. 2 * Copyright 2014 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 "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 SkRect r = tile; 187 SkRect r = tile;
188 r.inset(4, 4); 188 r.inset(4, 4);
189 SkPaint p; 189 SkPaint p;
190 p.setColor(sk_tool_utils::color_to_565(0xFF303F9F)); // dark blue 190 p.setColor(sk_tool_utils::color_to_565(0xFF303F9F)); // dark blue
191 c->drawRect(r, p); 191 c->drawRect(r, p);
192 p.setColor(sk_tool_utils::color_to_565(0xFFC5CAE9)); // light blue 192 p.setColor(sk_tool_utils::color_to_565(0xFFC5CAE9)); // light blue
193 p.setStrokeWidth(10); 193 p.setStrokeWidth(10);
194 c->drawLine(20, 20, 80, 80, p); 194 c->drawLine(20, 20, 80, 80, p);
195 195
196 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); 196 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
197 sk_sp<SkShader> shader(SkShader::MakePictureShader(picture, SkShader::kRepea t_TileMode,
198 SkShader::kRepeat_TileMod e,
199 nullptr, nullptr));
200 197
201 p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green 198 p.setColor(sk_tool_utils::color_to_565(0xFF8BC34A)); // green
202 canvas->drawPaint(p); 199 canvas->drawPaint(p);
203 200
204 canvas->clipRect(SkRect::MakeXYWH(0, 0, 400, 350)); 201 canvas->clipRect(SkRect::MakeXYWH(0, 0, 400, 350));
205 p.setColor(sk_tool_utils::color_to_565(0xFFB6B6B6)); // gray 202 p.setColor(sk_tool_utils::color_to_565(0xFFB6B6B6)); // gray
206 canvas->drawPaint(p); 203 canvas->drawPaint(p);
207 p.setShader(shader.get());
208 204
205 p.setShader(SkShader::MakePictureShader(std::move(picture), SkShader::kRepea t_TileMode,
206 SkShader::kRepeat_TileMode,
207 nullptr, nullptr));
209 canvas->drawPaint(p); 208 canvas->drawPaint(p);
210 } 209 }
OLDNEW
« no previous file with comments | « gm/perlinnoise.cpp ('k') | gm/samplerstress.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698