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

Side by Side Diff: src/core/SkXfermode.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/SkValidatingReadBuffer.cpp ('k') | src/effects/Sk1DPathEffect.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 "SkXfermode.h" 8 #include "SkXfermode.h"
9 #include "SkXfermode_proccoeff.h" 9 #include "SkXfermode_proccoeff.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 return false; 1085 return false;
1086 } 1086 }
1087 1087
1088 bool SkXfermode::isOpaque(SkXfermode::SrcColorOpacity opacityType) const { 1088 bool SkXfermode::isOpaque(SkXfermode::SrcColorOpacity opacityType) const {
1089 return false; 1089 return false;
1090 } 1090 }
1091 1091
1092 /////////////////////////////////////////////////////////////////////////////// 1092 ///////////////////////////////////////////////////////////////////////////////
1093 /////////////////////////////////////////////////////////////////////////////// 1093 ///////////////////////////////////////////////////////////////////////////////
1094 1094
1095 SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) { 1095 sk_sp<SkFlattenable> SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) {
1096 uint32_t mode32 = buffer.read32(); 1096 uint32_t mode32 = buffer.read32();
1097 if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) { 1097 if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) {
1098 return nullptr; 1098 return nullptr;
1099 } 1099 }
1100 return SkXfermode::Make((SkXfermode::Mode)mode32).release(); 1100 return SkXfermode::Make((SkXfermode::Mode)mode32);
1101 } 1101 }
1102 1102
1103 void SkProcCoeffXfermode::flatten(SkWriteBuffer& buffer) const { 1103 void SkProcCoeffXfermode::flatten(SkWriteBuffer& buffer) const {
1104 buffer.write32(fMode); 1104 buffer.write32(fMode);
1105 } 1105 }
1106 1106
1107 bool SkProcCoeffXfermode::asMode(Mode* mode) const { 1107 bool SkProcCoeffXfermode::asMode(Mode* mode) const {
1108 if (mode) { 1108 if (mode) {
1109 *mode = fMode; 1109 *mode = fMode;
1110 } 1110 }
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 if (!xfer) { 1410 if (!xfer) {
1411 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; 1411 return SkXfermode::kOpaque_SrcColorOpacity == opacityType;
1412 } 1412 }
1413 1413
1414 return xfer->isOpaque(opacityType); 1414 return xfer->isOpaque(opacityType);
1415 } 1415 }
1416 1416
1417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) 1417 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode)
1418 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) 1418 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode)
1419 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 1419 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/core/SkValidatingReadBuffer.cpp ('k') | src/effects/Sk1DPathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698