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

Side by Side Diff: src/core/SkColorFilter.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, 2 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 unified diff | Download patch
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkColorFilter.h" 8 #include "SkColorFilter.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkRefCnt.h" 10 #include "SkRefCnt.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 #include "SkTDArray.h" 12 #include "SkTDArray.h"
13 #include "SkUnPreMultiply.h" 13 #include "SkUnPreMultiply.h"
14 #include "SkWriteBuffer.h" 14 #include "SkWriteBuffer.h"
15 15
16 class GrFragmentProcessor; 16 #if SK_SUPPORT_GPU
17 #include "GrFragmentProcessor.h"
18 #endif
17 19
18 bool SkColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) const { 20 bool SkColorFilter::asColorMode(SkColor* color, SkXfermode::Mode* mode) const {
19 return false; 21 return false;
20 } 22 }
21 23
22 bool SkColorFilter::asColorMatrix(SkScalar matrix[20]) const { 24 bool SkColorFilter::asColorMatrix(SkScalar matrix[20]) const {
23 return false; 25 return false;
24 } 26 }
25 27
26 bool SkColorFilter::asComponentTable(SkBitmap*) const { 28 bool SkColorFilter::asComponentTable(SkBitmap*) const {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #ifndef SK_IGNORE_TO_STRING 62 #ifndef SK_IGNORE_TO_STRING
61 void toString(SkString* str) const override { 63 void toString(SkString* str) const override {
62 SkString outerS, innerS; 64 SkString outerS, innerS;
63 fOuter->toString(&outerS); 65 fOuter->toString(&outerS);
64 fInner->toString(&innerS); 66 fInner->toString(&innerS);
65 str->appendf("SkComposeColorFilter: outer(%s) inner(%s)", outerS.c_str() , innerS.c_str()); 67 str->appendf("SkComposeColorFilter: outer(%s) inner(%s)", outerS.c_str() , innerS.c_str());
66 } 68 }
67 #endif 69 #endif
68 70
69 #if SK_SUPPORT_GPU 71 #if SK_SUPPORT_GPU
70 bool asFragmentProcessors(GrContext* context, GrProcessorDataManager* procDa taManager, 72 const GrFragmentProcessor* asFragmentProcessor(GrContext* context,
71 SkTDArray<const GrFragmentProcessor*>* array) cons t override { 73 GrProcessorDataManager* pdm) const override {
72 bool hasFrags = fInner->asFragmentProcessors(context, procDataManager, a rray); 74 SkAutoTUnref<const GrFragmentProcessor> innerFP(fInner->asFragmentProces sor(context, pdm));
73 hasFrags |= fOuter->asFragmentProcessors(context, procDataManager, array ); 75 SkAutoTUnref<const GrFragmentProcessor> outerFP(fOuter->asFragmentProces sor(context, pdm));
74 return hasFrags; 76 if (!innerFP || !outerFP) {
77 return nullptr;
78 }
79 const GrFragmentProcessor* series[] = { innerFP, outerFP };
80 return GrFragmentProcessor::RunInSeries(series, 2);
75 } 81 }
76 #endif 82 #endif
77 83
78 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeColorFilter) 84 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposeColorFilter)
79 85
80 protected: 86 protected:
81 void flatten(SkWriteBuffer& buffer) const override { 87 void flatten(SkWriteBuffer& buffer) const override {
82 buffer.writeFlattenable(fOuter); 88 buffer.writeFlattenable(fOuter);
83 buffer.writeFlattenable(fInner); 89 buffer.writeFlattenable(fInner);
84 } 90 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) { 138 if (count > SK_MAX_COMPOSE_COLORFILTER_COUNT) {
133 return nullptr; 139 return nullptr;
134 } 140 }
135 return new SkComposeColorFilter(outer, inner, count); 141 return new SkComposeColorFilter(outer, inner, count);
136 } 142 }
137 143
138 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter) 144 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkColorFilter)
139 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeColorFilter) 145 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeColorFilter)
140 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 146 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
141 147
OLDNEW
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | src/effects/SkColorCubeFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698