class SkBitmap;
class GrProcessor;
class GrContext;
+class GrShaderDataManager;
/**
* ColorFilters are optional objects in the drawing pipeline. When present in
*
* If the subclass returns false, then it should not modify the array at all.
*/
- virtual bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*>*) const {
+ virtual bool asFragmentProcessors(GrContext*, GrShaderDataManager*,
+ SkTDArray<GrFragmentProcessor*>*) const {
return false;
}
uint32_t getFlags() const override;
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*>*) const override;
+ bool asFragmentProcessors(GrContext*, GrShaderDataManager*,
+ SkTDArray<GrFragmentProcessor*>*) const override;
#endif
SK_TO_STRING_OVERRIDE()
SkColorFilter* newComposed(const SkColorFilter*) const override;
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*>*) const override;
+ bool asFragmentProcessors(GrContext*, GrShaderDataManager*,
+ SkTDArray<GrFragmentProcessor*>*) const override;
#endif
struct State {
void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const override;
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*>*) const override;
+ bool asFragmentProcessors(GrContext*, GrShaderDataManager*,
+ SkTDArray<GrFragmentProcessor*>*) const override;
#endif
SK_TO_STRING_OVERRIDE()
#endif
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*>*) const override;
+ bool asFragmentProcessors(GrContext*, GrShaderDataManager*,
+ SkTDArray<GrFragmentProcessor*>*) const override;
#endif
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkModeColorFilter)
#endif
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext* context,
+ bool asFragmentProcessors(GrContext* context, GrShaderDataManager* shaderDataManager,
SkTDArray<GrFragmentProcessor*>* array) const override {
- bool hasFrags = fInner->asFragmentProcessors(context, array);
- hasFrags |= fOuter->asFragmentProcessors(context, array);
+ bool hasFrags = fInner->asFragmentProcessors(context, shaderDataManager, array);
+ hasFrags |= fOuter->asFragmentProcessors(context, shaderDataManager, array);
return hasFrags;
}
#endif
const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
}
-bool SkColorCubeFilter::asFragmentProcessors(GrContext* context,
+bool SkColorCubeFilter::asFragmentProcessors(GrContext* context, GrShaderDataManager*,
SkTDArray<GrFragmentProcessor*>* array) const {
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
return ModeColorFilterEffect::Create(color, mode);
}
-bool SkModeColorFilter::asFragmentProcessors(GrContext*,
+bool SkModeColorFilter::asFragmentProcessors(GrContext*, GrShaderDataManager*,
SkTDArray<GrFragmentProcessor*>* array) const {
if (SkXfermode::kDst_Mode != fMode) {
GrFragmentProcessor* frag = ModeColorFilterEffect::Create(SkColor2GrColor(fColor), fMode);
return ColorMatrixEffect::Create(colorMatrix);
}
-bool SkColorMatrixFilter::asFragmentProcessors(GrContext*,
+bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrShaderDataManager*,
SkTDArray<GrFragmentProcessor*>* array) const {
GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix);
if (frag) {
}
};
-bool SkLumaColorFilter::asFragmentProcessors(GrContext*,
+bool SkLumaColorFilter::asFragmentProcessors(GrContext*, GrShaderDataManager*,
SkTDArray<GrFragmentProcessor*>* array) const {
GrFragmentProcessor* frag = LumaColorFilterEffect::Create();
SkColorFilter* newComposed(const SkColorFilter* inner) const override;
#if SK_SUPPORT_GPU
- bool asFragmentProcessors(GrContext*, SkTDArray<GrFragmentProcessor*>*) const override;
+ bool asFragmentProcessors(GrContext*, GrShaderDataManager*,
+ SkTDArray<GrFragmentProcessor*>*) const override;
#endif
void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const override;
));
SkTDArray<GrFragmentProcessor*> array;
- if (filter->asFragmentProcessors(context, &array)) {
+ GrPaint grPaint;
+ if (filter->asFragmentProcessors(context, grPaint.getShaderDataManager(), &array)) {
SkASSERT(1 == array.count()); // TableColorFilter only returns 1
return array[0];
}
}
bool SkTable_ColorFilter::asFragmentProcessors(GrContext* context,
+ GrShaderDataManager*,
SkTDArray<GrFragmentProcessor*>* array) const {
SkBitmap bitmap;
this->asComponentTable(&bitmap);
} else {
SkTDArray<GrFragmentProcessor*> array;
// return false if failed?
- if (colorFilter->asFragmentProcessors(context, &array)) {
+ if (colorFilter->asFragmentProcessors(context, grPaint->getShaderDataManager(),
+ &array)) {
for (int i = 0; i < array.count(); ++i) {
grPaint->addColorProcessor(array[i]);
array[i]->unref();
* found in the LICENSE file.
*/
+#include "SkColorFilter.h"
+#include "Test.h"
+
#if SK_SUPPORT_GPU
#include "GrContext.h"
#include "GrContextFactory.h"
#include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h"
-#include "SkColorFilter.h"
#include "SkGr.h"
-#include "Test.h"
static GrColor filterColor(const GrColor& color, uint32_t flags) {
uint32_t mask = 0;
{ kR|kA , gr_whiteTrans, SkColorSetARGB(128, 200, 200, 200), SkXfermode::kModulate_Mode, kR|kA, GrColorPackRGBA(50, 0, 0, 64) }
};
+ GrPaint paint;
for (size_t i = 0; i < SK_ARRAY_COUNT(filterTests); ++i) {
const GetConstantComponentTestCase& test = filterTests[i];
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode));
SkTDArray<GrFragmentProcessor*> array;
- bool hasFrag = cf->asFragmentProcessors(grContext, &array);
+ bool hasFrag = cf->asFragmentProcessors(grContext, paint.getShaderDataManager(), &array);
REPORTER_ASSERT(reporter, hasFrag);
REPORTER_ASSERT(reporter, 1 == array.count());
GrInvariantOutput inout(test.inputColor,