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

Unified Diff: src/core/SkXfermode.cpp

Issue 1674673002: Alter SkXfermode's asFragmentProcessor & asXPFactory contracts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test bug Created 4 years, 10 months 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 | « include/effects/SkXfermodeImageFilter.h ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkXfermode.cpp
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp
index 86e3ed5dcf8e579b9e3742b9026c551758a90731..0003becc408b6f7f069f3759ed482dd51de02b29 100644
--- a/src/core/SkXfermode.cpp
+++ b/src/core/SkXfermode.cpp
@@ -650,14 +650,22 @@ bool SkXfermode::asMode(Mode* mode) const {
return false;
}
-bool SkXfermode::asFragmentProcessor(const GrFragmentProcessor**,
- const GrFragmentProcessor*) const {
- return false;
+#if SK_SUPPORT_GPU
+const GrFragmentProcessor* SkXfermode::getFragmentProcessorForImageFilter(
+ const GrFragmentProcessor*) const {
+ // This should never be called.
+ // TODO: make pure virtual in SkXfermode once Android update lands
+ SkASSERT(0);
+ return nullptr;
}
-bool SkXfermode::asXPFactory(GrXPFactory**) const {
- return false;
+GrXPFactory* SkXfermode::asXPFactory() const {
+ // This should never be called.
+ // TODO: make pure virtual in SkXfermode once Android update lands
+ SkASSERT(0);
+ return nullptr;
}
+#endif
SkPMColor SkXfermode::xferColor(SkPMColor src, SkPMColor dst) const{
// no-op. subclasses should override this
@@ -902,33 +910,21 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
#include "effects/GrPorterDuffXferProcessor.h"
#include "effects/GrXfermodeFragmentProcessor.h"
-bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp,
- const GrFragmentProcessor* dst) const {
- if (fp) {
- SkASSERT(dst);
- *fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode);
- SkASSERT(*fp || kSrc_Mode == fMode);
- }
- return true;
+const GrFragmentProcessor* SkProcCoeffXfermode::getFragmentProcessorForImageFilter(
+ const GrFragmentProcessor* dst) const {
+ SkASSERT(dst);
+ return GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode);
}
-bool SkProcCoeffXfermode::asXPFactory(GrXPFactory** xp) const {
+GrXPFactory* SkProcCoeffXfermode::asXPFactory() const {
if (CANNOT_USE_COEFF != fSrcCoeff) {
- if (xp) {
- *xp = GrPorterDuffXPFactory::Create(fMode);
- SkASSERT(*xp);
- }
- return true;
+ GrXPFactory* result = GrPorterDuffXPFactory::Create(fMode);
+ SkASSERT(result);
+ return result;
}
- if (GrCustomXfermode::IsSupportedMode(fMode)) {
- if (xp) {
- *xp = GrCustomXfermode::CreateXPFactory(fMode);
- SkASSERT(*xp);
- }
- return true;
- }
- return false;
+ SkASSERT(GrCustomXfermode::IsSupportedMode(fMode));
+ return GrCustomXfermode::CreateXPFactory(fMode);
}
#endif
« no previous file with comments | « include/effects/SkXfermodeImageFilter.h ('k') | src/core/SkXfermode_proccoeff.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698