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

Side by Side Diff: gm/colortype.cpp

Issue 1776973003: partial switch over to sp usage of shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: move into lua container 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/colormatrix.cpp ('k') | gm/colortypexfermode.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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkGradientShader.h" 10 #include "SkGradientShader.h"
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 22
23 protected: 23 protected:
24 void onOnceBeforeDraw() override { 24 void onOnceBeforeDraw() override {
25 const SkColor colors[] = { 25 const SkColor colors[] = {
26 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, 26 SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE,
27 SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorYELLOW 27 SK_ColorMAGENTA, SK_ColorCYAN, SK_ColorYELLOW
28 }; 28 };
29 SkMatrix local; 29 SkMatrix local;
30 local.setRotate(180); 30 local.setRotate(180);
31 SkShader* s = SkGradientShader::CreateSweep(0,0, colors, nullptr,
32 SK_ARRAY_COUNT(colors), 0, & local);
33
34 SkPaint paint; 31 SkPaint paint;
35 paint.setAntiAlias(true); 32 paint.setAntiAlias(true);
36 paint.setShader(s)->unref(); 33 paint.setShader(SkGradientShader::MakeSweep(0, 0, colors, nullptr, SK_AR RAY_COUNT(colors),
34 0, &local));
37 35
38 SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif", 36 SkTypeface* orig = sk_tool_utils::create_portable_typeface("serif", SkTy peface::kBold);
39 SkTypeface::kBold);
40 if (nullptr == orig) { 37 if (nullptr == orig) {
41 orig = SkTypeface::RefDefault(); 38 orig = SkTypeface::RefDefault();
42 } 39 }
43 fColorType = new SkGTypeface(orig, paint); 40 fColorType = new SkGTypeface(orig, paint);
44 orig->unref(); 41 orig->unref();
45 } 42 }
46 43
47 SkString onShortName() override { 44 SkString onShortName() override {
48 return SkString("colortype"); 45 return SkString("colortype");
49 } 46 }
(...skipping 14 matching lines...) Expand all
64 } 61 }
65 } 62 }
66 63
67 private: 64 private:
68 SkTypeface* fColorType; 65 SkTypeface* fColorType;
69 66
70 typedef skiagm::GM INHERITED; 67 typedef skiagm::GM INHERITED;
71 }; 68 };
72 69
73 DEF_GM(return new ColorTypeGM;) 70 DEF_GM(return new ColorTypeGM;)
OLDNEW
« no previous file with comments | « gm/colormatrix.cpp ('k') | gm/colortypexfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698