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

Side by Side Diff: gm/rectangletexture.cpp

Issue 1785473002: SkImage now has makeShader to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: use build guard for impl of newShader 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/image_shader.cpp ('k') | include/core/SkImage.h » ('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 /* 2 /*
3 * Copyright 2016 Google Inc. 3 * Copyright 2016 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 // This test only works with the GPU backend. 9 // This test only works with the GPU backend.
10 10
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 canvas->save(); 157 canvas->save();
158 canvas->scale(s, s); 158 canvas->scale(s, s);
159 for (auto q : kQualities) { 159 for (auto q : kQualities) {
160 SkPaint plainPaint; 160 SkPaint plainPaint;
161 plainPaint.setFilterQuality(q); 161 plainPaint.setFilterQuality(q);
162 canvas->drawImage(rectImg, 0, 0, &plainPaint); 162 canvas->drawImage(rectImg, 0, 0, &plainPaint);
163 canvas->translate(kWidth + kPad, 0); 163 canvas->translate(kWidth + kPad, 0);
164 164
165 SkPaint clampPaint; 165 SkPaint clampPaint;
166 clampPaint.setFilterQuality(q); 166 clampPaint.setFilterQuality(q);
167 clampPaint.setShader(rectImg->newShader(SkShader::kClamp_Til eMode, 167 clampPaint.setShader(rectImg->makeShader(SkShader::kClamp_Ti leMode,
168 SkShader::kClamp_Til eMode))->unref(); 168 SkShader::kClamp_Ti leMode));
169 canvas->drawRect(SkRect::MakeWH(1.5f * kWidth, 1.5f * kHeigh t), clampPaint); 169 canvas->drawRect(SkRect::MakeWH(1.5f * kWidth, 1.5f * kHeigh t), clampPaint);
170 canvas->translate(kWidth * 1.5f + kPad, 0); 170 canvas->translate(kWidth * 1.5f + kPad, 0);
171 171
172 SkPaint repeatPaint; 172 SkPaint repeatPaint;
173 repeatPaint.setFilterQuality(q); 173 repeatPaint.setFilterQuality(q);
174 repeatPaint.setShader(rectImg->newShader(SkShader::kRepeat_T ileMode, 174 repeatPaint.setShader(rectImg->makeShader(SkShader::kRepeat_ TileMode,
175 SkShader::kMirror_T ileMode))->unref(); 175 SkShader::kMirror_ TileMode));
176 canvas->drawRect(SkRect::MakeWH(1.5f * kWidth, 1.5f * kHeigh t), repeatPaint); 176 canvas->drawRect(SkRect::MakeWH(1.5f * kWidth, 1.5f * kHeigh t), repeatPaint);
177 canvas->translate(1.5f * kWidth + kPad, 0); 177 canvas->translate(1.5f * kWidth + kPad, 0);
178 } 178 }
179 canvas->restore(); 179 canvas->restore();
180 canvas->translate(0, kPad + 1.5f * kHeight * s); 180 canvas->translate(0, kPad + 1.5f * kHeight * s);
181 } 181 }
182 } 182 }
183 183
184 private: 184 private:
185 typedef GM INHERITED; 185 typedef GM INHERITED;
186 }; 186 };
187 187
188 DEF_GM(return new RectangleTexture;) 188 DEF_GM(return new RectangleTexture;)
189 } 189 }
190 190
191 #endif 191 #endif
OLDNEW
« no previous file with comments | « gm/image_shader.cpp ('k') | include/core/SkImage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698