Bye bye processor data manager.
Review URL: https://codereview.chromium.org/1388113002
This commit is contained in:
parent
e1f8296999
commit
4a33952961
@ -37,8 +37,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
|
||||
#ifndef SK_IGNORE_TO_STRING
|
||||
void toString(SkString* str) const override {
|
||||
@ -58,7 +57,7 @@ SkFlattenable* DCShader::CreateProc(SkReadBuffer& buf) {
|
||||
|
||||
class DCFP : public GrFragmentProcessor {
|
||||
public:
|
||||
DCFP(GrProcessorDataManager*, const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) {
|
||||
DCFP(const SkMatrix& m) : fDeviceTransform(kDevice_GrCoordSet, m) {
|
||||
this->addCoordTransform(&fDeviceTransform);
|
||||
this->initClassID<DCFP>();
|
||||
}
|
||||
@ -97,13 +96,11 @@ private:
|
||||
GrCoordTransform fDeviceTransform;
|
||||
};
|
||||
|
||||
const GrFragmentProcessor* DCShader::asFragmentProcessor(
|
||||
GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(procDataManager, fDeviceMatrix));
|
||||
const GrFragmentProcessor* DCShader::asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality) const {
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(new DCFP(fDeviceMatrix));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
||||
|
@ -117,8 +117,7 @@ protected:
|
||||
GrTextureDomain::Mode mode = (GrTextureDomain::Mode) m;
|
||||
GrPipelineBuilder pipelineBuilder;
|
||||
SkAutoTUnref<GrFragmentProcessor> fp(
|
||||
GrTextureDomainEffect::Create(pipelineBuilder.getProcessorDataManager(),
|
||||
texture, textureMatrices[tm],
|
||||
GrTextureDomainEffect::Create(texture, textureMatrices[tm],
|
||||
GrTextureDomain::MakeTexelDomain(texture,
|
||||
texelDomains[d]),
|
||||
mode, GrTextureParams::kNone_FilterMode));
|
||||
|
@ -113,8 +113,7 @@ protected:
|
||||
for (int i = 0; i < 6; ++i) {
|
||||
GrPipelineBuilder pipelineBuilder;
|
||||
SkAutoTUnref<GrFragmentProcessor> fp(
|
||||
GrYUVtoRGBEffect::Create(pipelineBuilder.getProcessorDataManager(),
|
||||
texture[indices[i][0]],
|
||||
GrYUVtoRGBEffect::Create(texture[indices[i][0]],
|
||||
texture[indices[i][1]],
|
||||
texture[indices[i][2]],
|
||||
sizes,
|
||||
|
@ -27,7 +27,6 @@
|
||||
'<(skia_include_path)/gpu/GrPaint.h',
|
||||
'<(skia_include_path)/gpu/GrPathRendererChain.h',
|
||||
'<(skia_include_path)/gpu/GrProcessor.h',
|
||||
'<(skia_include_path)/gpu/GrProcessorDataManager.h',
|
||||
'<(skia_include_path)/gpu/GrProcessorUnitTest.h',
|
||||
'<(skia_include_path)/gpu/GrProgramElement.h',
|
||||
'<(skia_include_path)/gpu/GrGpuResourceRef.h',
|
||||
@ -135,7 +134,6 @@
|
||||
'<(skia_src_path)/gpu/GrProgramDesc.h',
|
||||
'<(skia_src_path)/gpu/GrProgramElement.cpp',
|
||||
'<(skia_src_path)/gpu/GrProcessor.cpp',
|
||||
'<(skia_src_path)/gpu/GrProcessorDataManager.cpp',
|
||||
'<(skia_src_path)/gpu/GrProcessorUnitTest.cpp',
|
||||
'<(skia_src_path)/gpu/GrProcOptInfo.cpp',
|
||||
'<(skia_src_path)/gpu/GrProcOptInfo.h',
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
class GrContext;
|
||||
class GrFragmentProcessor;
|
||||
class GrProcessorDataManager;
|
||||
class SkBitmap;
|
||||
|
||||
/**
|
||||
@ -132,8 +131,7 @@ public:
|
||||
*
|
||||
* A null return indicates that the color filter isn't implemented for the GPU backend.
|
||||
*/
|
||||
virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const {
|
||||
virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -40,8 +40,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
class ComposeShaderContext : public SkShader::Context {
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "SkSurfaceProps.h"
|
||||
|
||||
class GrFragmentProcessor;
|
||||
class GrProcessorDataManager;
|
||||
class GrTexture;
|
||||
class SkBaseDevice;
|
||||
class SkBitmap;
|
||||
@ -363,8 +362,8 @@ protected:
|
||||
* will be called with (NULL, NULL, SkMatrix::I()) to query for support,
|
||||
* so returning "true" indicates support for all possible matrices.
|
||||
*/
|
||||
virtual bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, GrTexture*,
|
||||
const SkMatrix&, const SkIRect& bounds) const;
|
||||
virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
|
||||
const SkIRect& bounds) const;
|
||||
|
||||
/**
|
||||
* Returns true if this filter can cause transparent black pixels to become
|
||||
|
@ -20,7 +20,6 @@ class SkPicture;
|
||||
class SkXfermode;
|
||||
class GrContext;
|
||||
class GrFragmentProcessor;
|
||||
class GrProcessorDataManager;
|
||||
|
||||
/** \class SkShader
|
||||
*
|
||||
@ -322,8 +321,7 @@ public:
|
||||
virtual const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewMatrix,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const;
|
||||
SkFilterQuality) const;
|
||||
|
||||
/**
|
||||
* If the shader can represent its "average" luminance in a single color, return true and
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "SkColor.h"
|
||||
|
||||
class GrFragmentProcessor;
|
||||
class GrProcessorDataManager;
|
||||
class GrTexture;
|
||||
class GrXPFactory;
|
||||
class SkString;
|
||||
@ -201,7 +200,7 @@ public:
|
||||
It is legal for the function to succeed but return a null output. This indicates that
|
||||
the output of the blend is simply the src color.
|
||||
*/
|
||||
virtual bool asFragmentProcessor(const GrFragmentProcessor** output, GrProcessorDataManager*,
|
||||
virtual bool asFragmentProcessor(const GrFragmentProcessor** output,
|
||||
const GrFragmentProcessor* dst) const;
|
||||
|
||||
/** A subclass may implement this factory function to work with the GPU backend. It is legal
|
||||
|
@ -25,8 +25,7 @@ public:
|
||||
uint32_t getFlags() const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const override;
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -26,8 +26,7 @@ public:
|
||||
SkColorFilter* newComposed(const SkColorFilter*) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const override;
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
|
||||
#endif
|
||||
|
||||
struct State {
|
||||
|
@ -28,8 +28,7 @@ public:
|
||||
void filterSpan(const SkPMColor src[], int count, SkPMColor[]) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const override;
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -26,8 +26,8 @@ protected:
|
||||
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
|
||||
SkBitmap* result, SkIPoint* offset) const override;
|
||||
#if SK_SUPPORT_GPU
|
||||
bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, GrTexture*,
|
||||
const SkMatrix&, const SkIRect& bounds) const override;
|
||||
bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
|
||||
const SkIRect& bounds) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -83,8 +83,8 @@ protected:
|
||||
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, GrTexture*,
|
||||
const SkMatrix&, const SkIRect& bounds) const override;
|
||||
bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
|
||||
const SkIRect& bounds) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -39,8 +39,7 @@ public:
|
||||
#endif
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const override;
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
|
||||
#endif
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkModeColorFilter)
|
||||
|
||||
|
@ -98,8 +98,7 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -470,13 +470,13 @@ private:
|
||||
* of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. Otherwise, they
|
||||
* return NULL.
|
||||
*/
|
||||
const GrFragmentProcessor* createPMToUPMEffect(GrProcessorDataManager*, GrTexture*,
|
||||
bool swapRAndB, const SkMatrix&) const;
|
||||
const GrFragmentProcessor* createUPMToPMEffect(GrProcessorDataManager*, GrTexture*,
|
||||
bool swapRAndB, const SkMatrix&) const;
|
||||
const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB,
|
||||
const SkMatrix&) const;
|
||||
const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB,
|
||||
const SkMatrix&) const;
|
||||
/** Called before either of the above two functions to determine the appropriate fragment
|
||||
processors for conversions. This must be called by readSurfacePixels befor a mutex is taken,
|
||||
since testingvPM conversions itself will call readSurfacePixels */
|
||||
processors for conversions. This must be called by readSurfacePixels before a mutex is
|
||||
taken, since testingvPM conversions itself will call readSurfacePixels */
|
||||
void testPMConversionsIfNecessary(uint32_t flags);
|
||||
/** Returns true if we've already determined that createPMtoUPMEffect and createUPMToPMEffect
|
||||
will fail. In such cases fall back to SW conversion. */
|
||||
|
@ -11,7 +11,6 @@
|
||||
#define GrPaint_DEFINED
|
||||
|
||||
#include "GrColor.h"
|
||||
#include "GrProcessorDataManager.h"
|
||||
#include "GrXferProcessor.h"
|
||||
#include "effects/GrPorterDuffXferProcessor.h"
|
||||
#include "GrFragmentProcessor.h"
|
||||
@ -141,10 +140,6 @@ public:
|
||||
*/
|
||||
bool isConstantBlendedColor(GrColor* constantColor) const;
|
||||
|
||||
GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager; }
|
||||
|
||||
const GrProcessorDataManager* processorDataManager() const { return &fProcDataManager; }
|
||||
|
||||
private:
|
||||
void resetFragmentProcessors() {
|
||||
for (int i = 0; i < fColorFragmentProcessors.count(); ++i) {
|
||||
@ -164,7 +159,6 @@ private:
|
||||
bool fAntiAlias;
|
||||
|
||||
GrColor fColor;
|
||||
GrProcessorDataManager fProcDataManager;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,16 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#ifndef GrProcessorDataManager_DEFINED
|
||||
#define GrProcessorDataManager_DEFINED
|
||||
|
||||
// TODO this class is just an empty stub for now
|
||||
|
||||
class GrProcessorDataManager {
|
||||
};
|
||||
|
||||
#endif
|
@ -41,19 +41,16 @@ const GrFragmentProcessor* CreateChildFP(GrProcessorTestData*);
|
||||
struct GrProcessorTestData {
|
||||
GrProcessorTestData(SkRandom* random,
|
||||
GrContext* context,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const GrCaps* caps,
|
||||
GrTexture* textures[2])
|
||||
: fRandom(random)
|
||||
, fContext(context)
|
||||
, fProcDataManager(procDataManager)
|
||||
, fCaps(caps) {
|
||||
fTextures[0] = textures[0];
|
||||
fTextures[1] = textures[1];
|
||||
}
|
||||
SkRandom* fRandom;
|
||||
GrContext* fContext;
|
||||
GrProcessorDataManager* fProcDataManager;
|
||||
const GrCaps* fCaps;
|
||||
GrTexture* fTextures[2];
|
||||
};
|
||||
|
@ -360,8 +360,7 @@ void SkBitmapProcShader::toString(SkString* str) const {
|
||||
|
||||
const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* context,
|
||||
const SkMatrix& viewM, const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality filterQuality) const {
|
||||
SkMatrix matrix;
|
||||
matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height());
|
||||
|
||||
@ -402,9 +401,9 @@ const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* co
|
||||
|
||||
SkAutoTUnref<GrFragmentProcessor> inner;
|
||||
if (doBicubic) {
|
||||
inner.reset(GrBicubicEffect::Create(procDataManager, texture, matrix, tm));
|
||||
inner.reset(GrBicubicEffect::Create(texture, matrix, tm));
|
||||
} else {
|
||||
inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matrix, params));
|
||||
inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params));
|
||||
}
|
||||
|
||||
if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
|
||||
|
@ -30,8 +30,7 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -69,10 +69,9 @@ public:
|
||||
#endif
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context,
|
||||
GrProcessorDataManager* pdm) const override {
|
||||
SkAutoTUnref<const GrFragmentProcessor> innerFP(fInner->asFragmentProcessor(context, pdm));
|
||||
SkAutoTUnref<const GrFragmentProcessor> outerFP(fOuter->asFragmentProcessor(context, pdm));
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context) const override {
|
||||
SkAutoTUnref<const GrFragmentProcessor> innerFP(fInner->asFragmentProcessor(context));
|
||||
SkAutoTUnref<const GrFragmentProcessor> outerFP(fOuter->asFragmentProcessor(context));
|
||||
if (!innerFP || !outerFP) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -51,8 +51,7 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -204,9 +204,7 @@ void SkComposeShader::ComposeShaderContext::shadeSpan(int x, int y, SkPMColor re
|
||||
const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq,
|
||||
GrProcessorDataManager* procDataManager
|
||||
) const {
|
||||
SkFilterQuality fq) const {
|
||||
// Fragment processor will only support SkXfermode::Mode modes currently.
|
||||
SkXfermode::Mode mode;
|
||||
if (!(SkXfermode::AsMode(fMode, &mode))) {
|
||||
@ -219,19 +217,19 @@ const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(GrContext* conte
|
||||
GrConstColorProcessor::kIgnore_InputMode);
|
||||
break;
|
||||
case SkXfermode::kSrc_Mode:
|
||||
return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq, procDataManager);
|
||||
return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq);
|
||||
break;
|
||||
case SkXfermode::kDst_Mode:
|
||||
return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq, procDataManager);
|
||||
return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq);
|
||||
break;
|
||||
default:
|
||||
SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProcessor(context,
|
||||
viewM, localMatrix, fq, procDataManager));
|
||||
viewM, localMatrix, fq));
|
||||
if (!fpA.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
SkAutoTUnref<const GrFragmentProcessor> fpB(fShaderB->asFragmentProcessor(context,
|
||||
viewM, localMatrix, fq, procDataManager));
|
||||
viewM, localMatrix, fq));
|
||||
if (!fpB.get()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ bool SkImageFilter::onFilterImage(Proxy*, const SkBitmap&, const Context&,
|
||||
}
|
||||
|
||||
bool SkImageFilter::canFilterImageGPU() const {
|
||||
return this->asFragmentProcessor(nullptr, nullptr, nullptr, SkMatrix::I(), SkIRect());
|
||||
return this->asFragmentProcessor(nullptr, nullptr, SkMatrix::I(), SkIRect());
|
||||
}
|
||||
|
||||
bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
|
||||
@ -350,7 +350,7 @@ bool SkImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Cont
|
||||
SkMatrix matrix(ctx.ctm());
|
||||
matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
|
||||
GrPaint paint;
|
||||
if (this->asFragmentProcessor(&fp, paint.getProcessorDataManager(), srcTexture, matrix, bounds)) {
|
||||
if (this->asFragmentProcessor(&fp, srcTexture, matrix, bounds)) {
|
||||
SkASSERT(fp);
|
||||
paint.addColorFragmentProcessor(fp)->unref();
|
||||
|
||||
@ -428,7 +428,7 @@ bool SkImageFilter::onFilterBounds(const SkIRect& src, const SkMatrix& ctm,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SkImageFilter::asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, GrTexture*,
|
||||
bool SkImageFilter::asFragmentProcessor(GrFragmentProcessor**, GrTexture*,
|
||||
const SkMatrix&, const SkIRect&) const {
|
||||
return false;
|
||||
}
|
||||
|
@ -76,8 +76,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
size_t contextSize() const override;
|
||||
@ -137,10 +136,10 @@ private:
|
||||
|
||||
class LightingFP : public GrFragmentProcessor {
|
||||
public:
|
||||
LightingFP(GrProcessorDataManager* pdm, GrTexture* diffuse, GrTexture* normal,
|
||||
const SkMatrix& diffMatrix, const SkMatrix& normMatrix,
|
||||
const GrTextureParams& diffParams, const GrTextureParams& normParams,
|
||||
const SkLightingShader::Lights* lights, const SkVector& invNormRotation)
|
||||
LightingFP(GrTexture* diffuse, GrTexture* normal, const SkMatrix& diffMatrix,
|
||||
const SkMatrix& normMatrix, const GrTextureParams& diffParams,
|
||||
const GrTextureParams& normParams, const SkLightingShader::Lights* lights,
|
||||
const SkVector& invNormRotation)
|
||||
: fDiffDeviceTransform(kLocal_GrCoordSet, diffMatrix, diffuse, diffParams.filterMode())
|
||||
, fNormDeviceTransform(kLocal_GrCoordSet, normMatrix, normal, normParams.filterMode())
|
||||
, fDiffuseTextureAccess(diffuse, diffParams)
|
||||
@ -349,8 +348,7 @@ const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality,
|
||||
GrProcessorDataManager* pdm) const {
|
||||
SkFilterQuality filterQuality) const {
|
||||
// we assume diffuse and normal maps have same width and height
|
||||
// TODO: support different sizes
|
||||
SkASSERT(fDiffuseMap.width() == fNormalMap.width() &&
|
||||
@ -398,8 +396,8 @@ const GrFragmentProcessor* SkLightingShaderImpl::asFragmentProcessor(
|
||||
}
|
||||
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner (
|
||||
new LightingFP(pdm, diffuseTexture, normalTexture, diffM, normM, diffParams, normParams,
|
||||
fLights, fInvNormRotation));
|
||||
new LightingFP(diffuseTexture, normalTexture, diffM, normM, diffParams, normParams, fLights,
|
||||
fInvNormRotation));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
||||
|
@ -29,13 +29,13 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext* context, const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix, SkFilterQuality fq,
|
||||
GrProcessorDataManager* procDataManager) const override {
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq) const override {
|
||||
SkMatrix tmp = this->getLocalMatrix();
|
||||
if (localMatrix) {
|
||||
tmp.preConcat(*localMatrix);
|
||||
}
|
||||
return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq, procDataManager);
|
||||
return fProxyShader->asFragmentProcessor(context, viewM, &tmp, fq);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -318,8 +318,7 @@ const GrFragmentProcessor* SkPictureShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality fq,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality fq) const {
|
||||
int maxTextureSize = 0;
|
||||
if (context) {
|
||||
maxTextureSize = context->caps()->maxTextureSize();
|
||||
@ -328,6 +327,6 @@ const GrFragmentProcessor* SkPictureShader::asFragmentProcessor(
|
||||
if (!bitmapShader) {
|
||||
return nullptr;
|
||||
}
|
||||
return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq, procDataManager);
|
||||
return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq);
|
||||
}
|
||||
#endif
|
||||
|
@ -34,8 +34,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -211,8 +211,7 @@ SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const {
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMatrix&,
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
GrProcessorDataManager*) const {
|
||||
const SkMatrix*, SkFilterQuality) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -333,8 +332,8 @@ SkShader::GradientType SkColorShader::asAGradient(GradientInfo* info) const {
|
||||
#include "SkGr.h"
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
const GrFragmentProcessor* SkColorShader::asFragmentProcessor(GrContext*, const SkMatrix&,
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
GrProcessorDataManager*) const {
|
||||
const SkMatrix*,
|
||||
SkFilterQuality) const {
|
||||
GrColor color = SkColorToPremulGrColor(fColor);
|
||||
return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulateA_InputMode);
|
||||
}
|
||||
|
@ -651,7 +651,7 @@ bool SkXfermode::asMode(Mode* mode) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SkXfermode::asFragmentProcessor(const GrFragmentProcessor**, GrProcessorDataManager*,
|
||||
bool SkXfermode::asFragmentProcessor(const GrFragmentProcessor**,
|
||||
const GrFragmentProcessor*) const {
|
||||
return false;
|
||||
}
|
||||
@ -923,11 +923,9 @@ void SkProcCoeffXfermode::xferA8(SkAlpha* SK_RESTRICT dst,
|
||||
#include "effects/GrXfermodeFragmentProcessor.h"
|
||||
|
||||
bool SkProcCoeffXfermode::asFragmentProcessor(const GrFragmentProcessor** fp,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const GrFragmentProcessor* dst) const {
|
||||
if (fp) {
|
||||
SkASSERT(dst);
|
||||
SkASSERT(procDataManager);
|
||||
*fp = GrXfermodeFragmentProcessor::CreateFromDstProcessor(dst, fMode);
|
||||
SkASSERT(*fp || kSrc_Mode == fMode);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public:
|
||||
bool isOpaque(SkXfermode::SrcColorOpacity opacityType) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
bool asFragmentProcessor(const GrFragmentProcessor**, GrProcessorDataManager*,
|
||||
bool asFragmentProcessor(const GrFragmentProcessor**,
|
||||
const GrFragmentProcessor*) const override;
|
||||
|
||||
bool asXPFactory(GrXPFactory**) const override;
|
||||
|
@ -28,8 +28,8 @@ protected:
|
||||
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
|
||||
SkBitmap* result, SkIPoint* offset) const override;
|
||||
#if SK_SUPPORT_GPU
|
||||
bool asFragmentProcessor(GrFragmentProcessor**, GrProcessorDataManager*, GrTexture*,
|
||||
const SkMatrix&, const SkIRect& bounds) const override;
|
||||
bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&,
|
||||
const SkIRect& bounds) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -62,13 +62,11 @@ SkImageFilter* SkAlphaThresholdFilter::Create(const SkRegion& region,
|
||||
class AlphaThresholdEffect : public GrFragmentProcessor {
|
||||
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
static GrFragmentProcessor* Create(GrTexture* texture,
|
||||
GrTexture* maskTexture,
|
||||
float innerThreshold,
|
||||
float outerThreshold) {
|
||||
return new AlphaThresholdEffect(procDataManager, texture, maskTexture, innerThreshold,
|
||||
outerThreshold);
|
||||
return new AlphaThresholdEffect(texture, maskTexture, innerThreshold, outerThreshold);
|
||||
}
|
||||
|
||||
virtual ~AlphaThresholdEffect() {};
|
||||
@ -79,8 +77,7 @@ public:
|
||||
float outerThreshold() const { return fOuterThreshold; }
|
||||
|
||||
private:
|
||||
AlphaThresholdEffect(GrProcessorDataManager*,
|
||||
GrTexture* texture,
|
||||
AlphaThresholdEffect(GrTexture* texture,
|
||||
GrTexture* maskTexture,
|
||||
float innerThreshold,
|
||||
float outerThreshold)
|
||||
@ -200,8 +197,7 @@ const GrFragmentProcessor* AlphaThresholdEffect::TestCreate(GrProcessorTestData*
|
||||
GrTexture* maskTex = d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx];
|
||||
float innerThresh = d->fRandom->nextUScalar1();
|
||||
float outerThresh = d->fRandom->nextUScalar1();
|
||||
return AlphaThresholdEffect::Create(d->fProcDataManager, bmpTex, maskTex, innerThresh,
|
||||
outerThresh);
|
||||
return AlphaThresholdEffect::Create(bmpTex, maskTex, innerThresh, outerThresh);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@ -254,7 +250,6 @@ SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const SkMatrix& in_matrix,
|
||||
const SkIRect&) const {
|
||||
@ -292,8 +287,7 @@ bool SkAlphaThresholdFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp,
|
||||
}
|
||||
}
|
||||
|
||||
*fp = AlphaThresholdEffect::Create(procDataManager,
|
||||
texture,
|
||||
*fp = AlphaThresholdEffect::Create(texture,
|
||||
maskTexture,
|
||||
fInnerThreshold,
|
||||
fOuterThreshold);
|
||||
|
@ -31,7 +31,7 @@ public:
|
||||
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar)
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
bool asFragmentProcessor(const GrFragmentProcessor**, GrProcessorDataManager*,
|
||||
bool asFragmentProcessor(const GrFragmentProcessor**,
|
||||
const GrFragmentProcessor* dst) const override;
|
||||
|
||||
bool asXPFactory(GrXPFactory**) const override;
|
||||
@ -236,11 +236,9 @@ SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2,
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
bool SkArithmeticMode_scalar::asFragmentProcessor(const GrFragmentProcessor** fp,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const GrFragmentProcessor* dst) const {
|
||||
if (fp) {
|
||||
*fp = GrArithmeticFP::Create(procDataManager,
|
||||
SkScalarToFloat(fK[0]),
|
||||
*fp = GrArithmeticFP::Create(SkScalarToFloat(fK[0]),
|
||||
SkScalarToFloat(fK[1]),
|
||||
SkScalarToFloat(fK[2]),
|
||||
SkScalarToFloat(fK[3]),
|
||||
|
@ -94,8 +94,8 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrArithmeticFP::GrArithmeticFP(GrProcessorDataManager*, float k1, float k2, float k3, float k4,
|
||||
bool enforcePMColor, const GrFragmentProcessor* dst)
|
||||
GrArithmeticFP::GrArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor,
|
||||
const GrFragmentProcessor* dst)
|
||||
: fK1(k1), fK2(k2), fK3(k3), fK4(k4), fEnforcePMColor(enforcePMColor) {
|
||||
this->initClassID<GrArithmeticFP>();
|
||||
|
||||
@ -136,7 +136,7 @@ const GrFragmentProcessor* GrArithmeticFP::TestCreate(GrProcessorTestData* d) {
|
||||
bool enforcePMColor = d->fRandom->nextBool();
|
||||
|
||||
SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChildFP(d));
|
||||
return new GrArithmeticFP(d->fProcDataManager, k1, k2, k3, k4, enforcePMColor, dst);
|
||||
return new GrArithmeticFP(k1, k2, k3, k4, enforcePMColor, dst);
|
||||
}
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrArithmeticFP);
|
||||
|
@ -31,10 +31,9 @@ class GrGLArtithmeticFP;
|
||||
|
||||
class GrArithmeticFP : public GrFragmentProcessor {
|
||||
public:
|
||||
static const GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
float k1, float k2, float k3, float k4,
|
||||
static const GrFragmentProcessor* Create(float k1, float k2, float k3, float k4,
|
||||
bool enforcePMColor, const GrFragmentProcessor* dst) {
|
||||
return new GrArithmeticFP(procDataManager, k1, k2, k3, k4, enforcePMColor, dst);
|
||||
return new GrArithmeticFP(k1, k2, k3, k4, enforcePMColor, dst);
|
||||
}
|
||||
|
||||
~GrArithmeticFP() override {};
|
||||
@ -56,8 +55,8 @@ private:
|
||||
|
||||
void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
|
||||
|
||||
GrArithmeticFP(GrProcessorDataManager*, float k1, float k2, float k3, float k4,
|
||||
bool enforcePMColor, const GrFragmentProcessor* dst);
|
||||
GrArithmeticFP(float k1, float k2, float k3, float k4, bool enforcePMColor,
|
||||
const GrFragmentProcessor* dst);
|
||||
|
||||
float fK1, fK2, fK3, fK4;
|
||||
bool fEnforcePMColor;
|
||||
|
@ -1208,8 +1208,7 @@ bool SkBlurMaskFilterImpl::filterMaskGPU(GrTexture* src,
|
||||
SkMatrix matrix;
|
||||
matrix.setIDiv(src->width(), src->height());
|
||||
// Blend pathTexture over blurTexture.
|
||||
paint.addCoverageFragmentProcessor(
|
||||
GrSimpleTextureEffect::Create(paint.getProcessorDataManager(), src, matrix))->unref();
|
||||
paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(src, matrix))->unref();
|
||||
if (kInner_SkBlurStyle == fBlurStyle) {
|
||||
// inner: dst = dst * src
|
||||
paint.setCoverageSetOpXPFactory(SkRegion::kIntersect_Op);
|
||||
|
@ -303,8 +303,7 @@ void GrColorCubeEffect::GLProcessor::GenKey(const GrProcessor& proc,
|
||||
const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* SkColorCubeFilter::asFragmentProcessor(GrContext* context,
|
||||
GrProcessorDataManager*) const {
|
||||
const GrFragmentProcessor* SkColorCubeFilter::asFragmentProcessor(GrContext* context) const {
|
||||
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
|
||||
GrUniqueKey key;
|
||||
GrUniqueKey::Builder builder(&key, kDomain, 2);
|
||||
|
@ -70,8 +70,7 @@ SkFlattenable* SkModeColorFilter::CreateProc(SkReadBuffer& buffer) {
|
||||
#include "effects/GrConstColorProcessor.h"
|
||||
#include "SkGr.h"
|
||||
|
||||
const GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const {
|
||||
const GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*) const {
|
||||
if (SkXfermode::kDst_Mode == fMode) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -536,8 +536,7 @@ const GrFragmentProcessor* ColorMatrixEffect::TestCreate(GrProcessorTestData* d)
|
||||
return ColorMatrixEffect::Create(colorMatrix);
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* SkColorMatrixFilter::asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const {
|
||||
const GrFragmentProcessor* SkColorMatrixFilter::asFragmentProcessor(GrContext*) const {
|
||||
return ColorMatrixEffect::Create(fMatrix);
|
||||
}
|
||||
|
||||
|
@ -328,14 +328,12 @@ private:
|
||||
class GrDisplacementMapEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(
|
||||
GrProcessorDataManager* procDataManager,
|
||||
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVector scale,
|
||||
GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* color,
|
||||
const SkISize& colorDimensions) {
|
||||
return new GrDisplacementMapEffect(procDataManager, xChannelSelector, yChannelSelector,
|
||||
scale, displacement, offsetMatrix, color,
|
||||
colorDimensions);
|
||||
return new GrDisplacementMapEffect(xChannelSelector, yChannelSelector, scale, displacement,
|
||||
offsetMatrix, color, colorDimensions);
|
||||
}
|
||||
|
||||
virtual ~GrDisplacementMapEffect();
|
||||
@ -363,8 +361,7 @@ private:
|
||||
|
||||
void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
|
||||
|
||||
GrDisplacementMapEffect(GrProcessorDataManager*,
|
||||
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
|
||||
const SkVector& scale,
|
||||
GrTexture* displacement, const SkMatrix& offsetMatrix,
|
||||
@ -439,8 +436,7 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
|
||||
SkIntToScalar(colorOffset.fY - displacementOffset.fY));
|
||||
|
||||
paint.addColorFragmentProcessor(
|
||||
GrDisplacementMapEffect::Create(paint.getProcessorDataManager(),
|
||||
fXChannelSelector,
|
||||
GrDisplacementMapEffect::Create(fXChannelSelector,
|
||||
fYChannelSelector,
|
||||
scale,
|
||||
displacement,
|
||||
@ -469,7 +465,6 @@ bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrDisplacementMapEffect::GrDisplacementMapEffect(
|
||||
GrProcessorDataManager*,
|
||||
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
|
||||
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector,
|
||||
const SkVector& scale,
|
||||
@ -534,8 +529,7 @@ const GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(GrProcessorTestDa
|
||||
SkISize colorDimensions;
|
||||
colorDimensions.fWidth = d->fRandom->nextRangeU(0, d->fTextures[texIdxColor]->width());
|
||||
colorDimensions.fHeight = d->fRandom->nextRangeU(0, d->fTextures[texIdxColor]->height());
|
||||
return GrDisplacementMapEffect::Create(d->fProcDataManager,
|
||||
xChannelSelector, yChannelSelector, scale,
|
||||
return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, scale,
|
||||
d->fTextures[texIdxDispl], SkMatrix::I(),
|
||||
d->fTextures[texIdxColor], colorDimensions);
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ static void convolve_gaussian_1d(GrDrawContext* drawContext,
|
||||
float bounds[2]) {
|
||||
GrPaint paint;
|
||||
SkAutoTUnref<GrFragmentProcessor> conv(GrConvolutionEffect::CreateGaussian(
|
||||
paint.getProcessorDataManager(), texture, direction, radius, sigma, useBounds, bounds));
|
||||
texture, direction, radius, sigma, useBounds, bounds));
|
||||
paint.addColorFragmentProcessor(conv);
|
||||
drawContext->drawNonAARectToRect(rt, clip, paint, SkMatrix::I(), dstRect, srcRect);
|
||||
}
|
||||
@ -79,7 +79,6 @@ static void convolve_gaussian_2d(GrDrawContext* drawContext,
|
||||
SkIPoint kernelOffset = SkIPoint::Make(radiusX, radiusY);
|
||||
GrPaint paint;
|
||||
SkAutoTUnref<GrFragmentProcessor> conv(GrMatrixConvolutionEffect::CreateGaussian(
|
||||
paint.getProcessorDataManager(),
|
||||
texture, bounds, size, 1.0, 0.0, kernelOffset,
|
||||
useBounds ? GrTextureDomain::kClamp_Mode : GrTextureDomain::kIgnore_Mode,
|
||||
true, sigmaX, sigmaY));
|
||||
@ -209,8 +208,7 @@ GrTexture* GaussianBlur(GrContext* context,
|
||||
matrix.mapRect(&domain, rect);
|
||||
domain.inset(i < scaleFactorX ? SK_ScalarHalf / srcTexture->width() : 0.0f,
|
||||
i < scaleFactorY ? SK_ScalarHalf / srcTexture->height() : 0.0f);
|
||||
SkAutoTUnref<GrFragmentProcessor> fp( GrTextureDomainEffect::Create(
|
||||
paint.getProcessorDataManager(),
|
||||
SkAutoTUnref<GrFragmentProcessor> fp(GrTextureDomainEffect::Create(
|
||||
srcTexture,
|
||||
matrix,
|
||||
domain,
|
||||
|
@ -321,8 +321,7 @@ protected:
|
||||
bool canFilterImageGPU() const override { return true; }
|
||||
bool filterImageGPU(Proxy*, const SkBitmap& src, const Context&,
|
||||
SkBitmap* result, SkIPoint* offset) const override;
|
||||
virtual GrFragmentProcessor* getFragmentProcessor(GrProcessorDataManager*,
|
||||
GrTexture*,
|
||||
virtual GrFragmentProcessor* getFragmentProcessor(GrTexture*,
|
||||
const SkMatrix&,
|
||||
const SkIRect& bounds,
|
||||
BoundaryMode boundaryMode) const = 0;
|
||||
@ -352,8 +351,7 @@ void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext,
|
||||
const SkIRect& bounds) const {
|
||||
SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar(bounds.y()));
|
||||
GrPaint paint;
|
||||
GrFragmentProcessor* fp = this->getFragmentProcessor(paint.getProcessorDataManager(), src,
|
||||
matrix, bounds, boundaryMode);
|
||||
GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, bounds, boundaryMode);
|
||||
paint.addColorFragmentProcessor(fp)->unref();
|
||||
drawContext->drawNonAARectToRect(dst->asRenderTarget(), clip, paint, SkMatrix::I(),
|
||||
dstRect, srcRect);
|
||||
@ -449,8 +447,8 @@ protected:
|
||||
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
|
||||
SkBitmap* result, SkIPoint* offset) const override;
|
||||
#if SK_SUPPORT_GPU
|
||||
GrFragmentProcessor* getFragmentProcessor(GrProcessorDataManager*, GrTexture*, const SkMatrix&,
|
||||
const SkIRect& bounds, BoundaryMode) const override;
|
||||
GrFragmentProcessor* getFragmentProcessor(GrTexture*, const SkMatrix&, const SkIRect& bounds,
|
||||
BoundaryMode) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -477,8 +475,8 @@ protected:
|
||||
bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
|
||||
SkBitmap* result, SkIPoint* offset) const override;
|
||||
#if SK_SUPPORT_GPU
|
||||
GrFragmentProcessor* getFragmentProcessor(GrProcessorDataManager*, GrTexture*, const SkMatrix&,
|
||||
const SkIRect& bounds, BoundaryMode) const override;
|
||||
GrFragmentProcessor* getFragmentProcessor(GrTexture*, const SkMatrix&, const SkIRect& bounds,
|
||||
BoundaryMode) const override;
|
||||
#endif
|
||||
|
||||
private:
|
||||
@ -492,8 +490,8 @@ private:
|
||||
|
||||
class GrLightingEffect : public GrSingleTextureEffect {
|
||||
public:
|
||||
GrLightingEffect(GrProcessorDataManager*, GrTexture* texture, const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale, const SkMatrix& matrix, BoundaryMode boundaryMode);
|
||||
GrLightingEffect(GrTexture* texture, const SkImageFilterLight* light, SkScalar surfaceScale,
|
||||
const SkMatrix& matrix, BoundaryMode boundaryMode);
|
||||
virtual ~GrLightingEffect();
|
||||
|
||||
const SkImageFilterLight* light() const { return fLight; }
|
||||
@ -520,15 +518,13 @@ private:
|
||||
|
||||
class GrDiffuseLightingEffect : public GrLightingEffect {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
static GrFragmentProcessor* Create(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
SkScalar kd,
|
||||
BoundaryMode boundaryMode) {
|
||||
return new GrDiffuseLightingEffect(procDataManager, texture, light, surfaceScale, matrix,
|
||||
kd, boundaryMode);
|
||||
return new GrDiffuseLightingEffect(texture, light, surfaceScale, matrix, kd, boundaryMode);
|
||||
}
|
||||
|
||||
const char* name() const override { return "DiffuseLighting"; }
|
||||
@ -542,8 +538,7 @@ private:
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
GrDiffuseLightingEffect(GrProcessorDataManager*,
|
||||
GrTexture* texture,
|
||||
GrDiffuseLightingEffect(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
@ -557,16 +552,15 @@ private:
|
||||
|
||||
class GrSpecularLightingEffect : public GrLightingEffect {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
static GrFragmentProcessor* Create(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
SkScalar ks,
|
||||
SkScalar shininess,
|
||||
BoundaryMode boundaryMode) {
|
||||
return new GrSpecularLightingEffect(procDataManager, texture, light, surfaceScale, matrix,
|
||||
ks, shininess, boundaryMode);
|
||||
return new GrSpecularLightingEffect(texture, light, surfaceScale, matrix, ks, shininess,
|
||||
boundaryMode);
|
||||
}
|
||||
|
||||
const char* name() const override { return "SpecularLighting"; }
|
||||
@ -581,8 +575,7 @@ private:
|
||||
|
||||
bool onIsEqual(const GrFragmentProcessor&) const override;
|
||||
|
||||
GrSpecularLightingEffect(GrProcessorDataManager*,
|
||||
GrTexture* texture,
|
||||
GrSpecularLightingEffect(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
@ -1255,15 +1248,14 @@ void SkDiffuseLightingImageFilter::toString(SkString* str) const {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
GrFragmentProcessor* SkDiffuseLightingImageFilter::getFragmentProcessor(
|
||||
GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const SkIRect&,
|
||||
BoundaryMode boundaryMode
|
||||
) const {
|
||||
SkScalar scale = SkScalarMul(this->surfaceScale(), SkIntToScalar(255));
|
||||
return GrDiffuseLightingEffect::Create(procDataManager, texture, this->light(), scale, matrix,
|
||||
this->kd(), boundaryMode);
|
||||
return GrDiffuseLightingEffect::Create(texture, this->light(), scale, matrix, this->kd(),
|
||||
boundaryMode);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1396,14 +1388,13 @@ void SkSpecularLightingImageFilter::toString(SkString* str) const {
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
GrFragmentProcessor* SkSpecularLightingImageFilter::getFragmentProcessor(
|
||||
GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const SkIRect&,
|
||||
BoundaryMode boundaryMode) const {
|
||||
SkScalar scale = SkScalarMul(this->surfaceScale(), SkIntToScalar(255));
|
||||
return GrSpecularLightingEffect::Create(procDataManager, texture, this->light(), scale, matrix,
|
||||
this->ks(), this->shininess(), boundaryMode);
|
||||
return GrSpecularLightingEffect::Create(texture, this->light(), scale, matrix, this->ks(),
|
||||
this->shininess(), boundaryMode);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1575,13 +1566,12 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrLightingEffect::GrLightingEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrLightingEffect::GrLightingEffect(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
BoundaryMode boundaryMode)
|
||||
: INHERITED(procDataManager, texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
|
||||
: INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
|
||||
, fLight(light)
|
||||
, fSurfaceScale(surfaceScale)
|
||||
, fFilterMatrix(matrix)
|
||||
@ -1605,14 +1595,13 @@ bool GrLightingEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrDiffuseLightingEffect::GrDiffuseLightingEffect(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
SkScalar kd,
|
||||
BoundaryMode boundaryMode)
|
||||
: INHERITED(procDataManager, texture, light, surfaceScale, matrix, boundaryMode), fKD(kd) {
|
||||
: INHERITED(texture, light, surfaceScale, matrix, boundaryMode), fKD(kd) {
|
||||
this->initClassID<GrDiffuseLightingEffect>();
|
||||
}
|
||||
|
||||
@ -1642,8 +1631,7 @@ const GrFragmentProcessor* GrDiffuseLightingEffect::TestCreate(GrProcessorTestDa
|
||||
matrix[i] = d->fRandom->nextUScalar1();
|
||||
}
|
||||
BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount);
|
||||
return GrDiffuseLightingEffect::Create(d->fProcDataManager,
|
||||
d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
|
||||
return GrDiffuseLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
|
||||
light, surfaceScale, matrix, kd, mode);
|
||||
}
|
||||
|
||||
@ -1804,15 +1792,14 @@ void GrGLDiffuseLightingEffect::onSetData(const GrGLProgramDataManager& pdman,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrSpecularLightingEffect::GrSpecularLightingEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrSpecularLightingEffect::GrSpecularLightingEffect(GrTexture* texture,
|
||||
const SkImageFilterLight* light,
|
||||
SkScalar surfaceScale,
|
||||
const SkMatrix& matrix,
|
||||
SkScalar ks,
|
||||
SkScalar shininess,
|
||||
BoundaryMode boundaryMode)
|
||||
: INHERITED(procDataManager, texture, light, surfaceScale, matrix, boundaryMode)
|
||||
: INHERITED(texture, light, surfaceScale, matrix, boundaryMode)
|
||||
, fKS(ks)
|
||||
, fShininess(shininess) {
|
||||
this->initClassID<GrSpecularLightingEffect>();
|
||||
@ -1846,8 +1833,7 @@ const GrFragmentProcessor* GrSpecularLightingEffect::TestCreate(GrProcessorTestD
|
||||
matrix[i] = d->fRandom->nextUScalar1();
|
||||
}
|
||||
BoundaryMode mode = static_cast<BoundaryMode>(d->fRandom->nextU() % kBoundaryModeCount);
|
||||
return GrSpecularLightingEffect::Create(d->fProcDataManager,
|
||||
d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
|
||||
return GrSpecularLightingEffect::Create(d->fTextures[GrProcessorUnitTest::kAlphaTextureIdx],
|
||||
light, surfaceScale, matrix, ks, shininess, mode);
|
||||
}
|
||||
|
||||
|
@ -108,8 +108,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const {
|
||||
const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const {
|
||||
|
||||
return LumaColorFilterEffect::Create();
|
||||
}
|
||||
|
@ -23,8 +23,7 @@
|
||||
class GrMagnifierEffect : public GrSingleTextureEffect {
|
||||
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
static GrFragmentProcessor* Create(GrTexture* texture,
|
||||
const SkRect& bounds,
|
||||
float xOffset,
|
||||
float yOffset,
|
||||
@ -32,8 +31,8 @@ public:
|
||||
float yInvZoom,
|
||||
float xInvInset,
|
||||
float yInvInset) {
|
||||
return new GrMagnifierEffect(procDataManager, texture, bounds, xOffset, yOffset, xInvZoom,
|
||||
yInvZoom, xInvInset, yInvInset);
|
||||
return new GrMagnifierEffect(texture, bounds, xOffset, yOffset, xInvZoom, yInvZoom, xInvInset,
|
||||
yInvInset);
|
||||
}
|
||||
|
||||
virtual ~GrMagnifierEffect() {};
|
||||
@ -54,8 +53,7 @@ public:
|
||||
float y_inv_inset() const { return fYInvInset; }
|
||||
|
||||
private:
|
||||
GrMagnifierEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrMagnifierEffect(GrTexture* texture,
|
||||
const SkRect& bounds,
|
||||
float xOffset,
|
||||
float yOffset,
|
||||
@ -63,7 +61,7 @@ private:
|
||||
float yInvZoom,
|
||||
float xInvInset,
|
||||
float yInvInset)
|
||||
: INHERITED(procDataManager, texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
|
||||
: INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
|
||||
, fBounds(bounds)
|
||||
, fXOffset(xOffset)
|
||||
, fYOffset(yOffset)
|
||||
@ -207,7 +205,6 @@ const GrFragmentProcessor* GrMagnifierEffect::TestCreate(GrProcessorTestData* d)
|
||||
uint32_t inset = d->fRandom->nextULessThan(kMaxInset);
|
||||
|
||||
GrFragmentProcessor* effect = GrMagnifierEffect::Create(
|
||||
d->fProcDataManager,
|
||||
texture,
|
||||
SkRect::MakeWH(SkIntToScalar(kMaxWidth), SkIntToScalar(kMaxHeight)),
|
||||
(float) width / texture->width(),
|
||||
@ -263,7 +260,6 @@ SkMagnifierImageFilter::SkMagnifierImageFilter(const SkRect& srcRect, SkScalar i
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture, const SkMatrix&,
|
||||
const SkIRect&bounds) const {
|
||||
if (fp) {
|
||||
@ -278,8 +274,7 @@ bool SkMagnifierImageFilter::asFragmentProcessor(GrFragmentProcessor** fp,
|
||||
SkIntToScalar(texture->width()) / bounds.width(),
|
||||
SkIntToScalar(texture->height()) / bounds.height());
|
||||
SkScalar invInset = fInset > 0 ? SkScalarInvert(fInset) : SK_Scalar1;
|
||||
*fp = GrMagnifierEffect::Create(procDataManager,
|
||||
texture,
|
||||
*fp = GrMagnifierEffect::Create(texture,
|
||||
effectBounds,
|
||||
fSrcRect.x() / texture->width(),
|
||||
yOffset / texture->height(),
|
||||
|
@ -347,7 +347,6 @@ static GrTextureDomain::Mode convert_tilemodes(
|
||||
}
|
||||
|
||||
bool SkMatrixConvolutionImageFilter::asFragmentProcessor(GrFragmentProcessor** fp,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const SkMatrix&,
|
||||
const SkIRect& bounds) const {
|
||||
@ -355,8 +354,7 @@ bool SkMatrixConvolutionImageFilter::asFragmentProcessor(GrFragmentProcessor** f
|
||||
return fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE;
|
||||
}
|
||||
SkASSERT(fKernelSize.width() * fKernelSize.height() <= MAX_KERNEL_SIZE);
|
||||
*fp = GrMatrixConvolutionEffect::Create(procDataManager,
|
||||
texture,
|
||||
*fp = GrMatrixConvolutionEffect::Create(texture,
|
||||
bounds,
|
||||
fKernelSize,
|
||||
fKernel,
|
||||
|
@ -205,15 +205,14 @@ public:
|
||||
kDilate_MorphologyType,
|
||||
};
|
||||
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
|
||||
Direction dir, int radius, MorphologyType type) {
|
||||
return new GrMorphologyEffect(procDataManager, tex, dir, radius, type);
|
||||
static GrFragmentProcessor* Create(GrTexture* tex, Direction dir, int radius,
|
||||
MorphologyType type) {
|
||||
return new GrMorphologyEffect(tex, dir, radius, type);
|
||||
}
|
||||
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
|
||||
Direction dir, int radius, MorphologyType type,
|
||||
float bounds[2]) {
|
||||
return new GrMorphologyEffect(procDataManager, tex, dir, radius, type, bounds);
|
||||
static GrFragmentProcessor* Create(GrTexture* tex, Direction dir, int radius,
|
||||
MorphologyType type, float bounds[2]) {
|
||||
return new GrMorphologyEffect(tex, dir, radius, type, bounds);
|
||||
}
|
||||
|
||||
virtual ~GrMorphologyEffect();
|
||||
@ -239,8 +238,8 @@ private:
|
||||
|
||||
void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
|
||||
|
||||
GrMorphologyEffect(GrProcessorDataManager*, GrTexture*, Direction, int radius, MorphologyType);
|
||||
GrMorphologyEffect(GrProcessorDataManager*, GrTexture*, Direction, int radius, MorphologyType,
|
||||
GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType);
|
||||
GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType,
|
||||
float bounds[2]);
|
||||
|
||||
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
|
||||
@ -394,23 +393,21 @@ void GrGLMorphologyEffect::onSetData(const GrGLProgramDataManager& pdman,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture,
|
||||
Direction direction,
|
||||
int radius,
|
||||
MorphologyType type)
|
||||
: INHERITED(procDataManager, texture, direction, radius)
|
||||
: INHERITED(texture, direction, radius)
|
||||
, fType(type), fUseRange(false) {
|
||||
this->initClassID<GrMorphologyEffect>();
|
||||
}
|
||||
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrMorphologyEffect::GrMorphologyEffect(GrTexture* texture,
|
||||
Direction direction,
|
||||
int radius,
|
||||
MorphologyType type,
|
||||
float range[2])
|
||||
: INHERITED(procDataManager, texture, direction, radius)
|
||||
: INHERITED(texture, direction, radius)
|
||||
, fType(type), fUseRange(true) {
|
||||
this->initClassID<GrMorphologyEffect>();
|
||||
fRange[0] = range[0];
|
||||
@ -454,7 +451,7 @@ const GrFragmentProcessor* GrMorphologyEffect::TestCreate(GrProcessorTestData* d
|
||||
MorphologyType type = d->fRandom->nextBool() ? GrMorphologyEffect::kErode_MorphologyType :
|
||||
GrMorphologyEffect::kDilate_MorphologyType;
|
||||
|
||||
return GrMorphologyEffect::Create(d->fProcDataManager, d->fTextures[texIdx], dir, radius, type);
|
||||
return GrMorphologyEffect::Create(d->fTextures[texIdx], dir, radius, type);
|
||||
}
|
||||
|
||||
namespace {
|
||||
@ -471,8 +468,7 @@ void apply_morphology_rect(GrDrawContext* drawContext,
|
||||
float bounds[2],
|
||||
Gr1DKernelEffect::Direction direction) {
|
||||
GrPaint paint;
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Create(paint.getProcessorDataManager(),
|
||||
texture,
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture,
|
||||
direction,
|
||||
radius,
|
||||
morphType,
|
||||
@ -491,8 +487,7 @@ void apply_morphology_rect_no_bounds(GrDrawContext* drawContext,
|
||||
GrMorphologyEffect::MorphologyType morphType,
|
||||
Gr1DKernelEffect::Direction direction) {
|
||||
GrPaint paint;
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Create(paint.getProcessorDataManager(),
|
||||
texture,
|
||||
paint.addColorFragmentProcessor(GrMorphologyEffect::Create(texture,
|
||||
direction,
|
||||
radius,
|
||||
morphType))->unref();
|
||||
|
@ -510,13 +510,12 @@ private:
|
||||
|
||||
class GrPerlinNoiseEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
SkPerlinNoiseShader::Type type,
|
||||
static GrFragmentProcessor* Create(SkPerlinNoiseShader::Type type,
|
||||
int numOctaves, bool stitchTiles,
|
||||
SkPerlinNoiseShader::PaintingData* paintingData,
|
||||
GrTexture* permutationsTexture, GrTexture* noiseTexture,
|
||||
const SkMatrix& matrix) {
|
||||
return new GrPerlinNoiseEffect(procDataManager, type, numOctaves, stitchTiles, paintingData,
|
||||
return new GrPerlinNoiseEffect(type, numOctaves, stitchTiles, paintingData,
|
||||
permutationsTexture, noiseTexture, matrix);
|
||||
}
|
||||
|
||||
@ -555,7 +554,7 @@ private:
|
||||
inout->setToUnknown(GrInvariantOutput::kWillNot_ReadInput);
|
||||
}
|
||||
|
||||
GrPerlinNoiseEffect(GrProcessorDataManager*, SkPerlinNoiseShader::Type type,
|
||||
GrPerlinNoiseEffect(SkPerlinNoiseShader::Type type,
|
||||
int numOctaves, bool stitchTiles,
|
||||
SkPerlinNoiseShader::PaintingData* paintingData,
|
||||
GrTexture* permutationsTexture, GrTexture* noiseTexture,
|
||||
@ -610,8 +609,7 @@ const GrFragmentProcessor* GrPerlinNoiseEffect::TestCreate(GrProcessorTestData*
|
||||
GrPaint grPaint;
|
||||
return shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), nullptr,
|
||||
kNone_SkFilterQuality,
|
||||
grPaint.getProcessorDataManager());
|
||||
kNone_SkFilterQuality);
|
||||
}
|
||||
|
||||
GrGLPerlinNoise::GrGLPerlinNoise(const GrProcessor& processor)
|
||||
@ -916,8 +914,7 @@ const GrFragmentProcessor* SkPerlinNoiseShader::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* externalLocalMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix localMatrix = this->getLocalMatrix();
|
||||
@ -955,8 +952,7 @@ const GrFragmentProcessor* SkPerlinNoiseShader::asFragmentProcessor(
|
||||
m.setTranslateY(-localMatrix.getTranslateY() + SK_Scalar1);
|
||||
if ((permutationsTexture) && (noiseTexture)) {
|
||||
SkAutoTUnref<GrFragmentProcessor> inner(
|
||||
GrPerlinNoiseEffect::Create(procDataManager,
|
||||
fType,
|
||||
GrPerlinNoiseEffect::Create(fType,
|
||||
fNumOctaves,
|
||||
fStitchTiles,
|
||||
paintingData,
|
||||
|
@ -48,8 +48,7 @@ public:
|
||||
SkColorFilter* newComposed(const SkColorFilter* inner) const override;
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
GrProcessorDataManager*) const override;
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*) const override;
|
||||
#endif
|
||||
|
||||
void filterSpan(const SkPMColor src[], int count, SkPMColor dst[]) const override;
|
||||
@ -564,13 +563,12 @@ const GrFragmentProcessor* ColorTableEffect::TestCreate(GrProcessorTestData* d)
|
||||
(flags & (1 << 3)) ? luts[3] : nullptr
|
||||
));
|
||||
|
||||
const GrFragmentProcessor* fp = filter->asFragmentProcessor(d->fContext, d->fProcDataManager);
|
||||
const GrFragmentProcessor* fp = filter->asFragmentProcessor(d->fContext);
|
||||
SkASSERT(fp);
|
||||
return fp;
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* context,
|
||||
GrProcessorDataManager*) const {
|
||||
const GrFragmentProcessor* SkTable_ColorFilter::asFragmentProcessor(GrContext* context) const {
|
||||
SkBitmap bitmap;
|
||||
this->asComponentTable(&bitmap);
|
||||
|
||||
|
@ -124,7 +124,7 @@ void SkXfermodeImageFilter::toString(SkString* str) const {
|
||||
#if SK_SUPPORT_GPU
|
||||
|
||||
bool SkXfermodeImageFilter::canFilterImageGPU() const {
|
||||
return fMode && fMode->asFragmentProcessor(nullptr, nullptr, nullptr) && !cropRectIsSet();
|
||||
return fMode && fMode->asFragmentProcessor(nullptr, nullptr) && !cropRectIsSet();
|
||||
}
|
||||
|
||||
bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
|
||||
@ -170,8 +170,8 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
|
||||
SkMatrix bgMatrix;
|
||||
bgMatrix.setIDiv(backgroundTex->width(), backgroundTex->height());
|
||||
SkAutoTUnref<const GrFragmentProcessor> bgFP(
|
||||
GrSimpleTextureEffect::Create(paint.getProcessorDataManager(), backgroundTex, bgMatrix));
|
||||
if (!fMode || !fMode->asFragmentProcessor(&xferFP, paint.getProcessorDataManager(), bgFP)) {
|
||||
GrSimpleTextureEffect::Create(backgroundTex, bgMatrix));
|
||||
if (!fMode || !fMode->asFragmentProcessor(&xferFP, bgFP)) {
|
||||
// canFilterImageGPU() should've taken care of this
|
||||
SkASSERT(false);
|
||||
return false;
|
||||
@ -186,7 +186,6 @@ bool SkXfermodeImageFilter::filterImageGPU(Proxy* proxy,
|
||||
src.getBounds(&srcRect);
|
||||
|
||||
SkAutoTUnref<GrFragmentProcessor> foregroundDomain(GrTextureDomainEffect::Create(
|
||||
paint.getProcessorDataManager(),
|
||||
foregroundTex, foregroundMatrix,
|
||||
GrTextureDomain::MakeTexelDomain(foregroundTex, foreground.bounds()),
|
||||
GrTextureDomain::kDecal_Mode,
|
||||
|
@ -1058,7 +1058,6 @@ void GrGLGradientEffect::emitColor(GrGLFPBuilder* builder,
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrGradientEffect::GrGradientEffect(GrContext* ctx,
|
||||
GrProcessorDataManager*,
|
||||
const SkGradientShaderBase& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tileMode) {
|
||||
|
@ -327,7 +327,6 @@ class GrGradientEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
|
||||
GrGradientEffect(GrContext* ctx,
|
||||
GrProcessorDataManager*,
|
||||
const SkGradientShaderBase& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tileMode);
|
||||
|
@ -468,11 +468,10 @@ class GrLinearGradient : public GrGradientEffect {
|
||||
public:
|
||||
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkLinearGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm) {
|
||||
return new GrLinearGradient(ctx, procDataManager, shader, matrix, tm);
|
||||
return new GrLinearGradient(ctx, shader, matrix, tm);
|
||||
}
|
||||
|
||||
virtual ~GrLinearGradient() { }
|
||||
@ -481,11 +480,10 @@ public:
|
||||
|
||||
private:
|
||||
GrLinearGradient(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkLinearGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm) {
|
||||
: INHERITED(ctx, shader, matrix, tm) {
|
||||
this->initClassID<GrLinearGradient>();
|
||||
}
|
||||
|
||||
@ -520,7 +518,7 @@ const GrFragmentProcessor* GrLinearGradient::TestCreate(GrProcessorTestData* d)
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -542,8 +540,7 @@ const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewm,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix matrix;
|
||||
@ -560,7 +557,7 @@ const GrFragmentProcessor* SkLinearGradient::asFragmentProcessor(
|
||||
matrix.postConcat(fPtsToUnit);
|
||||
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(
|
||||
GrLinearGradient::Create(context, procDataManager, *this, matrix, fTileMode));
|
||||
GrLinearGradient::Create(context, *this, matrix, fTileMode));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -440,11 +440,10 @@ private:
|
||||
class GrRadialGradient : public GrGradientEffect {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkRadialGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm) {
|
||||
return new GrRadialGradient(ctx, procDataManager, shader, matrix, tm);
|
||||
return new GrRadialGradient(ctx, shader, matrix, tm);
|
||||
}
|
||||
|
||||
virtual ~GrRadialGradient() { }
|
||||
@ -453,11 +452,10 @@ public:
|
||||
|
||||
private:
|
||||
GrRadialGradient(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkRadialGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm) {
|
||||
: INHERITED(ctx, shader, matrix, tm) {
|
||||
this->initClassID<GrRadialGradient>();
|
||||
}
|
||||
|
||||
@ -492,7 +490,7 @@ const GrFragmentProcessor* GrRadialGradient::TestCreate(GrProcessorTestData* d)
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -515,8 +513,7 @@ const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality) const {
|
||||
SkASSERT(context);
|
||||
|
||||
SkMatrix matrix;
|
||||
@ -532,7 +529,7 @@ const GrFragmentProcessor* SkRadialGradient::asFragmentProcessor(
|
||||
}
|
||||
matrix.postConcat(fPtsToUnit);
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(
|
||||
GrRadialGradient::Create(context, procDataManager, *this, matrix, fTileMode));
|
||||
GrRadialGradient::Create(context, *this, matrix, fTileMode));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -191,9 +191,9 @@ private:
|
||||
|
||||
class GrSweepGradient : public GrGradientEffect {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrContext* ctx, GrProcessorDataManager* procDataManager,
|
||||
const SkSweepGradient& shader, const SkMatrix& m) {
|
||||
return new GrSweepGradient(ctx, procDataManager, shader, m);
|
||||
static GrFragmentProcessor* Create(GrContext* ctx, const SkSweepGradient& shader,
|
||||
const SkMatrix& m) {
|
||||
return new GrSweepGradient(ctx, shader, m);
|
||||
}
|
||||
virtual ~GrSweepGradient() { }
|
||||
|
||||
@ -201,10 +201,9 @@ public:
|
||||
|
||||
private:
|
||||
GrSweepGradient(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkSweepGradient& shader,
|
||||
const SkMatrix& matrix)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, SkShader::kClamp_TileMode) {
|
||||
: INHERITED(ctx, shader, matrix, SkShader::kClamp_TileMode) {
|
||||
this->initClassID<GrSweepGradient>();
|
||||
}
|
||||
|
||||
@ -238,8 +237,7 @@ const GrFragmentProcessor* GrSweepGradient::TestCreate(GrProcessorTestData* d) {
|
||||
colors, stops, colorCount));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom),
|
||||
NULL, kNone_SkFilterQuality,
|
||||
d->fProcDataManager);
|
||||
NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -273,8 +271,7 @@ const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality) const {
|
||||
|
||||
SkMatrix matrix;
|
||||
if (!this->getLocalMatrix().invert(&matrix)) {
|
||||
@ -290,7 +287,7 @@ const GrFragmentProcessor* SkSweepGradient::asFragmentProcessor(
|
||||
matrix.postConcat(fPtsToUnit);
|
||||
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(
|
||||
GrSweepGradient::Create(context, procDataManager, *this, matrix));
|
||||
GrSweepGradient::Create(context, *this, matrix));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
SK_TO_STRING_OVERRIDE()
|
||||
|
@ -364,13 +364,11 @@ const GrFragmentProcessor* SkTwoPointConicalGradient::asFragmentProcessor(
|
||||
GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager* procDataManager) const {
|
||||
SkFilterQuality) const {
|
||||
SkASSERT(context);
|
||||
SkASSERT(fPtsToUnit.isIdentity());
|
||||
SkAutoTUnref<const GrFragmentProcessor> inner(
|
||||
Gr2PtConicalGradientEffect::Create(context, procDataManager, *this, fTileMode,
|
||||
localMatrix));
|
||||
Gr2PtConicalGradientEffect::Create(context, *this, fTileMode, localMatrix));
|
||||
return GrFragmentProcessor::MulOutputByInputAlpha(inner);
|
||||
}
|
||||
|
||||
|
@ -63,8 +63,7 @@ public:
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*,
|
||||
const SkMatrix&,
|
||||
const SkMatrix*,
|
||||
SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
SkFilterQuality) const override;
|
||||
#endif
|
||||
bool isOpaque() const override;
|
||||
|
||||
|
@ -59,11 +59,10 @@ class Edge2PtConicalEffect : public GrGradientEffect {
|
||||
public:
|
||||
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm) {
|
||||
return new Edge2PtConicalEffect(ctx, procDataManager, shader, matrix, tm);
|
||||
return new Edge2PtConicalEffect(ctx, shader, matrix, tm);
|
||||
}
|
||||
|
||||
virtual ~Edge2PtConicalEffect() {}
|
||||
@ -91,11 +90,10 @@ private:
|
||||
}
|
||||
|
||||
Edge2PtConicalEffect(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm),
|
||||
: INHERITED(ctx, shader, matrix, tm),
|
||||
fCenterX1(shader.getCenterX1()),
|
||||
fRadius0(shader.getStartRadius()),
|
||||
fDiffRadius(shader.getDiffRadius()){
|
||||
@ -210,7 +208,7 @@ const GrFragmentProcessor* Edge2PtConicalEffect::TestCreate(GrProcessorTestData*
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -368,12 +366,11 @@ class FocalOutside2PtConicalEffect : public GrGradientEffect {
|
||||
public:
|
||||
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
SkScalar focalX) {
|
||||
return new FocalOutside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, focalX);
|
||||
return new FocalOutside2PtConicalEffect(ctx, shader, matrix, tm, focalX);
|
||||
}
|
||||
|
||||
virtual ~FocalOutside2PtConicalEffect() { }
|
||||
@ -398,12 +395,11 @@ private:
|
||||
}
|
||||
|
||||
FocalOutside2PtConicalEffect(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
SkScalar focalX)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm)
|
||||
: INHERITED(ctx, shader, matrix, tm)
|
||||
, fFocalX(focalX)
|
||||
, fIsFlipped(shader.isFlippedGrad()) {
|
||||
this->initClassID<FocalOutside2PtConicalEffect>();
|
||||
@ -486,7 +482,7 @@ const GrFragmentProcessor* FocalOutside2PtConicalEffect::TestCreate(GrProcessorT
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -579,12 +575,11 @@ class FocalInside2PtConicalEffect : public GrGradientEffect {
|
||||
public:
|
||||
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
SkScalar focalX) {
|
||||
return new FocalInside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, focalX);
|
||||
return new FocalInside2PtConicalEffect(ctx, shader, matrix, tm, focalX);
|
||||
}
|
||||
|
||||
virtual ~FocalInside2PtConicalEffect() {}
|
||||
@ -609,12 +604,11 @@ private:
|
||||
}
|
||||
|
||||
FocalInside2PtConicalEffect(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
SkScalar focalX)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm), fFocalX(focalX) {
|
||||
: INHERITED(ctx, shader, matrix, tm), fFocalX(focalX) {
|
||||
this->initClassID<FocalInside2PtConicalEffect>();
|
||||
}
|
||||
|
||||
@ -694,7 +688,7 @@ const GrFragmentProcessor* FocalInside2PtConicalEffect::TestCreate(GrProcessorTe
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -814,12 +808,11 @@ class CircleInside2PtConicalEffect : public GrGradientEffect {
|
||||
public:
|
||||
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
const CircleConicalInfo& info) {
|
||||
return new CircleInside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, info);
|
||||
return new CircleInside2PtConicalEffect(ctx, shader, matrix, tm, info);
|
||||
}
|
||||
|
||||
virtual ~CircleInside2PtConicalEffect() {}
|
||||
@ -848,12 +841,11 @@ private:
|
||||
}
|
||||
|
||||
CircleInside2PtConicalEffect(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
const CircleConicalInfo& info)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm), fInfo(info) {
|
||||
: INHERITED(ctx, shader, matrix, tm), fInfo(info) {
|
||||
this->initClassID<CircleInside2PtConicalEffect>();
|
||||
}
|
||||
|
||||
@ -937,7 +929,7 @@ const GrFragmentProcessor* CircleInside2PtConicalEffect::TestCreate(GrProcessorT
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(d->fContext,
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality, d->fProcDataManager);
|
||||
GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -1026,12 +1018,11 @@ class CircleOutside2PtConicalEffect : public GrGradientEffect {
|
||||
public:
|
||||
|
||||
static GrFragmentProcessor* Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
const CircleConicalInfo& info) {
|
||||
return new CircleOutside2PtConicalEffect(ctx, procDataManager, shader, matrix, tm, info);
|
||||
return new CircleOutside2PtConicalEffect(ctx, shader, matrix, tm, info);
|
||||
}
|
||||
|
||||
virtual ~CircleOutside2PtConicalEffect() {}
|
||||
@ -1063,12 +1054,11 @@ private:
|
||||
}
|
||||
|
||||
CircleOutside2PtConicalEffect(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
const SkMatrix& matrix,
|
||||
SkShader::TileMode tm,
|
||||
const CircleConicalInfo& info)
|
||||
: INHERITED(ctx, procDataManager, shader, matrix, tm), fInfo(info) {
|
||||
: INHERITED(ctx, shader, matrix, tm), fInfo(info) {
|
||||
this->initClassID<CircleOutside2PtConicalEffect>();
|
||||
if (shader.getStartRadius() != shader.getEndRadius()) {
|
||||
fTLimit = shader.getStartRadius() / (shader.getStartRadius() - shader.getEndRadius());
|
||||
@ -1165,8 +1155,7 @@ const GrFragmentProcessor* CircleOutside2PtConicalEffect::TestCreate(GrProcessor
|
||||
colors, stops, colorCount,
|
||||
tm));
|
||||
const GrFragmentProcessor* fp = shader->asFragmentProcessor(
|
||||
d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality,
|
||||
d->fProcDataManager);
|
||||
d->fContext,GrTest::TestMatrix(d->fRandom), NULL, kNone_SkFilterQuality);
|
||||
GrAlwaysAssert(fp);
|
||||
return fp;
|
||||
}
|
||||
@ -1278,7 +1267,6 @@ void GLCircleOutside2PtConicalEffect::GenKey(const GrProcessor& processor,
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
|
||||
GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
SkShader::TileMode tm,
|
||||
const SkMatrix* localMatrix) {
|
||||
@ -1298,14 +1286,12 @@ GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
|
||||
SkScalar focalX;
|
||||
ConicalType type = set_matrix_focal_conical(shader, &matrix, &focalX);
|
||||
if (type == kInside_ConicalType) {
|
||||
return FocalInside2PtConicalEffect::Create(ctx, procDataManager, shader, matrix, tm,
|
||||
focalX);
|
||||
return FocalInside2PtConicalEffect::Create(ctx, shader, matrix, tm, focalX);
|
||||
} else if(type == kEdge_ConicalType) {
|
||||
set_matrix_edge_conical(shader, &matrix);
|
||||
return Edge2PtConicalEffect::Create(ctx, procDataManager, shader, matrix, tm);
|
||||
return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm);
|
||||
} else {
|
||||
return FocalOutside2PtConicalEffect::Create(ctx, procDataManager, shader, matrix, tm,
|
||||
focalX);
|
||||
return FocalOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, focalX);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1313,14 +1299,12 @@ GrFragmentProcessor* Gr2PtConicalGradientEffect::Create(GrContext* ctx,
|
||||
ConicalType type = set_matrix_circle_conical(shader, &matrix, &info);
|
||||
|
||||
if (type == kInside_ConicalType) {
|
||||
return CircleInside2PtConicalEffect::Create(ctx, procDataManager, shader, matrix, tm,
|
||||
info);
|
||||
return CircleInside2PtConicalEffect::Create(ctx, shader, matrix, tm, info);
|
||||
} else if (type == kEdge_ConicalType) {
|
||||
set_matrix_edge_conical(shader, &matrix);
|
||||
return Edge2PtConicalEffect::Create(ctx, procDataManager, shader, matrix, tm);
|
||||
return Edge2PtConicalEffect::Create(ctx, shader, matrix, tm);
|
||||
} else {
|
||||
return CircleOutside2PtConicalEffect::Create(ctx, procDataManager, shader, matrix, tm,
|
||||
info);
|
||||
return CircleOutside2PtConicalEffect::Create(ctx, shader, matrix, tm, info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,8 +18,7 @@ namespace Gr2PtConicalGradientEffect {
|
||||
* Creates an effect that produces a two point conical gradient based on the
|
||||
* shader passed in.
|
||||
*/
|
||||
GrFragmentProcessor* Create(GrContext* ctx,GrProcessorDataManager* procDataManager,
|
||||
const SkTwoPointConicalGradient& shader,
|
||||
GrFragmentProcessor* Create(GrContext* ctx, const SkTwoPointConicalGradient& shader,
|
||||
SkShader::TileMode tm, const SkMatrix* localMatrix);
|
||||
};
|
||||
|
||||
|
@ -36,9 +36,8 @@ static bool draw_mask(GrDrawContext* drawContext,
|
||||
matrix.setTranslate(-maskRect.fLeft, -maskRect.fTop);
|
||||
matrix.postIDiv(mask->width(), mask->height());
|
||||
|
||||
grp->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(grp->getProcessorDataManager(),
|
||||
mask, matrix,
|
||||
kDevice_GrCoordSet))->unref();
|
||||
grp->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(mask, matrix,
|
||||
kDevice_GrCoordSet))->unref();
|
||||
|
||||
SkMatrix inverse;
|
||||
if (!viewMatrix.invert(&inverse)) {
|
||||
|
@ -47,8 +47,7 @@ void setup_drawstate_aaclip(const GrPipelineBuilder& pipelineBuilder,
|
||||
SkIRect domainTexels = SkIRect::MakeWH(devBound.width(), devBound.height());
|
||||
// This could be a long-lived effect that is cached with the alpha-mask.
|
||||
arfps->addCoverageFragmentProcessor(
|
||||
GrTextureDomainEffect::Create(arfps->getProcessorDataManager(),
|
||||
result,
|
||||
GrTextureDomainEffect::Create(result,
|
||||
mat,
|
||||
GrTextureDomain::MakeTexelDomain(result, domainTexels),
|
||||
GrTextureDomain::kDecal_Mode,
|
||||
@ -481,8 +480,7 @@ void GrClipMaskManager::mergeMask(GrPipelineBuilder* pipelineBuilder,
|
||||
sampleM.setIDiv(srcMask->width(), srcMask->height());
|
||||
|
||||
pipelineBuilder->addCoverageFragmentProcessor(
|
||||
GrTextureDomainEffect::Create(pipelineBuilder->getProcessorDataManager(),
|
||||
srcMask,
|
||||
GrTextureDomainEffect::Create(srcMask,
|
||||
sampleM,
|
||||
GrTextureDomain::MakeTexelDomain(srcMask, srcBound),
|
||||
GrTextureDomain::kDecal_Mode,
|
||||
|
@ -387,8 +387,8 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
|
||||
textureMatrix.setIDiv(tempTexture->width(), tempTexture->height());
|
||||
GrPaint paint;
|
||||
if (applyPremulToSrc) {
|
||||
fp.reset(this->createUPMToPMEffect(paint.getProcessorDataManager(), tempTexture,
|
||||
tempDrawInfo.fSwapRAndB, textureMatrix));
|
||||
fp.reset(this->createUPMToPMEffect(tempTexture, tempDrawInfo.fSwapRAndB,
|
||||
textureMatrix));
|
||||
// If premultiplying was the only reason for the draw, fall back to a straight write.
|
||||
if (!fp) {
|
||||
if (GrGpu::kCallerPrefersDraw_DrawPreference == drawPreference) {
|
||||
@ -400,8 +400,7 @@ bool GrContext::writeSurfacePixels(GrSurface* surface,
|
||||
}
|
||||
if (tempTexture) {
|
||||
if (!fp) {
|
||||
fp.reset(GrConfigConversionEffect::Create(
|
||||
paint.getProcessorDataManager(), tempTexture, tempDrawInfo.fSwapRAndB,
|
||||
fp.reset(GrConfigConversionEffect::Create(tempTexture, tempDrawInfo.fSwapRAndB,
|
||||
GrConfigConversionEffect::kNone_PMConversion, textureMatrix));
|
||||
if (!fp) {
|
||||
return false;
|
||||
@ -525,8 +524,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
|
||||
GrPaint paint;
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp;
|
||||
if (unpremul) {
|
||||
fp.reset(this->createPMToUPMEffect(
|
||||
paint.getProcessorDataManager(), src->asTexture(), tempDrawInfo.fSwapRAndB,
|
||||
fp.reset(this->createPMToUPMEffect(src->asTexture(), tempDrawInfo.fSwapRAndB,
|
||||
textureMatrix));
|
||||
if (fp) {
|
||||
unpremul = false; // we no longer need to do this on CPU after the read back.
|
||||
@ -537,8 +535,7 @@ bool GrContext::readSurfacePixels(GrSurface* src,
|
||||
}
|
||||
}
|
||||
if (!fp && temp) {
|
||||
fp.reset(GrConfigConversionEffect::Create(
|
||||
paint.getProcessorDataManager(), src->asTexture(), tempDrawInfo.fSwapRAndB,
|
||||
fp.reset(GrConfigConversionEffect::Create(src->asTexture(), tempDrawInfo.fSwapRAndB,
|
||||
GrConfigConversionEffect::kNone_PMConversion, textureMatrix));
|
||||
}
|
||||
if (fp) {
|
||||
@ -714,8 +711,7 @@ void GrContext::testPMConversionsIfNecessary(uint32_t flags) {
|
||||
}
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* GrContext::createPMToUPMEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const GrFragmentProcessor* GrContext::createPMToUPMEffect(GrTexture* texture,
|
||||
bool swapRAndB,
|
||||
const SkMatrix& matrix) const {
|
||||
// We should have already called this->testPMConversionsIfNecessary().
|
||||
@ -723,15 +719,13 @@ const GrFragmentProcessor* GrContext::createPMToUPMEffect(GrProcessorDataManager
|
||||
GrConfigConversionEffect::PMConversion pmToUPM =
|
||||
static_cast<GrConfigConversionEffect::PMConversion>(fPMToUPMConversion);
|
||||
if (GrConfigConversionEffect::kNone_PMConversion != pmToUPM) {
|
||||
return GrConfigConversionEffect::Create(procDataManager, texture, swapRAndB, pmToUPM,
|
||||
matrix);
|
||||
return GrConfigConversionEffect::Create(texture, swapRAndB, pmToUPM, matrix);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrTexture* texture,
|
||||
bool swapRAndB,
|
||||
const SkMatrix& matrix) const {
|
||||
// We should have already called this->testPMConversionsIfNecessary().
|
||||
@ -739,8 +733,7 @@ const GrFragmentProcessor* GrContext::createUPMToPMEffect(GrProcessorDataManager
|
||||
GrConfigConversionEffect::PMConversion upmToPM =
|
||||
static_cast<GrConfigConversionEffect::PMConversion>(fUPMToPMConversion);
|
||||
if (GrConfigConversionEffect::kNone_PMConversion != upmToPM) {
|
||||
return GrConfigConversionEffect::Create(procDataManager, texture, swapRAndB, upmToPM,
|
||||
matrix);
|
||||
return GrConfigConversionEffect::Create(texture, swapRAndB, upmToPM, matrix);
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -22,26 +22,24 @@ void GrPaint::setCoverageSetOpXPFactory(SkRegion::Op regionOp, bool invertCovera
|
||||
}
|
||||
|
||||
void GrPaint::addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
matrix))->unref();
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
|
||||
}
|
||||
|
||||
void GrPaint::addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
matrix))->unref();
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
|
||||
}
|
||||
|
||||
void GrPaint::addColorTextureProcessor(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const GrTextureParams& params) {
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture,
|
||||
matrix, params))->unref();
|
||||
}
|
||||
|
||||
void GrPaint::addCoverageTextureProcessor(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const GrTextureParams& params) {
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture,
|
||||
matrix, params))->unref();
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "GrClip.h"
|
||||
#include "GrGpuResourceRef.h"
|
||||
#include "GrProcOptInfo.h"
|
||||
#include "GrProcessorDataManager.h"
|
||||
#include "GrRenderTarget.h"
|
||||
#include "GrStencil.h"
|
||||
#include "GrXferProcessor.h"
|
||||
@ -80,34 +79,30 @@ public:
|
||||
* Creates a GrSimpleTextureEffect that uses local coords as texture coordinates.
|
||||
*/
|
||||
void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
matrix))->unref();
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
|
||||
}
|
||||
|
||||
void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
matrix))->unref();
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
|
||||
}
|
||||
|
||||
void addColorTextureProcessor(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const GrTextureParams& params) {
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
matrix,
|
||||
this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix,
|
||||
params))->unref();
|
||||
}
|
||||
|
||||
void addCoverageTextureProcessor(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const GrTextureParams& params) {
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(&fProcDataManager, texture,
|
||||
matrix, params))->unref();
|
||||
this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix,
|
||||
params))->unref();
|
||||
}
|
||||
|
||||
/**
|
||||
* When this object is destroyed it will remove any color/coverage FPs from the pipeline builder
|
||||
* and also remove any additions to the GrProcessorDataManager that were added after its
|
||||
* constructor.
|
||||
* that were added after its constructor.
|
||||
* This class can transiently modify its "const" GrPipelineBuilder object but will restore it
|
||||
* when done - so it is notionally "const" correct.
|
||||
*/
|
||||
@ -131,12 +126,8 @@ public:
|
||||
|
||||
bool isSet() const { return SkToBool(fPipelineBuilder); }
|
||||
|
||||
GrProcessorDataManager* getProcessorDataManager() {
|
||||
SkASSERT(this->isSet());
|
||||
return fPipelineBuilder->getProcessorDataManager();
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* addCoverageFragmentProcessor(const GrFragmentProcessor* processor) {
|
||||
const GrFragmentProcessor* addCoverageFragmentProcessor(
|
||||
const GrFragmentProcessor* processor) {
|
||||
SkASSERT(this->isSet());
|
||||
return fPipelineBuilder->addCoverageFragmentProcessor(processor);
|
||||
}
|
||||
@ -389,9 +380,6 @@ public:
|
||||
void setClip(const GrClip& clip) { fClip = clip; }
|
||||
const GrClip& clip() const { return fClip; }
|
||||
|
||||
GrProcessorDataManager* getProcessorDataManager() { return &fProcDataManager; }
|
||||
const GrProcessorDataManager* processorDataManager() const { return &fProcDataManager; }
|
||||
|
||||
private:
|
||||
// Calculating invariant color / coverage information is expensive, so we partially cache the
|
||||
// results.
|
||||
@ -412,7 +400,6 @@ private:
|
||||
|
||||
typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArray;
|
||||
|
||||
GrProcessorDataManager fProcDataManager;
|
||||
SkAutoTUnref<GrRenderTarget> fRenderTarget;
|
||||
uint32_t fFlags;
|
||||
GrStencilSettings fStencilSettings;
|
||||
|
@ -1,8 +0,0 @@
|
||||
/*
|
||||
* Copyright 2015 Google Inc.
|
||||
*
|
||||
* Use of this source code is governed by a BSD-style license that can be
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "GrProcessorDataManager.h"
|
@ -367,8 +367,7 @@ void GrSWMaskHelper::DrawToTargetWithPathMask(GrTexture* texture,
|
||||
maskMatrix.preTranslate(SkIntToScalar(-rect.fLeft), SkIntToScalar(-rect.fTop));
|
||||
|
||||
pipelineBuilder->addCoverageFragmentProcessor(
|
||||
GrSimpleTextureEffect::Create(pipelineBuilder->getProcessorDataManager(),
|
||||
texture,
|
||||
GrSimpleTextureEffect::Create(texture,
|
||||
maskMatrix,
|
||||
GrTextureParams::kNone_FilterMode,
|
||||
kDevice_GrCoordSet))->unref();
|
||||
|
@ -122,8 +122,7 @@ GrTexture* GrYUVProvider::refAsTexture(GrContext* ctx, const GrSurfaceDesc& desc
|
||||
|
||||
GrPaint paint;
|
||||
SkAutoTUnref<GrFragmentProcessor> yuvToRgbProcessor(
|
||||
GrYUVtoRGBEffect::Create(paint.getProcessorDataManager(),
|
||||
yuvTextures[0],
|
||||
GrYUVtoRGBEffect::Create(yuvTextures[0],
|
||||
yuvTextures[1],
|
||||
yuvTextures[2],
|
||||
yuvInfo.fSize,
|
||||
|
@ -996,12 +996,9 @@ static void draw_aa_bitmap(GrDrawContext* drawContext, GrContext* context,
|
||||
// Create and insert texture effect
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp;
|
||||
if (doBicubic) {
|
||||
fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), texture,
|
||||
SkMatrix::I(),
|
||||
tm));
|
||||
fp.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tm));
|
||||
} else {
|
||||
fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager(), texture,
|
||||
SkMatrix::I(), params));
|
||||
fp.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), params));
|
||||
}
|
||||
|
||||
if (kAlpha_8_SkColorType == bitmapPtr->colorType()) {
|
||||
@ -1330,11 +1327,9 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
|
||||
}
|
||||
textureDomain.setLTRB(left, top, right, bottom);
|
||||
if (bicubic) {
|
||||
fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), texture,
|
||||
SkMatrix::I(), textureDomain));
|
||||
fp.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), textureDomain));
|
||||
} else {
|
||||
fp.reset(GrTextureDomainEffect::Create(grPaint.getProcessorDataManager(),
|
||||
texture,
|
||||
fp.reset(GrTextureDomainEffect::Create(texture,
|
||||
SkMatrix::I(),
|
||||
textureDomain,
|
||||
GrTextureDomain::kClamp_Mode,
|
||||
@ -1343,11 +1338,9 @@ void SkGpuDevice::internalDrawBitmap(const SkBitmap& bitmap,
|
||||
} else if (bicubic) {
|
||||
SkASSERT(GrTextureParams::kNone_FilterMode == params.filterMode());
|
||||
SkShader::TileMode tileModes[2] = { params.getTileModeX(), params.getTileModeY() };
|
||||
fp.reset(GrBicubicEffect::Create(grPaint.getProcessorDataManager(), texture, SkMatrix::I(),
|
||||
tileModes));
|
||||
fp.reset(GrBicubicEffect::Create(texture, SkMatrix::I(), tileModes));
|
||||
} else {
|
||||
fp.reset(GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager(), texture,
|
||||
SkMatrix::I(), params));
|
||||
fp.reset(GrSimpleTextureEffect::Create(texture, SkMatrix::I(), params));
|
||||
}
|
||||
|
||||
if (kAlpha_8_SkColorType == bitmap.colorType()) {
|
||||
@ -1432,7 +1425,7 @@ void SkGpuDevice::drawSprite(const SkDraw& draw, const SkBitmap& bitmap,
|
||||
|
||||
GrPaint grPaint;
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp(
|
||||
GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager(), texture, SkMatrix::I()));
|
||||
GrSimpleTextureEffect::Create(texture, SkMatrix::I()));
|
||||
if (alphaOnly) {
|
||||
fp.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp));
|
||||
} else {
|
||||
@ -1551,7 +1544,7 @@ void SkGpuDevice::drawDevice(const SkDraw& draw, SkBaseDevice* device,
|
||||
|
||||
GrPaint grPaint;
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp(
|
||||
GrSimpleTextureEffect::Create(grPaint.getProcessorDataManager(), devTex, SkMatrix::I()));
|
||||
GrSimpleTextureEffect::Create(devTex, SkMatrix::I()));
|
||||
if (GrPixelConfigIsAlphaOnly(devTex->config())) {
|
||||
// Can this happen?
|
||||
fp.reset(GrFragmentProcessor::MulOutputByInputUnpremulColor(fp));
|
||||
|
@ -703,8 +703,7 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
||||
shaderFP = *shaderProcessor;
|
||||
} else if (const SkShader* shader = skPaint.getShader()) {
|
||||
aufp.reset(shader->asFragmentProcessor(context, viewM, nullptr,
|
||||
skPaint.getFilterQuality(),
|
||||
grPaint->getProcessorDataManager()));
|
||||
skPaint.getFilterQuality()));
|
||||
shaderFP = aufp;
|
||||
if (!shaderFP) {
|
||||
return false;
|
||||
@ -792,7 +791,7 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context,
|
||||
grPaint->setColor(SkColorToPremulGrColor(colorFilter->filterColor(skPaint.getColor())));
|
||||
} else {
|
||||
SkAutoTUnref<const GrFragmentProcessor> cfFP(
|
||||
colorFilter->asFragmentProcessor(context, grPaint->getProcessorDataManager()));
|
||||
colorFilter->asFragmentProcessor(context));
|
||||
if (cfFP) {
|
||||
grPaint->addColorFragmentProcessor(cfFP);
|
||||
} else {
|
||||
|
@ -28,11 +28,10 @@ public:
|
||||
kY_Direction,
|
||||
};
|
||||
|
||||
Gr1DKernelEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
Gr1DKernelEffect(GrTexture* texture,
|
||||
Direction direction,
|
||||
int radius)
|
||||
: INHERITED(procDataManager, texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
|
||||
: INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture))
|
||||
, fDirection(direction)
|
||||
, fRadius(radius) {}
|
||||
|
||||
|
@ -126,24 +126,21 @@ static inline void convert_row_major_scalar_coeffs_to_column_major_floats(float
|
||||
}
|
||||
}
|
||||
|
||||
GrBicubicEffect::GrBicubicEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
|
||||
const SkScalar coefficients[16],
|
||||
const SkMatrix &matrix,
|
||||
const SkShader::TileMode tileModes[2])
|
||||
: INHERITED(procDataManager, texture, matrix,
|
||||
GrTextureParams(tileModes, GrTextureParams::kNone_FilterMode))
|
||||
: INHERITED(texture, matrix, GrTextureParams(tileModes, GrTextureParams::kNone_FilterMode))
|
||||
, fDomain(GrTextureDomain::IgnoredDomain()) {
|
||||
this->initClassID<GrBicubicEffect>();
|
||||
convert_row_major_scalar_coeffs_to_column_major_floats(fCoefficients, coefficients);
|
||||
}
|
||||
|
||||
GrBicubicEffect::GrBicubicEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrBicubicEffect::GrBicubicEffect(GrTexture* texture,
|
||||
const SkScalar coefficients[16],
|
||||
const SkMatrix &matrix,
|
||||
const SkRect& domain)
|
||||
: INHERITED(procDataManager, texture, matrix,
|
||||
: INHERITED(texture, matrix,
|
||||
GrTextureParams(SkShader::kClamp_TileMode, GrTextureParams::kNone_FilterMode))
|
||||
, fDomain(domain, GrTextureDomain::kClamp_Mode) {
|
||||
this->initClassID<GrBicubicEffect>();
|
||||
@ -182,7 +179,7 @@ const GrFragmentProcessor* GrBicubicEffect::TestCreate(GrProcessorTestData* d) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
coefficients[i] = d->fRandom->nextSScalar1();
|
||||
}
|
||||
return GrBicubicEffect::Create(d->fProcDataManager, d->fTextures[texIdx], coefficients);
|
||||
return GrBicubicEffect::Create(d->fTextures[texIdx], coefficients);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -32,16 +32,15 @@ public:
|
||||
/**
|
||||
* Create a simple filter effect with custom bicubic coefficients and optional domain.
|
||||
*/
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
|
||||
const SkScalar coefficients[16],
|
||||
static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficients[16],
|
||||
const SkRect* domain = nullptr) {
|
||||
if (nullptr == domain) {
|
||||
static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode,
|
||||
SkShader::kClamp_TileMode };
|
||||
return Create(procDataManager, tex, coefficients,
|
||||
GrCoordTransform::MakeDivByTextureWHMatrix(tex), kTileModes);
|
||||
return Create(tex, coefficients, GrCoordTransform::MakeDivByTextureWHMatrix(tex),
|
||||
kTileModes);
|
||||
} else {
|
||||
return new GrBicubicEffect(procDataManager, tex, coefficients,
|
||||
return new GrBicubicEffect(tex, coefficients,
|
||||
GrCoordTransform::MakeDivByTextureWHMatrix(tex), *domain);
|
||||
}
|
||||
}
|
||||
@ -49,28 +48,27 @@ public:
|
||||
/**
|
||||
* Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
|
||||
*/
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
|
||||
const SkMatrix& matrix,
|
||||
static GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& matrix,
|
||||
SkShader::TileMode tileModes[2]) {
|
||||
return Create(procDataManager, tex, gMitchellCoefficients, matrix, tileModes);
|
||||
return Create(tex, gMitchellCoefficients, matrix, tileModes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a filter effect with custom bicubic coefficients, the texture matrix, and the x/y
|
||||
* tilemodes.
|
||||
*/
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
|
||||
const SkScalar coefficients[16], const SkMatrix& matrix,
|
||||
static GrFragmentProcessor* Create(GrTexture* tex, const SkScalar coefficients[16],
|
||||
const SkMatrix& matrix,
|
||||
const SkShader::TileMode tileModes[2]) {
|
||||
return new GrBicubicEffect(procDataManager, tex, coefficients, matrix, tileModes);
|
||||
return new GrBicubicEffect(tex, coefficients, matrix, tileModes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Mitchell filter effect with a texture matrix and a domain.
|
||||
*/
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* tex,
|
||||
const SkMatrix& matrix, const SkRect& domain) {
|
||||
return new GrBicubicEffect(procDataManager, tex, gMitchellCoefficients, matrix, domain);
|
||||
static GrFragmentProcessor* Create(GrTexture* tex, const SkMatrix& matrix,
|
||||
const SkRect& domain) {
|
||||
return new GrBicubicEffect(tex, gMitchellCoefficients, matrix, domain);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,10 +82,10 @@ public:
|
||||
GrTextureParams::FilterMode* filterMode);
|
||||
|
||||
private:
|
||||
GrBicubicEffect(GrProcessorDataManager*, GrTexture*, const SkScalar coefficients[16],
|
||||
const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
|
||||
GrBicubicEffect(GrProcessorDataManager*, GrTexture*, const SkScalar coefficients[16],
|
||||
const SkMatrix &matrix, const SkRect& domain);
|
||||
GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
|
||||
const SkShader::TileMode tileModes[2]);
|
||||
GrBicubicEffect(GrTexture*, const SkScalar coefficients[16], const SkMatrix &matrix,
|
||||
const SkRect& domain);
|
||||
|
||||
GrGLFragmentProcessor* onCreateGLInstance() const override;
|
||||
|
||||
|
@ -96,12 +96,11 @@ private:
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrConfigConversionEffect::GrConfigConversionEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrConfigConversionEffect::GrConfigConversionEffect(GrTexture* texture,
|
||||
bool swapRedAndBlue,
|
||||
PMConversion pmConversion,
|
||||
const SkMatrix& matrix)
|
||||
: INHERITED(procDataManager, texture, matrix)
|
||||
: INHERITED(texture, matrix)
|
||||
, fSwapRedAndBlue(swapRedAndBlue)
|
||||
, fPMConversion(pmConversion) {
|
||||
this->initClassID<GrConfigConversionEffect>();
|
||||
@ -136,8 +135,7 @@ const GrFragmentProcessor* GrConfigConversionEffect::TestCreate(GrProcessorTestD
|
||||
} else {
|
||||
swapRB = d->fRandom->nextBool();
|
||||
}
|
||||
return new GrConfigConversionEffect(d->fProcDataManager,
|
||||
d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx],
|
||||
return new GrConfigConversionEffect(d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx],
|
||||
swapRB, pmConv, GrTest::TestMatrix(d->fRandom));
|
||||
}
|
||||
|
||||
@ -217,11 +215,11 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
||||
GrPaint paint2;
|
||||
GrPaint paint3;
|
||||
SkAutoTUnref<GrFragmentProcessor> pmToUPM1(new GrConfigConversionEffect(
|
||||
paint1.getProcessorDataManager(), dataTex, false, *pmToUPMRule, SkMatrix::I()));
|
||||
dataTex, false, *pmToUPMRule, SkMatrix::I()));
|
||||
SkAutoTUnref<GrFragmentProcessor> upmToPM(new GrConfigConversionEffect(
|
||||
paint2.getProcessorDataManager(), readTex, false, *upmToPMRule, SkMatrix::I()));
|
||||
readTex, false, *upmToPMRule, SkMatrix::I()));
|
||||
SkAutoTUnref<GrFragmentProcessor> pmToUPM2(new GrConfigConversionEffect(
|
||||
paint3.getProcessorDataManager(), tempTex, false, *pmToUPMRule, SkMatrix::I()));
|
||||
tempTex, false, *pmToUPMRule, SkMatrix::I()));
|
||||
|
||||
paint1.addColorFragmentProcessor(pmToUPM1);
|
||||
|
||||
@ -288,8 +286,7 @@ void GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
|
||||
}
|
||||
}
|
||||
|
||||
const GrFragmentProcessor* GrConfigConversionEffect::Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
const GrFragmentProcessor* GrConfigConversionEffect::Create(GrTexture* texture,
|
||||
bool swapRedAndBlue,
|
||||
PMConversion pmConversion,
|
||||
const SkMatrix& matrix) {
|
||||
@ -297,7 +294,7 @@ const GrFragmentProcessor* GrConfigConversionEffect::Create(GrProcessorDataManag
|
||||
// If we returned a GrConfigConversionEffect that was equivalent to a GrSimpleTextureEffect
|
||||
// then we may pollute our texture cache with redundant shaders. So in the case that no
|
||||
// conversions were requested we instead return a GrSimpleTextureEffect.
|
||||
return GrSimpleTextureEffect::Create(procDataManager, texture, matrix);
|
||||
return GrSimpleTextureEffect::Create(texture, matrix);
|
||||
} else {
|
||||
if (kRGBA_8888_GrPixelConfig != texture->config() &&
|
||||
kBGRA_8888_GrPixelConfig != texture->config() &&
|
||||
@ -305,7 +302,6 @@ const GrFragmentProcessor* GrConfigConversionEffect::Create(GrProcessorDataManag
|
||||
// The PM conversions assume colors are 0..255
|
||||
return nullptr;
|
||||
}
|
||||
return new GrConfigConversionEffect(procDataManager, texture, swapRedAndBlue, pmConversion,
|
||||
matrix);
|
||||
return new GrConfigConversionEffect(texture, swapRedAndBlue, pmConversion, matrix);
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ public:
|
||||
kPMConversionCnt
|
||||
};
|
||||
|
||||
static const GrFragmentProcessor* Create(GrProcessorDataManager*, GrTexture*,
|
||||
bool swapRedAndBlue, PMConversion, const SkMatrix&);
|
||||
static const GrFragmentProcessor* Create(GrTexture*, bool swapRedAndBlue, PMConversion,
|
||||
const SkMatrix&);
|
||||
|
||||
const char* name() const override { return "Config Conversion"; }
|
||||
|
||||
@ -51,8 +51,7 @@ public:
|
||||
PMConversion* UPMToPMRule);
|
||||
|
||||
private:
|
||||
GrConfigConversionEffect(GrProcessorDataManager*,
|
||||
GrTexture*,
|
||||
GrConfigConversionEffect(GrTexture*,
|
||||
bool swapRedAndBlue,
|
||||
PMConversion pmConversion,
|
||||
const SkMatrix& matrix);
|
||||
|
@ -145,14 +145,13 @@ void GrGLConvolutionEffect::GenKey(const GrProcessor& processor, const GrGLSLCap
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrConvolutionEffect::GrConvolutionEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
|
||||
Direction direction,
|
||||
int radius,
|
||||
const float* kernel,
|
||||
bool useBounds,
|
||||
float bounds[2])
|
||||
: INHERITED(procDataManager, texture, direction, radius), fUseBounds(useBounds) {
|
||||
: INHERITED(texture, direction, radius), fUseBounds(useBounds) {
|
||||
this->initClassID<GrConvolutionEffect>();
|
||||
SkASSERT(radius <= kMaxKernelRadius);
|
||||
SkASSERT(kernel);
|
||||
@ -163,14 +162,13 @@ GrConvolutionEffect::GrConvolutionEffect(GrProcessorDataManager* procDataManager
|
||||
memcpy(fBounds, bounds, sizeof(fBounds));
|
||||
}
|
||||
|
||||
GrConvolutionEffect::GrConvolutionEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrConvolutionEffect::GrConvolutionEffect(GrTexture* texture,
|
||||
Direction direction,
|
||||
int radius,
|
||||
float gaussianSigma,
|
||||
bool useBounds,
|
||||
float bounds[2])
|
||||
: INHERITED(procDataManager, texture, direction, radius), fUseBounds(useBounds) {
|
||||
: INHERITED(texture, direction, radius), fUseBounds(useBounds) {
|
||||
this->initClassID<GrConvolutionEffect>();
|
||||
SkASSERT(radius <= kMaxKernelRadius);
|
||||
int width = this->width();
|
||||
@ -232,8 +230,7 @@ const GrFragmentProcessor* GrConvolutionEffect::TestCreate(GrProcessorTestData*
|
||||
}
|
||||
|
||||
bool useBounds = d->fRandom->nextBool();
|
||||
return GrConvolutionEffect::Create(d->fProcDataManager,
|
||||
d->fTextures[texIdx],
|
||||
return GrConvolutionEffect::Create(d->fTextures[texIdx],
|
||||
dir,
|
||||
radius,
|
||||
kernel,
|
||||
|
@ -21,27 +21,23 @@ class GrConvolutionEffect : public Gr1DKernelEffect {
|
||||
public:
|
||||
|
||||
/// Convolve with an arbitrary user-specified kernel
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* tex,
|
||||
static GrFragmentProcessor* Create(GrTexture* tex,
|
||||
Direction dir,
|
||||
int halfWidth,
|
||||
const float* kernel,
|
||||
bool useBounds,
|
||||
float bounds[2]) {
|
||||
return new GrConvolutionEffect(procDataManager, tex, dir, halfWidth, kernel, useBounds,
|
||||
bounds);
|
||||
return new GrConvolutionEffect(tex, dir, halfWidth, kernel, useBounds, bounds);
|
||||
}
|
||||
|
||||
/// Convolve with a Gaussian kernel
|
||||
static GrFragmentProcessor* CreateGaussian(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* tex,
|
||||
static GrFragmentProcessor* CreateGaussian(GrTexture* tex,
|
||||
Direction dir,
|
||||
int halfWidth,
|
||||
float gaussianSigma,
|
||||
bool useBounds,
|
||||
float bounds[2]) {
|
||||
return new GrConvolutionEffect(procDataManager, tex, dir, halfWidth, gaussianSigma,
|
||||
useBounds, bounds);
|
||||
return new GrConvolutionEffect(tex, dir, halfWidth, gaussianSigma, useBounds, bounds);
|
||||
}
|
||||
|
||||
virtual ~GrConvolutionEffect();
|
||||
@ -71,16 +67,14 @@ protected:
|
||||
float fBounds[2];
|
||||
|
||||
private:
|
||||
GrConvolutionEffect(GrProcessorDataManager*,
|
||||
GrTexture*, Direction,
|
||||
GrConvolutionEffect(GrTexture*, Direction,
|
||||
int halfWidth,
|
||||
const float* kernel,
|
||||
bool useBounds,
|
||||
float bounds[2]);
|
||||
|
||||
/// Convolve with a Gaussian kernel
|
||||
GrConvolutionEffect(GrProcessorDataManager*,
|
||||
GrTexture*, Direction,
|
||||
GrConvolutionEffect(GrTexture*, Direction,
|
||||
int halfWidth,
|
||||
float gaussianSigma,
|
||||
bool useBounds,
|
||||
|
@ -129,8 +129,7 @@ void GrGLMatrixConvolutionEffect::onSetData(const GrGLProgramDataManager& pdman,
|
||||
fDomain.setData(pdman, conv.domain(), texture.origin());
|
||||
}
|
||||
|
||||
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
const SkScalar* kernel,
|
||||
@ -139,7 +138,7 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrProcessorDataManager* pro
|
||||
const SkIPoint& kernelOffset,
|
||||
GrTextureDomain::Mode tileMode,
|
||||
bool convolveAlpha)
|
||||
: INHERITED(procDataManager, texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)),
|
||||
: INHERITED(texture, GrCoordTransform::MakeDivByTextureWHMatrix(texture)),
|
||||
fKernelSize(kernelSize),
|
||||
fGain(SkScalarToFloat(gain)),
|
||||
fBias(SkScalarToFloat(bias) / 255.0f),
|
||||
@ -179,8 +178,7 @@ bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) cons
|
||||
|
||||
// Static function to create a 2D convolution
|
||||
GrFragmentProcessor*
|
||||
GrMatrixConvolutionEffect::CreateGaussian(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
SkScalar gain,
|
||||
@ -216,8 +214,8 @@ GrMatrixConvolutionEffect::CreateGaussian(GrProcessorDataManager* procDataManage
|
||||
for (int i = 0; i < width * height; ++i) {
|
||||
kernel[i] *= scale;
|
||||
}
|
||||
return new GrMatrixConvolutionEffect(procDataManager, texture, bounds, kernelSize, kernel, gain,
|
||||
bias, kernelOffset, tileMode, convolveAlpha);
|
||||
return new GrMatrixConvolutionEffect(texture, bounds, kernelSize, kernel, gain, bias,
|
||||
kernelOffset, tileMode, convolveAlpha);
|
||||
}
|
||||
|
||||
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
|
||||
@ -243,8 +241,7 @@ const GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(GrProcessorTest
|
||||
GrTextureDomain::Mode tileMode =
|
||||
static_cast<GrTextureDomain::Mode>(d->fRandom->nextRangeU(0, 2));
|
||||
bool convolveAlpha = d->fRandom->nextBool();
|
||||
return GrMatrixConvolutionEffect::Create(d->fProcDataManager,
|
||||
d->fTextures[texIdx],
|
||||
return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx],
|
||||
bounds,
|
||||
kernelSize,
|
||||
kernel.get(),
|
||||
|
@ -18,8 +18,7 @@
|
||||
|
||||
class GrMatrixConvolutionEffect : public GrSingleTextureEffect {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
static GrFragmentProcessor* Create(GrTexture* texture,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
const SkScalar* kernel,
|
||||
@ -28,12 +27,11 @@ public:
|
||||
const SkIPoint& kernelOffset,
|
||||
GrTextureDomain::Mode tileMode,
|
||||
bool convolveAlpha) {
|
||||
return new GrMatrixConvolutionEffect(procDataManager, texture, bounds, kernelSize, kernel,
|
||||
gain, bias, kernelOffset, tileMode, convolveAlpha);
|
||||
return new GrMatrixConvolutionEffect(texture, bounds, kernelSize, kernel, gain, bias,
|
||||
kernelOffset, tileMode, convolveAlpha);
|
||||
}
|
||||
|
||||
static GrFragmentProcessor* CreateGaussian(GrProcessorDataManager*,
|
||||
GrTexture* texture,
|
||||
static GrFragmentProcessor* CreateGaussian(GrTexture* texture,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
SkScalar gain,
|
||||
@ -58,8 +56,7 @@ public:
|
||||
const char* name() const override { return "MatrixConvolution"; }
|
||||
|
||||
private:
|
||||
GrMatrixConvolutionEffect(GrProcessorDataManager*,
|
||||
GrTexture*,
|
||||
GrMatrixConvolutionEffect(GrTexture*,
|
||||
const SkIRect& bounds,
|
||||
const SkISize& kernelSize,
|
||||
const SkScalar* kernel,
|
||||
|
@ -72,6 +72,5 @@ const GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(GrProcessorTestData
|
||||
GrCoordSet coordSet = kCoordSets[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kCoordSets))];
|
||||
|
||||
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
|
||||
return GrSimpleTextureEffect::Create(d->fProcDataManager, d->fTextures[texIdx], matrix,
|
||||
coordSet);
|
||||
return GrSimpleTextureEffect::Create(d->fTextures[texIdx], matrix, coordSet);
|
||||
}
|
||||
|
@ -21,29 +21,25 @@ class GrInvariantOutput;
|
||||
class GrSimpleTextureEffect : public GrSingleTextureEffect {
|
||||
public:
|
||||
/* unfiltered, clamp mode */
|
||||
static const GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* tex,
|
||||
static const GrFragmentProcessor* Create(GrTexture* tex,
|
||||
const SkMatrix& matrix,
|
||||
GrCoordSet coordSet = kLocal_GrCoordSet) {
|
||||
return new GrSimpleTextureEffect(procDataManager, tex, matrix,
|
||||
GrTextureParams::kNone_FilterMode, coordSet);
|
||||
return new GrSimpleTextureEffect(tex, matrix, GrTextureParams::kNone_FilterMode, coordSet);
|
||||
}
|
||||
|
||||
/* clamp mode */
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* tex,
|
||||
static GrFragmentProcessor* Create(GrTexture* tex,
|
||||
const SkMatrix& matrix,
|
||||
GrTextureParams::FilterMode filterMode,
|
||||
GrCoordSet coordSet = kLocal_GrCoordSet) {
|
||||
return new GrSimpleTextureEffect(procDataManager, tex, matrix, filterMode, coordSet);
|
||||
return new GrSimpleTextureEffect(tex, matrix, filterMode, coordSet);
|
||||
}
|
||||
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* tex,
|
||||
static GrFragmentProcessor* Create(GrTexture* tex,
|
||||
const SkMatrix& matrix,
|
||||
const GrTextureParams& p,
|
||||
GrCoordSet coordSet = kLocal_GrCoordSet) {
|
||||
return new GrSimpleTextureEffect(procDataManager, tex, matrix, p, coordSet);
|
||||
return new GrSimpleTextureEffect(tex, matrix, p, coordSet);
|
||||
}
|
||||
|
||||
virtual ~GrSimpleTextureEffect() {}
|
||||
@ -51,21 +47,19 @@ public:
|
||||
const char* name() const override { return "SimpleTexture"; }
|
||||
|
||||
private:
|
||||
GrSimpleTextureEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrSimpleTextureEffect(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
GrTextureParams::FilterMode filterMode,
|
||||
GrCoordSet coordSet)
|
||||
: GrSingleTextureEffect(procDataManager, texture, matrix, filterMode, coordSet) {
|
||||
: GrSingleTextureEffect(texture, matrix, filterMode, coordSet) {
|
||||
this->initClassID<GrSimpleTextureEffect>();
|
||||
}
|
||||
|
||||
GrSimpleTextureEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrSimpleTextureEffect(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const GrTextureParams& params,
|
||||
GrCoordSet coordSet)
|
||||
: GrSingleTextureEffect(procDataManager, texture, matrix, params, coordSet) {
|
||||
: GrSingleTextureEffect(texture, matrix, params, coordSet) {
|
||||
this->initClassID<GrSimpleTextureEffect>();
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,7 @@
|
||||
|
||||
#include "effects/GrSingleTextureEffect.h"
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
|
||||
const SkMatrix& m,
|
||||
GrCoordSet coordSet)
|
||||
: fCoordTransform(coordSet, m, texture, GrTextureParams::kNone_FilterMode)
|
||||
@ -17,8 +16,7 @@ GrSingleTextureEffect::GrSingleTextureEffect(GrProcessorDataManager* procDataMan
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
}
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
|
||||
const SkMatrix& m,
|
||||
GrTextureParams::FilterMode filterMode,
|
||||
GrCoordSet coordSet)
|
||||
@ -28,8 +26,7 @@ GrSingleTextureEffect::GrSingleTextureEffect(GrProcessorDataManager* procDataMan
|
||||
this->addTextureAccess(&fTextureAccess);
|
||||
}
|
||||
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrSingleTextureEffect::GrSingleTextureEffect(GrTexture* texture,
|
||||
const SkMatrix& m,
|
||||
const GrTextureParams& params,
|
||||
GrCoordSet coordSet)
|
||||
|
@ -25,14 +25,11 @@ public:
|
||||
|
||||
protected:
|
||||
/** unfiltered, clamp mode */
|
||||
GrSingleTextureEffect(GrProcessorDataManager*, GrTexture*, const SkMatrix&,
|
||||
GrCoordSet = kLocal_GrCoordSet);
|
||||
GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrCoordSet = kLocal_GrCoordSet);
|
||||
/** clamp mode */
|
||||
GrSingleTextureEffect(GrProcessorDataManager*, GrTexture*, const SkMatrix&,
|
||||
GrTextureParams::FilterMode filterMode,
|
||||
GrSingleTextureEffect(GrTexture*, const SkMatrix&, GrTextureParams::FilterMode filterMode,
|
||||
GrCoordSet = kLocal_GrCoordSet);
|
||||
GrSingleTextureEffect(GrProcessorDataManager*,
|
||||
GrTexture*,
|
||||
GrSingleTextureEffect(GrTexture*,
|
||||
const SkMatrix&,
|
||||
const GrTextureParams&,
|
||||
GrCoordSet = kLocal_GrCoordSet);
|
||||
|
@ -215,8 +215,7 @@ void GrGLTextureDomainEffect::GenKey(const GrProcessor& processor, const GrGLSLC
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrFragmentProcessor* GrTextureDomainEffect::Create(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrFragmentProcessor* GrTextureDomainEffect::Create(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const SkRect& domain,
|
||||
GrTextureDomain::Mode mode,
|
||||
@ -225,21 +224,19 @@ GrFragmentProcessor* GrTextureDomainEffect::Create(GrProcessorDataManager* procD
|
||||
static const SkRect kFullRect = {0, 0, SK_Scalar1, SK_Scalar1};
|
||||
if (GrTextureDomain::kIgnore_Mode == mode ||
|
||||
(GrTextureDomain::kClamp_Mode == mode && domain.contains(kFullRect))) {
|
||||
return GrSimpleTextureEffect::Create(procDataManager, texture, matrix, filterMode);
|
||||
return GrSimpleTextureEffect::Create(texture, matrix, filterMode);
|
||||
} else {
|
||||
return new GrTextureDomainEffect(procDataManager, texture, matrix, domain, mode, filterMode,
|
||||
coordSet);
|
||||
return new GrTextureDomainEffect(texture, matrix, domain, mode, filterMode, coordSet);
|
||||
}
|
||||
}
|
||||
|
||||
GrTextureDomainEffect::GrTextureDomainEffect(GrProcessorDataManager* procDataManager,
|
||||
GrTexture* texture,
|
||||
GrTextureDomainEffect::GrTextureDomainEffect(GrTexture* texture,
|
||||
const SkMatrix& matrix,
|
||||
const SkRect& domain,
|
||||
GrTextureDomain::Mode mode,
|
||||
GrTextureParams::FilterMode filterMode,
|
||||
GrCoordSet coordSet)
|
||||
: GrSingleTextureEffect(procDataManager, texture, matrix, filterMode, coordSet)
|
||||
: GrSingleTextureEffect(texture, matrix, filterMode, coordSet)
|
||||
, fTextureDomain(domain, mode) {
|
||||
SkASSERT(mode != GrTextureDomain::kRepeat_Mode ||
|
||||
filterMode == GrTextureParams::kNone_FilterMode);
|
||||
@ -293,8 +290,7 @@ const GrFragmentProcessor* GrTextureDomainEffect::TestCreate(GrProcessorTestData
|
||||
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
|
||||
bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false;
|
||||
GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoordSet;
|
||||
return GrTextureDomainEffect::Create(d->fProcDataManager,
|
||||
d->fTextures[texIdx],
|
||||
return GrTextureDomainEffect::Create(d->fTextures[texIdx],
|
||||
matrix,
|
||||
domain,
|
||||
mode,
|
||||
|
@ -160,8 +160,7 @@ protected:
|
||||
class GrTextureDomainEffect : public GrSingleTextureEffect {
|
||||
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager*,
|
||||
GrTexture*,
|
||||
static GrFragmentProcessor* Create(GrTexture*,
|
||||
const SkMatrix&,
|
||||
const SkRect& domain,
|
||||
GrTextureDomain::Mode,
|
||||
@ -178,8 +177,7 @@ protected:
|
||||
GrTextureDomain fTextureDomain;
|
||||
|
||||
private:
|
||||
GrTextureDomainEffect(GrProcessorDataManager*,
|
||||
GrTexture*,
|
||||
GrTextureDomainEffect(GrTexture*,
|
||||
const SkMatrix&,
|
||||
const SkRect& domain,
|
||||
GrTextureDomain::Mode,
|
||||
|
@ -17,9 +17,9 @@ namespace {
|
||||
|
||||
class YUVtoRGBEffect : public GrFragmentProcessor {
|
||||
public:
|
||||
static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager, GrTexture* yTexture,
|
||||
GrTexture* uTexture, GrTexture* vTexture,
|
||||
const SkISize sizes[3], SkYUVColorSpace colorSpace) {
|
||||
static GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture,
|
||||
GrTexture* vTexture, const SkISize sizes[3],
|
||||
SkYUVColorSpace colorSpace) {
|
||||
SkScalar w[3], h[3];
|
||||
w[0] = SkIntToScalar(sizes[0].fWidth) / SkIntToScalar(yTexture->width());
|
||||
h[0] = SkIntToScalar(sizes[0].fHeight) / SkIntToScalar(yTexture->height());
|
||||
@ -40,8 +40,8 @@ public:
|
||||
(sizes[2].fHeight != sizes[0].fHeight)) ?
|
||||
GrTextureParams::kBilerp_FilterMode :
|
||||
GrTextureParams::kNone_FilterMode;
|
||||
return new YUVtoRGBEffect(procDataManager, yTexture, uTexture, vTexture, yuvMatrix,
|
||||
uvFilterMode, colorSpace);
|
||||
return new YUVtoRGBEffect(yTexture, uTexture, vTexture, yuvMatrix, uvFilterMode,
|
||||
colorSpace);
|
||||
}
|
||||
|
||||
const char* name() const override { return "YUV to RGB"; }
|
||||
@ -104,9 +104,9 @@ public:
|
||||
};
|
||||
|
||||
private:
|
||||
YUVtoRGBEffect(GrProcessorDataManager*, GrTexture* yTexture, GrTexture* uTexture,
|
||||
GrTexture* vTexture, const SkMatrix yuvMatrix[3],
|
||||
GrTextureParams::FilterMode uvFilterMode, SkYUVColorSpace colorSpace)
|
||||
YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
|
||||
const SkMatrix yuvMatrix[3], GrTextureParams::FilterMode uvFilterMode,
|
||||
SkYUVColorSpace colorSpace)
|
||||
: fYTransform(kLocal_GrCoordSet, yuvMatrix[0], yTexture, GrTextureParams::kNone_FilterMode)
|
||||
, fYAccess(yTexture)
|
||||
, fUTransform(kLocal_GrCoordSet, yuvMatrix[1], uTexture, uvFilterMode)
|
||||
@ -172,9 +172,8 @@ const GrGLfloat YUVtoRGBEffect::GLProcessor::kRec709ConversionMatrix[16] = {
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
GrFragmentProcessor*
|
||||
GrYUVtoRGBEffect::Create(GrProcessorDataManager* procDataManager, GrTexture* yTexture,
|
||||
GrTexture* uTexture, GrTexture* vTexture, const SkISize sizes[3],
|
||||
SkYUVColorSpace colorSpace) {
|
||||
SkASSERT(procDataManager && yTexture && uTexture && vTexture && sizes);
|
||||
return YUVtoRGBEffect::Create(procDataManager, yTexture, uTexture, vTexture, sizes, colorSpace);
|
||||
GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
|
||||
const SkISize sizes[3], SkYUVColorSpace colorSpace) {
|
||||
SkASSERT(yTexture && uTexture && vTexture && sizes);
|
||||
return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, sizes, colorSpace);
|
||||
}
|
||||
|
@ -11,16 +11,14 @@
|
||||
#include "SkImageInfo.h"
|
||||
|
||||
class GrFragmentProcessor;
|
||||
class GrProcessorDataManager;
|
||||
class GrTexture;
|
||||
|
||||
namespace GrYUVtoRGBEffect {
|
||||
/**
|
||||
* Creates an effect that performs color conversion from YUV to RGB
|
||||
*/
|
||||
GrFragmentProcessor* Create(GrProcessorDataManager*, GrTexture* yTexture, GrTexture* uTexture,
|
||||
GrTexture* vTexture, const SkISize sizes[3],
|
||||
SkYUVColorSpace colorSpace);
|
||||
GrFragmentProcessor* Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture,
|
||||
const SkISize sizes[3], SkYUVColorSpace colorSpace);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -85,8 +85,7 @@ void SkImageShader::toString(SkString* str) const {
|
||||
const GrFragmentProcessor* SkImageShader::asFragmentProcessor(GrContext* context,
|
||||
const SkMatrix& viewM,
|
||||
const SkMatrix* localMatrix,
|
||||
SkFilterQuality filterQuality,
|
||||
GrProcessorDataManager* mgr) const {
|
||||
SkFilterQuality filterQuality) const {
|
||||
SkMatrix matrix;
|
||||
matrix.setIDiv(fImage->width(), fImage->height());
|
||||
|
||||
@ -130,9 +129,9 @@ const GrFragmentProcessor* SkImageShader::asFragmentProcessor(GrContext* context
|
||||
|
||||
SkAutoTUnref<GrFragmentProcessor> inner;
|
||||
if (doBicubic) {
|
||||
inner.reset(GrBicubicEffect::Create(mgr, texture, matrix, tm));
|
||||
inner.reset(GrBicubicEffect::Create(texture, matrix, tm));
|
||||
} else {
|
||||
inner.reset(GrSimpleTextureEffect::Create(mgr, texture, matrix, params));
|
||||
inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params));
|
||||
}
|
||||
|
||||
if (GrPixelConfigIsAlphaOnly(texture->config())) {
|
||||
|
@ -23,8 +23,7 @@ public:
|
||||
|
||||
#if SK_SUPPORT_GPU
|
||||
const GrFragmentProcessor* asFragmentProcessor(GrContext*, const SkMatrix& viewM,
|
||||
const SkMatrix*, SkFilterQuality,
|
||||
GrProcessorDataManager*) const override;
|
||||
const SkMatrix*, SkFilterQuality) const override;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
|
@ -297,8 +297,7 @@ SkImage* SkImage::NewFromYUVTexturesCopy(GrContext* ctx , SkYUVColorSpace colorS
|
||||
|
||||
GrPaint paint;
|
||||
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
|
||||
paint.addColorFragmentProcessor(GrYUVtoRGBEffect::Create(paint.getProcessorDataManager(),
|
||||
yTex, uTex, vTex, yuvSizes,
|
||||
paint.addColorFragmentProcessor(GrYUVtoRGBEffect::Create(yTex, uTex, vTex, yuvSizes,
|
||||
colorSpace))->unref();
|
||||
|
||||
const SkRect rect = SkRect::MakeWH(SkIntToScalar(dstDesc.fWidth),
|
||||
|
@ -347,8 +347,7 @@ bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
|
||||
SkASSERT(batch);
|
||||
|
||||
GrProcessorDataManager procDataManager;
|
||||
GrProcessorTestData ptd(&random, context, &procDataManager, fGpu->caps(), dummyTextures);
|
||||
GrProcessorTestData ptd(&random, context, fGpu->caps(), dummyTextures);
|
||||
set_random_color_coverage_stages(&pipelineBuilder, &ptd, maxStages);
|
||||
set_random_xpf(&pipelineBuilder, &ptd);
|
||||
set_random_state(&pipelineBuilder, &random);
|
||||
@ -373,9 +372,7 @@ bool GrDrawTarget::programUnitTest(GrContext* context, int maxStages) {
|
||||
for (int j = 0; j < 10; ++j) {
|
||||
SkAutoTUnref<GrDrawBatch> batch(GrRandomDrawBatch(&random, context));
|
||||
SkASSERT(batch);
|
||||
GrProcessorDataManager procDataManager;
|
||||
GrProcessorTestData ptd(&random, context, &procDataManager, this->caps(),
|
||||
dummyTextures);
|
||||
GrProcessorTestData ptd(&random, context, this->caps(), dummyTextures);
|
||||
GrPipelineBuilder builder;
|
||||
builder.setXPFactory(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
|
||||
builder.setRenderTarget(rt);
|
||||
|
@ -102,8 +102,7 @@ static void test_getConstantColorComponents(skiatest::Reporter* reporter, GrCont
|
||||
const GetConstantComponentTestCase& test = filterTests[i];
|
||||
SkAutoTUnref<SkColorFilter> cf(
|
||||
SkColorFilter::CreateModeFilter(test.filterColor, test.filterMode));
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp(
|
||||
cf->asFragmentProcessor(grContext, paint.getProcessorDataManager()));
|
||||
SkAutoTUnref<const GrFragmentProcessor> fp( cf->asFragmentProcessor(grContext));
|
||||
REPORTER_ASSERT(reporter, fp);
|
||||
GrInvariantOutput inout(test.inputColor,
|
||||
static_cast<GrColorComponentFlags>(test.inputComponents),
|
||||
|
Loading…
Reference in New Issue
Block a user