Chromium Code Reviews| 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 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 { luminosity_modeproc, proc_4f<luminosity_4f>, CANNOT_USE_COEFF, CANN OT_USE_COEFF }, | 978 { luminosity_modeproc, proc_4f<luminosity_4f>, CANNOT_USE_COEFF, CANN OT_USE_COEFF }, |
| 979 }; | 979 }; |
| 980 | 980 |
| 981 /////////////////////////////////////////////////////////////////////////////// | 981 /////////////////////////////////////////////////////////////////////////////// |
| 982 | 982 |
| 983 bool SkXfermode::asMode(Mode* mode) const { | 983 bool SkXfermode::asMode(Mode* mode) const { |
| 984 return false; | 984 return false; |
| 985 } | 985 } |
| 986 | 986 |
| 987 #if SK_SUPPORT_GPU | 987 #if SK_SUPPORT_GPU |
| 988 const GrFragmentProcessor* SkXfermode::getFragmentProcessorForImageFilter( | 988 sk_sp<GrFragmentProcessor> SkXfermode::makeFragmentProcessorForImageFilter( |
| 989 const GrFragment Processor*) const { | 989 sk_sp<GrFragment Processor>) const { |
| 990 // This should never be called. | 990 // This should never be called. |
| 991 // TODO: make pure virtual in SkXfermode once Android update lands | 991 // TODO: make pure virtual in SkXfermode once Android update lands |
| 992 SkASSERT(0); | 992 SkASSERT(0); |
| 993 return nullptr; | 993 return nullptr; |
| 994 } | 994 } |
| 995 | 995 |
| 996 GrXPFactory* SkXfermode::asXPFactory() const { | 996 sk_sp<GrXPFactory> SkXfermode::asXPFactory() const { |
| 997 // This should never be called. | 997 // This should never be called. |
| 998 // TODO: make pure virtual in SkXfermode once Android update lands | 998 // TODO: make pure virtual in SkXfermode once Android update lands |
| 999 SkASSERT(0); | 999 SkASSERT(0); |
| 1000 return nullptr; | 1000 return nullptr; |
| 1001 } | 1001 } |
| 1002 #endif | 1002 #endif |
| 1003 | 1003 |
| 1004 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ | 1004 SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{ |
| 1005 // no-op. subclasses should override this | 1005 // no-op. subclasses should override this |
| 1006 return dst; | 1006 return dst; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1232 if (0xFF != a) { | 1232 if (0xFF != a) { |
| 1233 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a)); | 1233 A = SkAlphaBlend(A, dstA, SkAlpha255To256(a)); |
| 1234 } | 1234 } |
| 1235 dst[i] = SkToU8(A); | 1235 dst[i] = SkToU8(A); |
| 1236 } | 1236 } |
| 1237 } | 1237 } |
| 1238 } | 1238 } |
| 1239 } | 1239 } |
| 1240 } | 1240 } |
| 1241 | 1241 |
| 1242 #if SK_SUPPORT_GPU | 1242 #if SK_SUPPORT_GPU |
|
bungeman-skia
2016/06/08 18:22:16
These includes should go at the top of the file, e
bsalomon
2016/06/08 19:50:50
Yep, I think the placing of includes intermixed wi
| |
| 1243 #include "GrFragmentProcessor.h" | |
| 1243 #include "effects/GrCustomXfermode.h" | 1244 #include "effects/GrCustomXfermode.h" |
| 1244 #include "effects/GrPorterDuffXferProcessor.h" | 1245 #include "effects/GrPorterDuffXferProcessor.h" |
| 1245 #include "effects/GrXfermodeFragmentProcessor.h" | 1246 #include "effects/GrXfermodeFragmentProcessor.h" |
| 1246 | 1247 |
| 1247 const GrFragmentProcessor* SkProcCoeffXfermode::getFragmentProcessorForImageFilt er( | 1248 sk_sp<GrFragmentProcessor> SkProcCoeffXfermode::makeFragmentProcessorForImageFil ter( |
| 1248 const GrFragmentProc essor* dst) const { | 1249 sk_sp<GrFragmentProc essor> dst) const { |
| 1249 SkASSERT(dst); | 1250 SkASSERT(dst); |
| 1250 return GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode); | 1251 return GrXfermodeFragmentProcessor::MakeFromDstProcessor(std::move(dst), fMo de); |
| 1251 } | 1252 } |
| 1252 | 1253 |
| 1253 GrXPFactory* SkProcCoeffXfermode::asXPFactory() const { | 1254 sk_sp<GrXPFactory> SkProcCoeffXfermode::asXPFactory() const { |
| 1254 if (CANNOT_USE_COEFF != fSrcCoeff) { | 1255 if (CANNOT_USE_COEFF != fSrcCoeff) { |
| 1255 GrXPFactory* result = GrPorterDuffXPFactory::Create(fMode); | 1256 sk_sp<GrXPFactory> result(GrPorterDuffXPFactory::Make(fMode)); |
| 1256 SkASSERT(result); | 1257 SkASSERT(result); |
| 1257 return result; | 1258 return result; |
| 1258 } | 1259 } |
| 1259 | 1260 |
| 1260 SkASSERT(GrCustomXfermode::IsSupportedMode(fMode)); | 1261 SkASSERT(GrCustomXfermode::IsSupportedMode(fMode)); |
| 1261 return GrCustomXfermode::CreateXPFactory(fMode); | 1262 return GrCustomXfermode::MakeXPFactory(fMode); |
| 1262 } | 1263 } |
| 1263 #endif | 1264 #endif |
| 1264 | 1265 |
| 1265 const char* SkXfermode::ModeName(Mode mode) { | 1266 const char* SkXfermode::ModeName(Mode mode) { |
| 1266 SkASSERT((unsigned) mode <= (unsigned)kLastMode); | 1267 SkASSERT((unsigned) mode <= (unsigned)kLastMode); |
| 1267 const char* gModeStrings[] = { | 1268 const char* gModeStrings[] = { |
| 1268 "Clear", "Src", "Dst", "SrcOver", "DstOver", "SrcIn", "DstIn", | 1269 "Clear", "Src", "Dst", "SrcOver", "DstOver", "SrcIn", "DstIn", |
| 1269 "SrcOut", "DstOut", "SrcATop", "DstATop", "Xor", "Plus", | 1270 "SrcOut", "DstOut", "SrcATop", "DstATop", "Xor", "Plus", |
| 1270 "Modulate", "Screen", "Overlay", "Darken", "Lighten", "ColorDodge", | 1271 "Modulate", "Screen", "Overlay", "Darken", "Lighten", "ColorDodge", |
| 1271 "ColorBurn", "HardLight", "SoftLight", "Difference", "Exclusion", | 1272 "ColorBurn", "HardLight", "SoftLight", "Difference", "Exclusion", |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1413 if (!xfer) { | 1414 if (!xfer) { |
| 1414 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; | 1415 return SkXfermode::kOpaque_SrcColorOpacity == opacityType; |
| 1415 } | 1416 } |
| 1416 | 1417 |
| 1417 return xfer->isOpaque(opacityType); | 1418 return xfer->isOpaque(opacityType); |
| 1418 } | 1419 } |
| 1419 | 1420 |
| 1420 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) | 1421 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkXfermode) |
| 1421 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) | 1422 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkProcCoeffXfermode) |
| 1422 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 1423 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |