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

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

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 | « src/core/SkReadBuffer.cpp ('k') | src/core/SkValidatingReadBuffer.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 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 #include "SkUtils.h" 257 #include "SkUtils.h"
258 258
259 SkColorShader::SkColorShader(SkColor c) 259 SkColorShader::SkColorShader(SkColor c)
260 : fColor(c) { 260 : fColor(c) {
261 } 261 }
262 262
263 bool SkColorShader::isOpaque() const { 263 bool SkColorShader::isOpaque() const {
264 return SkColorGetA(fColor) == 255; 264 return SkColorGetA(fColor) == 255;
265 } 265 }
266 266
267 SkFlattenable* SkColorShader::CreateProc(SkReadBuffer& buffer) { 267 sk_sp<SkFlattenable> SkColorShader::CreateProc(SkReadBuffer& buffer) {
268 return new SkColorShader(buffer.readColor()); 268 return sk_make_sp<SkColorShader>(buffer.readColor());
269 } 269 }
270 270
271 void SkColorShader::flatten(SkWriteBuffer& buffer) const { 271 void SkColorShader::flatten(SkWriteBuffer& buffer) const {
272 buffer.writeColor(fColor); 272 buffer.writeColor(fColor);
273 } 273 }
274 274
275 uint32_t SkColorShader::ColorShaderContext::getFlags() const { 275 uint32_t SkColorShader::ColorShaderContext::getFlags() const {
276 return fFlags; 276 return fFlags;
277 } 277 }
278 278
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 state->fBlitBW = D64_BlitBW; 412 state->fBlitBW = D64_BlitBW;
413 state->fBlitAA = D64_BlitAA; 413 state->fBlitAA = D64_BlitAA;
414 return true; 414 return true;
415 default: 415 default:
416 return false; 416 return false;
417 } 417 }
418 } 418 }
419 419
420 /////////////////////////////////////////////////////////////////////////////// 420 ///////////////////////////////////////////////////////////////////////////////
421 421
422 SkFlattenable* SkEmptyShader::CreateProc(SkReadBuffer&) { 422 sk_sp<SkFlattenable> SkEmptyShader::CreateProc(SkReadBuffer&) {
423 return SkShader::MakeEmptyShader().release(); 423 return SkShader::MakeEmptyShader();
424 } 424 }
425 425
426 #ifndef SK_IGNORE_TO_STRING 426 #ifndef SK_IGNORE_TO_STRING
427 #include "SkEmptyShader.h" 427 #include "SkEmptyShader.h"
428 428
429 void SkEmptyShader::toString(SkString* str) const { 429 void SkEmptyShader::toString(SkString* str) const {
430 str->append("SkEmptyShader: ("); 430 str->append("SkEmptyShader: (");
431 431
432 this->INHERITED::toString(str); 432 this->INHERITED::toString(str);
433 433
(...skipping 20 matching lines...) Expand all
454 } 454 }
455 #endif 455 #endif
456 456
457 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR 457 #ifdef SK_SUPPORT_LEGACY_XFERMODE_PTR
458 #include "SkXfermode.h" 458 #include "SkXfermode.h"
459 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, 459 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
460 SkXfermode* xfer) { 460 SkXfermode* xfer) {
461 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer)); 461 return MakeComposeShader(std::move(dst), std::move(src), sk_ref_sp(xfer));
462 } 462 }
463 #endif 463 #endif
OLDNEW
« no previous file with comments | « src/core/SkReadBuffer.cpp ('k') | src/core/SkValidatingReadBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698