OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |