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