Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: src/gpu/effects/GrPorterDuffXferProcessor.cpp

Issue 776843004: Use static XPF for porter duff xp factories. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: Block case statements Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrPorterDuffXferProcessor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrPorterDuffXferProcessor.cpp
diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
index fdbcbbe656d266305cc08612a85dc0e2f22c6abd..1f50f9d52420691ac05813f63b823a210ed55103 100644
--- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp
+++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp
@@ -61,6 +61,88 @@ void GrPorterDuffXferProcessor::onComputeInvariantOutput(GrInvariantOutput* inou
///////////////////////////////////////////////////////////////////////////////
+GrXPFactory* GrPorterDuffXPFactory::Create(SkXfermode::Mode mode) {
+ switch (mode) {
+ case SkXfermode::kClear_Mode: {
+ static GrPorterDuffXPFactory gClearPDXPF(kZero_GrBlendCoeff, kZero_GrBlendCoeff);
+ return SkRef(&gClearPDXPF);
+ break;
+ }
+ case SkXfermode::kSrc_Mode: {
+ static GrPorterDuffXPFactory gSrcPDXPF(kOne_GrBlendCoeff, kZero_GrBlendCoeff);
+ return SkRef(&gSrcPDXPF);
+ break;
+ }
+ case SkXfermode::kDst_Mode: {
+ static GrPorterDuffXPFactory gDstPDXPF(kZero_GrBlendCoeff, kOne_GrBlendCoeff);
+ return SkRef(&gDstPDXPF);
+ break;
+ }
+ case SkXfermode::kSrcOver_Mode: {
+ static GrPorterDuffXPFactory gSrcOverPDXPF(kOne_GrBlendCoeff, kISA_GrBlendCoeff);
+ return SkRef(&gSrcOverPDXPF);
+ break;
+ }
+ case SkXfermode::kDstOver_Mode: {
+ static GrPorterDuffXPFactory gDstOverPDXPF(kIDA_GrBlendCoeff, kOne_GrBlendCoeff);
+ return SkRef(&gDstOverPDXPF);
+ break;
+ }
+ case SkXfermode::kSrcIn_Mode: {
+ static GrPorterDuffXPFactory gSrcInPDXPF(kDA_GrBlendCoeff, kZero_GrBlendCoeff);
+ return SkRef(&gSrcInPDXPF);
+ break;
+ }
+ case SkXfermode::kDstIn_Mode: {
+ static GrPorterDuffXPFactory gDstInPDXPF(kZero_GrBlendCoeff, kSA_GrBlendCoeff);
+ return SkRef(&gDstInPDXPF);
+ break;
+ }
+ case SkXfermode::kSrcOut_Mode: {
+ static GrPorterDuffXPFactory gSrcOutPDXPF(kIDA_GrBlendCoeff, kZero_GrBlendCoeff);
+ return SkRef(&gSrcOutPDXPF);
+ break;
+ }
+ case SkXfermode::kDstOut_Mode: {
+ static GrPorterDuffXPFactory gDstOutPDXPF(kZero_GrBlendCoeff, kISA_GrBlendCoeff);
+ return SkRef(&gDstOutPDXPF);
+ break;
+ }
+ case SkXfermode::kSrcATop_Mode: {
+ static GrPorterDuffXPFactory gSrcATopPDXPF(kDA_GrBlendCoeff, kISA_GrBlendCoeff);
+ return SkRef(&gSrcATopPDXPF);
+ break;
+ }
+ case SkXfermode::kDstATop_Mode: {
+ static GrPorterDuffXPFactory gDstATopPDXPF(kIDA_GrBlendCoeff, kSA_GrBlendCoeff);
+ return SkRef(&gDstATopPDXPF);
+ break;
+ }
+ case SkXfermode::kXor_Mode: {
+ static GrPorterDuffXPFactory gXorPDXPF(kIDA_GrBlendCoeff, kISA_GrBlendCoeff);
+ return SkRef(&gXorPDXPF);
+ break;
+ }
+ case SkXfermode::kPlus_Mode: {
+ static GrPorterDuffXPFactory gPlusPDXPF(kOne_GrBlendCoeff, kOne_GrBlendCoeff);
+ return SkRef(&gPlusPDXPF);
+ break;
+ }
+ case SkXfermode::kModulate_Mode: {
+ static GrPorterDuffXPFactory gModulatePDXPF(kZero_GrBlendCoeff, kSC_GrBlendCoeff);
+ return SkRef(&gModulatePDXPF);
+ break;
+ }
+ case SkXfermode::kScreen_Mode: {
+ static GrPorterDuffXPFactory gScreenPDXPF(kOne_GrBlendCoeff, kISC_GrBlendCoeff);
+ return SkRef(&gScreenPDXPF);
+ break;
+ }
+ default:
+ return NULL;
+ }
+}
+
const GrXferProcessor* GrPorterDuffXPFactory::createXferProcessor() const {
return GrPorterDuffXferProcessor::Create(fSrc, fDst);
}
« no previous file with comments | « src/gpu/effects/GrPorterDuffXferProcessor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698