aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp5
-rw-r--r--src/gpu/effects/GrConfigConversionEffect.cpp1
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp7
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp7
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp16
-rw-r--r--src/gpu/effects/GrTextureDomain.h3
6 files changed, 22 insertions, 17 deletions
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index 6d8072f231..f7441bc043 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -120,13 +120,14 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
- GrTexture* texture = processor.textureSampler(0).peekTexture();
+ GrSurfaceProxy* proxy = processor.textureSampler(0).proxy();
+ GrTexture* texture = proxy->priv().peekTexture();
float imageIncrement[2];
imageIncrement[0] = 1.0f / texture->width();
imageIncrement[1] = 1.0f / texture->height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
- fDomain.setData(pdman, bicubicEffect.domain(), texture);
+ fDomain.setData(pdman, bicubicEffect.domain(), proxy);
if (SkToBool(bicubicEffect.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, bicubicEffect.colorSpaceXform());
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index e4989de507..e8d04771f5 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -133,6 +133,7 @@ bool GrConfigConversionEffect::TestForPreservingPMConversions(GrContext* context
return false;
}
GrSurfaceDesc desc;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = kSize;
desc.fHeight = kSize;
desc.fConfig = kConfig;
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 4d1a99d83e..1ab9b78cfc 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -121,10 +121,11 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrGaussianConvolutionFragmentProcessor& conv =
processor.cast<GrGaussianConvolutionFragmentProcessor>();
- GrTexture& texture = *conv.textureSampler(0).peekTexture();
+ GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
+ GrTexture& texture = *proxy->priv().peekTexture();
float imageIncrement[2] = {0};
- float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ float ySign = proxy->origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
switch (conv.direction()) {
case Gr1DKernelEffect::kX_Direction:
imageIncrement[0] = 1.0f / texture.width();
@@ -149,7 +150,7 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
pdman.set2f(fBoundsUni, inv * bounds[0], inv * bounds[1]);
} else {
SkScalar inv = SkScalarInvert(SkIntToScalar(texture.height()));
- if (texture.origin() != kTopLeft_GrSurfaceOrigin) {
+ if (proxy->origin() != kTopLeft_GrSurfaceOrigin) {
pdman.set2f(fBoundsUni, 1.0f - (inv * bounds[1]), 1.0f - (inv * bounds[0]));
} else {
pdman.set2f(fBoundsUni, inv * bounds[1], inv * bounds[0]);
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index bc1537c8b4..abfe5b3774 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -131,10 +131,11 @@ void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
- GrTexture* texture = conv.textureSampler(0).peekTexture();
+ GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
+ GrTexture* texture = proxy->priv().peekTexture();
float imageIncrement[2];
- float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
imageIncrement[0] = 1.0f / texture->width();
imageIncrement[1] = ySign / texture->height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
@@ -145,7 +146,7 @@ void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdma
pdman.set4fv(fKernelUni, arrayCount, conv.kernel());
pdman.set1f(fGainUni, conv.gain());
pdman.set1f(fBiasUni, conv.bias());
- fDomain.setData(pdman, conv.domain(), texture);
+ fDomain.setData(pdman, conv.domain(), proxy);
}
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy,
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index a8ce0ab6c5..f2b78586d7 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -161,7 +161,8 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
- GrTexture* tex) {
+ GrSurfaceProxy* proxy) {
+ GrTexture* tex = proxy->priv().peekTexture();
SkASSERT(textureDomain.mode() == fMode);
if (kIgnore_Mode != textureDomain.mode()) {
SkScalar wInv = SK_Scalar1 / tex->width();
@@ -180,7 +181,7 @@ void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
SkASSERT(values[3] >= 0.0f && values[3] <= 1.0f);
// vertical flip if necessary
- if (kBottomLeft_GrSurfaceOrigin == tex->origin()) {
+ if (kBottomLeft_GrSurfaceOrigin == proxy->origin()) {
values[1] = 1.0f - values[1];
values[3] = 1.0f - values[3];
// The top and bottom were just flipped, so correct the ordering
@@ -270,9 +271,9 @@ GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
const GrFragmentProcessor& fp) override {
const GrTextureDomainEffect& tde = fp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = tde.fTextureDomain;
- GrTexture* texture = tde.textureSampler(0).peekTexture();
+ GrSurfaceProxy* proxy = tde.textureSampler(0).proxy();
- fGLDomain.setData(pdman, domain, texture);
+ fGLDomain.setData(pdman, domain, proxy);
if (SkToBool(tde.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, tde.colorSpaceXform());
}
@@ -372,16 +373,17 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
const GrFragmentProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- GrTexture* texture = dstdfp.textureSampler(0).peekTexture();
+ GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy();
+ GrTexture* texture = proxy->priv().peekTexture();
- fGLDomain.setData(pdman, dstdfp.fTextureDomain, texture);
+ fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy);
float iw = 1.f / texture->width();
float ih = 1.f / texture->height();
float scaleAndTransData[4] = {
iw, ih,
-dstdfp.fDeviceSpaceOffset.fX * iw, -dstdfp.fDeviceSpaceOffset.fY * ih
};
- if (texture->origin() == kBottomLeft_GrSurfaceOrigin) {
+ if (proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
scaleAndTransData[1] = -scaleAndTransData[1];
scaleAndTransData[3] = 1 - scaleAndTransData[3];
}
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index cbc55ecdba..8be1a2bc66 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -115,8 +115,7 @@ public:
* texture domain. The rectangle is automatically adjusted to account for the texture's
* origin.
*/
- void setData(const GrGLSLProgramDataManager& pdman, const GrTextureDomain& textureDomain,
- GrTexture* texure);
+ void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&, GrSurfaceProxy*);
enum {
kDomainKeyBits = 2, // See DomainKey().