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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1336 | 1336 |
1337 AutoEffectUnref gEffect(SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode >(mode), NULL))); | 1337 AutoEffectUnref gEffect(SkNEW_ARGS(XferEffect, (static_cast<SkXfermode::Mode >(mode), NULL))); |
1338 return CreateEffectRef(gEffect); | 1338 return CreateEffectRef(gEffect); |
1339 } | 1339 } |
1340 | 1340 |
1341 #endif | 1341 #endif |
1342 | 1342 |
1343 /////////////////////////////////////////////////////////////////////////////// | 1343 /////////////////////////////////////////////////////////////////////////////// |
1344 /////////////////////////////////////////////////////////////////////////////// | 1344 /////////////////////////////////////////////////////////////////////////////// |
1345 | 1345 |
1346 SkProcCoeffXfermode::SkProcCoeffXfermode(SkFlattenableReadBuffer& buffer) : INHE RITED(buffer) { | |
tfarina
2013/11/21 23:45:07
Does SkProcCoeffXfermode deserve its own cpp file?
| |
1347 uint32_t mode32 = buffer.read32() % SK_ARRAY_COUNT(gProcCoeffs); | |
1348 if (mode32 >= SK_ARRAY_COUNT(gProcCoeffs)) { | |
1349 // out of range, just set to something harmless | |
1350 mode32 = SkXfermode::kSrcOut_Mode; | |
1351 } | |
1352 fMode = (SkXfermode::Mode)mode32; | |
1353 | |
1354 const ProcCoeff& rec = gProcCoeffs[fMode]; | |
1355 // these may be valid, or may be CANNOT_USE_COEFF | |
1356 fSrcCoeff = rec.fSC; | |
1357 fDstCoeff = rec.fDC; | |
1358 // now update our function-ptr in the super class | |
1359 this->INHERITED::setProc(rec.fProc); | |
1360 } | |
1361 | |
1346 bool SkProcCoeffXfermode::asMode(Mode* mode) const { | 1362 bool SkProcCoeffXfermode::asMode(Mode* mode) const { |
1347 if (mode) { | 1363 if (mode) { |
1348 *mode = fMode; | 1364 *mode = fMode; |
1349 } | 1365 } |
1350 return true; | 1366 return true; |
1351 } | 1367 } |
1352 | 1368 |
1353 bool SkProcCoeffXfermode::asCoeff(Coeff* sc, Coeff* dc) const { | 1369 bool SkProcCoeffXfermode::asCoeff(Coeff* sc, Coeff* dc) const { |
1354 if (CANNOT_USE_COEFF == fSrcCoeff) { | 1370 if (CANNOT_USE_COEFF == fSrcCoeff) { |
1355 return false; | 1371 return false; |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1947 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1963 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1948 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1964 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1949 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) | 1965 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkClearXfermode) |
1950 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) | 1966 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSrcXfermode) |
1951 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) | 1967 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstInXfermode) |
1952 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) | 1968 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDstOutXfermode) |
1953 #if !SK_ARM_NEON_IS_NONE | 1969 #if !SK_ARM_NEON_IS_NONE |
1954 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) | 1970 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkNEONProcCoeffXfermode) |
1955 #endif | 1971 #endif |
1956 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1972 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |