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 #include "SkXfermode.h" | 9 #include "SkXfermode.h" |
10 #include "SkXfermode_proccoeff.h" | 10 #include "SkXfermode_proccoeff.h" |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
999 | 999 |
1000 // Technically, can't be static and passed as a template parameter. So we use a
nonymous namespace. | 1000 // Technically, can't be static and passed as a template parameter. So we use a
nonymous namespace. |
1001 namespace { | 1001 namespace { |
1002 SkXfermode* create_mode(int iMode) { | 1002 SkXfermode* create_mode(int iMode) { |
1003 SkXfermode::Mode mode = (SkXfermode::Mode)iMode; | 1003 SkXfermode::Mode mode = (SkXfermode::Mode)iMode; |
1004 | 1004 |
1005 ProcCoeff rec = gProcCoeffs[mode]; | 1005 ProcCoeff rec = gProcCoeffs[mode]; |
1006 if (auto xfermode = SkOpts::create_xfermode(rec, mode)) { | 1006 if (auto xfermode = SkOpts::create_xfermode(rec, mode)) { |
1007 return xfermode; | 1007 return xfermode; |
1008 } | 1008 } |
1009 return SkNEW_ARGS(SkProcCoeffXfermode, (rec, mode)); | 1009 return new SkProcCoeffXfermode(rec, mode); |
1010 } | 1010 } |
1011 } // namespace | 1011 } // namespace |
1012 | 1012 |
1013 SK_DECLARE_STATIC_LAZY_PTR_ARRAY(SkXfermode, cached, SkXfermode::kLastMode + 1,
create_mode); | 1013 SK_DECLARE_STATIC_LAZY_PTR_ARRAY(SkXfermode, cached, SkXfermode::kLastMode + 1,
create_mode); |
1014 | 1014 |
1015 SkXfermode* SkXfermode::Create(Mode mode) { | 1015 SkXfermode* SkXfermode::Create(Mode mode) { |
1016 SkASSERT(SK_ARRAY_COUNT(gProcCoeffs) == kModeCount); | 1016 SkASSERT(SK_ARRAY_COUNT(gProcCoeffs) == kModeCount); |
1017 | 1017 |
1018 if ((unsigned)mode >= kModeCount) { | 1018 if ((unsigned)mode >= kModeCount) { |
1019 // report error | 1019 // report error |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 if (!xfer) { | 1094 if (!xfer) { |
1095 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; | 1095 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; |
1096 } | 1096 } |
1097 | 1097 |
1098 return xfer->isOpaque(opacityType); | 1098 return xfer->isOpaque(opacityType); |
1099 } | 1099 } |
1100 | 1100 |
1101 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1101 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
1102 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1102 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
1103 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1103 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |