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

Side by Side Diff: src/core/SkShader.cpp

Issue 1772463002: use Make instead of Create to return a shared shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: partial update of skia call-sites 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
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkBitmapProcShader.h" 9 #include "SkBitmapProcShader.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 222
223 const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMat rix&, 223 const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMat rix&,
224 const SkMatrix*, SkFilt erQuality) const { 224 const SkMatrix*, SkFilt erQuality) const {
225 return nullptr; 225 return nullptr;
226 } 226 }
227 227
228 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { 228 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const {
229 return nullptr; 229 return nullptr;
230 } 230 }
231 231
232 SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; } 232 sk_sp<SkShader> SkShader::MakeEmptyShader() { return sk_sp<SkEmptyShader>(); }
233 233
234 SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader( color); } 234 sk_sp<SkShader> SkShader::MakeColorShader(SkColor color) { return sk_make_sp<SkC olorShader>(color); }
235 235
236 SkShader* SkShader::CreateBitmapShader(const SkBitmap& src, TileMode tmx, TileMo de tmy, 236 sk_sp<SkShader> SkShader::MakeBitmapShader(const SkBitmap& src, TileMode tmx, Ti leMode tmy,
237 const SkMatrix* localMatrix) { 237 const SkMatrix* localMatrix) {
238 return SkCreateBitmapShader(src, tmx, tmy, localMatrix, nullptr); 238 return SkMakeBitmapShader(src, tmx, tmy, localMatrix, nullptr);
239 } 239 }
240 240
241 SkShader* SkShader::CreatePictureShader(const SkPicture* src, TileMode tmx, Tile Mode tmy, 241 sk_sp<SkShader> SkShader::MakePictureShader(const SkPicture* src, TileMode tmx, TileMode tmy,
242 const SkMatrix* localMatrix, const SkRec t* tile) { 242 const SkMatrix* localMatrix, const S kRect* tile) {
243 return SkPictureShader::Create(src, tmx, tmy, localMatrix, tile); 243 return SkPictureShader::Make(src, tmx, tmy, localMatrix, tile);
244 } 244 }
245 245
246 #ifndef SK_IGNORE_TO_STRING 246 #ifndef SK_IGNORE_TO_STRING
247 void SkShader::toString(SkString* str) const { 247 void SkShader::toString(SkString* str) const {
248 if (!fLocalMatrix.isIdentity()) { 248 if (!fLocalMatrix.isIdentity()) {
249 str->append(" "); 249 str->append(" ");
250 fLocalMatrix.toString(str); 250 fLocalMatrix.toString(str);
251 } 251 }
252 } 252 }
253 #endif 253 #endif
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 this->INHERITED::toString(str); 356 this->INHERITED::toString(str);
357 357
358 str->append(")"); 358 str->append(")");
359 } 359 }
360 #endif 360 #endif
361 361
362 /////////////////////////////////////////////////////////////////////////////// 362 ///////////////////////////////////////////////////////////////////////////////
363 363
364 SkFlattenable* SkEmptyShader::CreateProc(SkReadBuffer&) { 364 SkFlattenable* SkEmptyShader::CreateProc(SkReadBuffer&) {
365 return SkShader::CreateEmptyShader(); 365 return SkShader::MakeEmptyShader().release();
366 } 366 }
367 367
368 #ifndef SK_IGNORE_TO_STRING 368 #ifndef SK_IGNORE_TO_STRING
369 #include "SkEmptyShader.h" 369 #include "SkEmptyShader.h"
370 370
371 void SkEmptyShader::toString(SkString* str) const { 371 void SkEmptyShader::toString(SkString* str) const {
372 str->append("SkEmptyShader: ("); 372 str->append("SkEmptyShader: (");
373 373
374 this->INHERITED::toString(str); 374 this->INHERITED::toString(str);
375 375
376 str->append(")"); 376 str->append(")");
377 } 377 }
378 #endif 378 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698