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

Side by Side Diff: gm/textblobshader.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/textbloblooper.cpp ('k') | gm/texturedomaineffect.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 "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 SkColor colors[2]; 61 SkColor colors[2];
62 colors[0] = SK_ColorRED; 62 colors[0] = SK_ColorRED;
63 colors[1] = SK_ColorGREEN; 63 colors[1] = SK_ColorGREEN;
64 64
65 SkScalar pos[SK_ARRAY_COUNT(colors)]; 65 SkScalar pos[SK_ARRAY_COUNT(colors)];
66 for (unsigned i = 0; i < SK_ARRAY_COUNT(pos); ++i) { 66 for (unsigned i = 0; i < SK_ARRAY_COUNT(pos); ++i) {
67 pos[i] = (float)i / (SK_ARRAY_COUNT(pos) - 1); 67 pos[i] = (float)i / (SK_ARRAY_COUNT(pos) - 1);
68 } 68 }
69 69
70 SkISize sz = this->onISize(); 70 SkISize sz = this->onISize();
71 fShader.reset(SkGradientShader::CreateRadial(SkPoint::Make(SkIntToScalar (sz.width() / 2), 71 fShader = SkGradientShader::MakeRadial(SkPoint::Make(SkIntToScalar(sz.wi dth() / 2),
72 SkIntToScalar (sz.height() / 2)), 72 SkIntToScalar(sz.height() / 2)),
73 sz.width() * .66f, colors, pos, 73 sz.width() * .66f, colors, pos,
74 SK_ARRAY_COUNT(colors), 74 SK_ARRAY_COUNT(colors),
75 SkShader::kRepeat_TileMode) ); 75 SkShader::kRepeat_TileMode);
76 } 76 }
77 77
78 SkString onShortName() override { 78 SkString onShortName() override {
79 return SkString("textblobshader"); 79 return SkString("textblobshader");
80 } 80 }
81 81
82 SkISize onISize() override { 82 SkISize onISize() override {
83 return SkISize::Make(640, 480); 83 return SkISize::Make(640, 480);
84 } 84 }
85 85
(...skipping 11 matching lines...) Expand all
97 SkIntToScalar(i * sz.width() / kXCount), 97 SkIntToScalar(i * sz.width() / kXCount),
98 SkIntToScalar(j * sz.height() / kYCount), 98 SkIntToScalar(j * sz.height() / kYCount),
99 p); 99 p);
100 } 100 }
101 } 101 }
102 } 102 }
103 103
104 private: 104 private:
105 SkTDArray<uint16_t> fGlyphs; 105 SkTDArray<uint16_t> fGlyphs;
106 SkAutoTUnref<const SkTextBlob> fBlob; 106 SkAutoTUnref<const SkTextBlob> fBlob;
107 SkAutoTUnref<SkShader> fShader; 107 sk_sp<SkShader> fShader;
108 108
109 typedef skiagm::GM INHERITED; 109 typedef skiagm::GM INHERITED;
110 }; 110 };
111 111
112 DEF_GM(return new TextBlobShaderGM("Blobber");) 112 DEF_GM(return new TextBlobShaderGM("Blobber");)
OLDNEW
« no previous file with comments | « gm/textbloblooper.cpp ('k') | gm/texturedomaineffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698