OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
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 | 9 |
10 #include "SkXfermode.h" | 10 #include "SkXfermode.h" |
(...skipping 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 const ProcCoeff& rec = gProcCoeffs[fMode]; | 1251 const ProcCoeff& rec = gProcCoeffs[fMode]; |
1252 fProc = rec.fProc; | 1252 fProc = rec.fProc; |
1253 // these may be valid, or may be CANNOT_USE_COEFF | 1253 // these may be valid, or may be CANNOT_USE_COEFF |
1254 fSrcCoeff = rec.fSC; | 1254 fSrcCoeff = rec.fSC; |
1255 fDstCoeff = rec.fDC; | 1255 fDstCoeff = rec.fDC; |
1256 } | 1256 } |
1257 #endif | 1257 #endif |
1258 | 1258 |
1259 SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) { | 1259 SkFlattenable* SkProcCoeffXfermode::CreateProc(SkReadBuffer& buffer) { |
1260 uint32_t mode32 = buffer.read32(); | 1260 uint32_t mode32 = buffer.read32(); |
1261 if (!buffer.validate(mode32 >= SK_ARRAY_COUNT(gProcCoeffs))) { | 1261 if (!buffer.validate(mode32 < SK_ARRAY_COUNT(gProcCoeffs))) { |
1262 return NULL; | 1262 return NULL; |
1263 } | 1263 } |
1264 return SkXfermode::Create((SkXfermode::Mode)mode32); | 1264 return SkXfermode::Create((SkXfermode::Mode)mode32); |
1265 } | 1265 } |
1266 | 1266 |
1267 void SkProcCoeffXfermode::flatten(SkWriteBuffer& buffer) const { | 1267 void SkProcCoeffXfermode::flatten(SkWriteBuffer& buffer) const { |
1268 buffer.write32(fMode); | 1268 buffer.write32(fMode); |
1269 } | 1269 } |
1270 | 1270 |
1271 bool SkProcCoeffXfermode::asMode(Mode* mode) const { | 1271 bool SkProcCoeffXfermode::asMode(Mode* mode) const { |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 } else { | 1955 } else { |
1956 proc16 = rec.fProc16_General; | 1956 proc16 = rec.fProc16_General; |
1957 } | 1957 } |
1958 } | 1958 } |
1959 return proc16; | 1959 return proc16; |
1960 } | 1960 } |
1961 | 1961 |
1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1962 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1963 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1963 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1964 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1964 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |