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

Unified Diff: src/effects/SkTableColorFilter.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/SkLumaColorFilter.cpp ('k') | src/gpu/GrFragmentProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkTableColorFilter.cpp
diff --git a/src/effects/SkTableColorFilter.cpp b/src/effects/SkTableColorFilter.cpp
index 85e3a317bb733708bb8d444959d13474dfc0f6da..57b2b1daa614655fd072166b547d51d5ef39b846 100644
--- a/src/effects/SkTableColorFilter.cpp
+++ b/src/effects/SkTableColorFilter.cpp
@@ -48,8 +48,8 @@ public:
SkColorFilter* newComposed(const SkColorFilter* inner) const override;
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext*, GrProcessorDataManager*,
- SkTDArray<const GrFragmentProcessor*>*) const override;
+ const GrFragmentProcessor* asFragmentProcessor(GrContext*,
+ GrProcessorDataManager*) const override;
#endif
void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const override;
@@ -340,7 +340,7 @@ SkColorFilter* SkTable_ColorFilter::newComposed(const SkColorFilter* innerFilter
class ColorTableEffect : public GrFragmentProcessor {
public:
- static GrFragmentProcessor* Create(GrContext* context, SkBitmap bitmap, unsigned flags);
+ static const GrFragmentProcessor* Create(GrContext* context, SkBitmap bitmap, unsigned flags);
virtual ~ColorTableEffect();
@@ -461,7 +461,8 @@ void GLColorTableEffect::emitCode(EmitArgs& args) {
}
///////////////////////////////////////////////////////////////////////////////
-GrFragmentProcessor* ColorTableEffect::Create(GrContext* context, SkBitmap bitmap, unsigned flags) {
+const GrFragmentProcessor* ColorTableEffect::Create(GrContext* context, SkBitmap bitmap,
+ unsigned flags) {
GrTextureStripAtlas::Desc desc;
desc.fWidth = bitmap.width();
@@ -563,31 +564,17 @@ const GrFragmentProcessor* ColorTableEffect::TestCreate(GrProcessorTestData* d)
(flags & (1 << 3)) ? luts[3] : nullptr
));
- SkTDArray<const GrFragmentProcessor*> array;
- if (filter->asFragmentProcessors(d->fContext, d->fProcDataManager, &array)) {
- SkASSERT(1 == array.count()); // TableColorFilter only returns 1
- return array[0];
- }
- return nullptr;
+ const GrFragmentProcessor* fp = filter->asFragmentProcessor(d->fContext, d->fProcDataManager);
+ SkASSERT(fp);
+ return fp;
}
-bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context,
- GrProcessorDataManager*,
- SkTDArray<const GrFragmentProcessor*>* array) const {
+const GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* context,
+ GrProcessorDataManager*) const {
SkBitmap bitmap;
this->asComponentTable(&bitmap);
- GrFragmentProcessor* frag = ColorTableEffect::Create(context, bitmap, fFlags);
- if (frag) {
- if (array) {
- *array->append() = frag;
- } else {
- frag->unref();
- SkDEBUGCODE(frag = nullptr;)
- }
- return true;
- }
- return false;
+ return ColorTableEffect::Create(context, bitmap, fFlags);
}
#endif // SK_SUPPORT_GPU
« no previous file with comments | « src/effects/SkLumaColorFilter.cpp ('k') | src/gpu/GrFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698