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

Side by Side Diff: gm/srcmode.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/skbug_257.cpp ('k') | gm/surface.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 "SkGradientShader.h" 10 #include "SkGradientShader.h"
11 #include "SkPath.h" 11 #include "SkPath.h"
12 #include "SkSurface.h" 12 #include "SkSurface.h"
13 13
14 #if SK_SUPPORT_GPU 14 #if SK_SUPPORT_GPU
15 #include "SkGpuDevice.h" 15 #include "SkGpuDevice.h"
16 #endif 16 #endif
17 17
18 #define W SkIntToScalar(80) 18 #define W SkIntToScalar(80)
19 #define H SkIntToScalar(60) 19 #define H SkIntToScalar(60)
20 20
21 typedef void (*PaintProc)(SkPaint*); 21 typedef void (*PaintProc)(SkPaint*);
22 22
23 static void identity_paintproc(SkPaint* paint) { 23 static void identity_paintproc(SkPaint* paint) {
24 paint->setShader(nullptr); 24 paint->setShader(nullptr);
25 } 25 }
26 26
27 static void gradient_paintproc(SkPaint* paint) { 27 static void gradient_paintproc(SkPaint* paint) {
28 const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE }; 28 const SkColor colors[] = { SK_ColorGREEN, SK_ColorBLUE };
29 const SkPoint pts[] = { { 0, 0 }, { W, H } }; 29 const SkPoint pts[] = { { 0, 0 }, { W, H } };
30 SkShader* s = SkGradientShader::CreateLinear(pts, colors, nullptr, 30 paint->setShader(SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY _COUNT(colors),
31 SK_ARRAY_COUNT(colors), 31 SkShader::kClamp_TileMode));
32 SkShader::kClamp_TileMode);
33 paint->setShader(s)->unref();
34 } 32 }
35 33
36 typedef void (*Proc)(SkCanvas*, const SkPaint&); 34 typedef void (*Proc)(SkCanvas*, const SkPaint&);
37 35
38 static void draw_hair(SkCanvas* canvas, const SkPaint& paint) { 36 static void draw_hair(SkCanvas* canvas, const SkPaint& paint) {
39 SkPaint p(paint); 37 SkPaint p(paint);
40 p.setStrokeWidth(0); 38 p.setStrokeWidth(0);
41 canvas->drawLine(0, 0, W, H, p); 39 canvas->drawLine(0, 0, W, H, p);
42 } 40 }
43 41
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 surf->draw(canvas, 0, 0, nullptr); 140 surf->draw(canvas, 0, 0, nullptr);
143 } 141 }
144 142
145 private: 143 private:
146 typedef skiagm::GM INHERITED; 144 typedef skiagm::GM INHERITED;
147 }; 145 };
148 146
149 /////////////////////////////////////////////////////////////////////////////// 147 ///////////////////////////////////////////////////////////////////////////////
150 148
151 DEF_GM(return new SrcModeGM;) 149 DEF_GM(return new SrcModeGM;)
OLDNEW
« no previous file with comments | « gm/skbug_257.cpp ('k') | gm/surface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698