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

Side by Side Diff: experimental/fiddle/draw.cpp

Issue 1834993003: experimental/fiddle: update to work again (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | experimental/fiddle/fiddle_main.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 2015 Google Inc. 2 * Copyright 2015 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 // This is an example of the translation unit that needs to be 8 // This is an example of the translation unit that needs to be
9 // assembled by the fiddler program to compile into a fiddle: an 9 // assembled by the fiddler program to compile into a fiddle: an
10 // implementation of the GetDrawOptions() and draw() functions. 10 // implementation of the GetDrawOptions() and draw() functions.
11 11
12 #include "fiddle_main.h" 12 #include "fiddle_main.h"
13 DrawOptions GetDrawOptions() { 13 DrawOptions GetDrawOptions() {
14 // path *should* be absolute. 14 // path *should* be absolute.
15 static const char path[] = "../../resources/color_wheel.png"; 15 static const char path[] = "../../resources/color_wheel.png";
16 return DrawOptions(256, 256, true, true, true, true, path); 16 return DrawOptions(256, 256, true, true, true, true, path);
17 } 17 }
18 void draw(SkCanvas* canvas) { 18 void draw(SkCanvas* canvas) {
19 canvas->clear(SK_ColorWHITE); 19 canvas->clear(SK_ColorWHITE);
20 SkMatrix matrix; 20 SkMatrix matrix;
21 matrix.setScale(0.75f, 0.75f); 21 matrix.setScale(0.75f, 0.75f);
22 matrix.preRotate(30.0f); 22 matrix.preRotate(30.0f);
23 SkAutoTUnref<SkShader> shader(
24 image->newShader(SkShader::kRepeat_TileMode,
25 SkShader::kRepeat_TileMode,
26 &matrix));
27 SkPaint paint; 23 SkPaint paint;
28 paint.setShader(shader); 24 paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
25 SkShader::kRepeat_TileMode,
26 &matrix));
29 canvas->drawPaint(paint); 27 canvas->drawPaint(paint);
30 } 28 }
OLDNEW
« no previous file with comments | « no previous file | experimental/fiddle/fiddle_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698