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

Unified Diff: src/effects/SkColorFilters.cpp

Issue 1368423003: Use child processors to implement compose color filter. (Closed) Base URL: https://skia.googlesource.com/skia.git@upm
Patch Set: Address comments Created 5 years, 3 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 | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkColorFilters.cpp
diff --git a/src/effects/SkColorFilters.cpp b/src/effects/SkColorFilters.cpp
index 0c6a612355fecad8eefd615e44d23c7805917ff0..da01893b74671a9e3659d041780d60a526066ae4 100644
--- a/src/effects/SkColorFilters.cpp
+++ b/src/effects/SkColorFilters.cpp
@@ -70,36 +70,32 @@ SkFlattenable* SkModeColorFilter::CreateProc(SkReadBuffer& buffer) {
#include "effects/GrConstColorProcessor.h"
#include "SkGr.h"
-bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrProcessorDataManager*,
- SkTDArray<const GrFragmentProcessor*>* array) const {
- if (SkXfermode::kDst_Mode != fMode) {
- SkAutoTUnref<const GrFragmentProcessor> constFP(
- GrConstColorProcessor::Create(SkColorToPremulGrColor(fColor),
- GrConstColorProcessor::kIgnore_InputMode));
- const GrFragmentProcessor* fp =
- GrXfermodeFragmentProcessor::CreateFromSrcProcessor(constFP, fMode);
- if (fp) {
+const GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*,
+ GrProcessorDataManager*) const {
+ if (SkXfermode::kDst_Mode == fMode) {
+ return nullptr;
+ }
+
+ SkAutoTUnref<const GrFragmentProcessor> constFP(
+ GrConstColorProcessor::Create(SkColorToPremulGrColor(fColor),
+ GrConstColorProcessor::kIgnore_InputMode));
+ const GrFragmentProcessor* fp =
+ GrXfermodeFragmentProcessor::CreateFromSrcProcessor(constFP, fMode);
+ if (!fp) {
+ return nullptr;
+ }
#ifdef SK_DEBUG
- // With a solid color input this should always be able to compute the blended color
- // (at least for coeff modes)
- if (fMode <= SkXfermode::kLastCoeffMode) {
- static SkRandom gRand;
- GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColorComponentFlags,
- false);
- fp->computeInvariantOutput(&io);
- SkASSERT(io.validFlags() == kRGBA_GrColorComponentFlags);
- }
-#endif
- if (array) {
- *array->append() = fp;
- } else {
- fp->unref();
- SkDEBUGCODE(fp = nullptr;)
- }
- return true;
- }
+ // With a solid color input this should always be able to compute the blended color
+ // (at least for coeff modes)
+ if (fMode <= SkXfermode::kLastCoeffMode) {
+ static SkRandom gRand;
+ GrInvariantOutput io(GrPremulColor(gRand.nextU()), kRGBA_GrColorComponentFlags,
+ false);
+ fp->computeInvariantOutput(&io);
+ SkASSERT(io.validFlags() == kRGBA_GrColorComponentFlags);
}
- return false;
+#endif
+ return fp;
}
#endif
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkColorMatrixFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698