aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-07-21 14:17:45 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-21 14:17:54 +0000
commit96be9df1300b2281641b038ef11064157f6e0b41 (patch)
tree2d7c80612daa3fd76114fe158fe2857cce9b2cb0 /src/gpu
parent7877d3237826fc4985af3e9d540cff79e408ef34 (diff)
Revert "Reduce dependence on GrSurface's origin field"
This reverts commit 467022b1861033d968195687da15270c208279ff. Reason for revert: GrAHardwareBufferImageGenerator.cpp Original change's description: > Reduce dependence on GrSurface's origin field > > Unfortunately, GrGPU and its ilk are still using the GrSurface's origin a lot. I will clean that up in a second CL. > > Change-Id: Iba729440ce8ea8d24bb7f4e5de55ed576a0f176d > Reviewed-on: https://skia-review.googlesource.com/24700 > Commit-Queue: Robert Phillips <robertphillips@google.com> > Reviewed-by: Brian Salomon <bsalomon@google.com> TBR=bsalomon@google.com,robertphillips@google.com Change-Id: I1b3f5c3b82d250ac164beb1d5c83abb6c3c6ab3b No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/25620 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/GrBackendTextureImageGenerator.cpp2
-rw-r--r--src/gpu/GrBitmapTextureMaker.cpp4
-rw-r--r--src/gpu/GrClipStackClip.cpp8
-rw-r--r--src/gpu/GrContext.cpp8
-rw-r--r--src/gpu/GrDrawOpAtlas.cpp3
-rw-r--r--src/gpu/GrRenderTargetProxy.cpp4
-rw-r--r--src/gpu/GrResourceProvider.cpp9
-rw-r--r--src/gpu/GrResourceProvider.h4
-rw-r--r--src/gpu/GrSoftwarePathRenderer.cpp3
-rw-r--r--src/gpu/GrSurfaceProxy.cpp27
-rw-r--r--src/gpu/GrTextureAdjuster.cpp4
-rw-r--r--src/gpu/GrTextureMaker.cpp5
-rw-r--r--src/gpu/GrTextureProducer.cpp3
-rw-r--r--src/gpu/GrTextureProxy.cpp4
-rw-r--r--src/gpu/GrTextureRenderTargetProxy.cpp9
-rw-r--r--src/gpu/GrTextureRenderTargetProxy.h2
-rw-r--r--src/gpu/GrYUVProvider.cpp9
-rw-r--r--src/gpu/SkGr.cpp4
-rw-r--r--src/gpu/ccpr/GrCCPRPathProcessor.cpp6
-rw-r--r--src/gpu/ccpr/GrCCPRPathProcessor.h1
-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
-rw-r--r--src/gpu/effects/GrTextureStripAtlas.cpp15
27 files changed, 70 insertions, 103 deletions
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 3de6fec85c..dac81681cd 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -165,7 +165,7 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
SkASSERT(fRefHelper->fBorrowingContextID == context->uniqueID());
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), fSurfaceOrigin);
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
if (0 == origin.fX && 0 == origin.fY &&
info.width() == fBackendTexture.width() && info.height() == fBackendTexture.height()) {
diff --git a/src/gpu/GrBitmapTextureMaker.cpp b/src/gpu/GrBitmapTextureMaker.cpp
index 85e791ef90..762b72c811 100644
--- a/src/gpu/GrBitmapTextureMaker.cpp
+++ b/src/gpu/GrBitmapTextureMaker.cpp
@@ -37,8 +37,7 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM
sk_sp<GrTextureProxy> proxy;
if (fOriginalKey.isValid()) {
- proxy = this->context()->resourceProvider()->findProxyByUniqueKey(
- fOriginalKey, kTopLeft_GrSurfaceOrigin);
+ proxy = this->context()->resourceProvider()->findProxyByUniqueKey(fOriginalKey);
if (proxy) {
return proxy;
}
@@ -51,7 +50,6 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM
dstColorSpace);
}
if (proxy && fOriginalKey.isValid()) {
- SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
this->context()->resourceProvider()->assignUniqueKeyToProxy(fOriginalKey, proxy.get());
// MDB TODO (caching): this has to play nice with the GrSurfaceProxy's caching
GrInstallBitmapUniqueKeyInvalidator(fOriginalKey, fBitmap.pixelRef());
diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp
index 0a63e40076..9a93687e50 100644
--- a/src/gpu/GrClipStackClip.cpp
+++ b/src/gpu/GrClipStackClip.cpp
@@ -394,8 +394,7 @@ sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
GrUniqueKey key;
create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
- sk_sp<GrTextureProxy> proxy(resourceProvider->findProxyByUniqueKey(
- key, kBottomLeft_GrSurfaceOrigin));
+ sk_sp<GrTextureProxy> proxy(resourceProvider->findProxyByUniqueKey(key));
if (proxy) {
return proxy;
}
@@ -419,7 +418,6 @@ sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
return nullptr;
}
- SkASSERT(result->origin() == kBottomLeft_GrSurfaceOrigin);
resourceProvider->assignUniqueKeyToProxy(key, result.get());
// MDB TODO (caching): this has to play nice with the GrSurfaceProxy's caching
add_invalidate_on_pop_message(*fStack, reducedClip.elementsGenID(), key);
@@ -433,8 +431,7 @@ sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
GrUniqueKey key;
create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
- sk_sp<GrTextureProxy> proxy(context->resourceProvider()->findProxyByUniqueKey(
- key, kTopLeft_GrSurfaceOrigin));
+ sk_sp<GrTextureProxy> proxy(context->resourceProvider()->findProxyByUniqueKey(key));
if (proxy) {
return proxy;
}
@@ -492,7 +489,6 @@ sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
sk_sp<GrTextureProxy> result(helper.toTextureProxy(context, SkBackingFit::kApprox));
- SkASSERT(result->origin() == kTopLeft_GrSurfaceOrigin);
context->resourceProvider()->assignUniqueKeyToProxy(key, result.get());
// MDB TODO (caching): this has to play nice with the GrSurfaceProxy's caching
add_invalidate_on_pop_message(*fStack, reducedClip.elementsGenID(), key);
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 434744c089..88fe379c37 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -676,7 +676,7 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend
return nullptr;
}
- sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface), origin));
+ sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
if (!proxy) {
return nullptr;
}
@@ -698,7 +698,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
return nullptr;
}
- sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface), origin));
+ sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
if (!proxy) {
return nullptr;
}
@@ -720,7 +720,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
return nullptr;
}
- sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt), origin));
+ sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
if (!proxy) {
return nullptr;
}
@@ -746,7 +746,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
return nullptr;
}
- sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface), origin));
+ sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
if (!proxy) {
return nullptr;
}
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index f4f0883ccf..37bad65a1f 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -39,8 +39,7 @@ std::unique_ptr<GrDrawOpAtlas> GrDrawOpAtlas::Make(GrContext* ctx, GrPixelConfig
// should receive special attention.
// Note: When switching over to the deferred proxy, use the kExact flag to create
// the atlas and assert that the width & height are powers of 2.
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(texture),
- kTopLeft_GrSurfaceOrigin);
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(texture));
if (!proxy) {
return nullptr;
}
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 83809114ff..eef5f3ec31 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -34,8 +34,8 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc
}
// Wrapped version
-GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
- : INHERITED(std::move(surf), origin, SkBackingFit::kExact)
+GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf)
+ : INHERITED(std::move(surf), SkBackingFit::kExact)
, fSampleCnt(fTarget->asRenderTarget()->numStencilSamples())
, fRenderTargetFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
}
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 6061b33e1b..cc9ec2a315 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -140,7 +140,7 @@ sk_sp<GrTextureProxy> GrResourceProvider::createTextureProxy(const GrSurfaceDesc
if (make_info(desc.fWidth, desc.fHeight, desc.fConfig, &srcInfo)) {
sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, 0);
- sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
+ sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
if (proxy) {
sk_sp<GrSurfaceContext> sContext =
context->contextPriv().makeWrappedSurfaceContext(std::move(proxy), nullptr);
@@ -153,7 +153,7 @@ sk_sp<GrTextureProxy> GrResourceProvider::createTextureProxy(const GrSurfaceDesc
}
sk_sp<GrTexture> tex(fGpu->createTexture(desc, budgeted, &mipLevel, 1));
- return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
+ return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
sk_sp<GrTexture> GrResourceProvider::createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
@@ -312,8 +312,7 @@ void GrResourceProvider::assignUniqueKeyToProxy(const GrUniqueKey& key, GrTextur
}
// MDB TODO (caching): this side-steps the issue of texture proxies with unique IDs
-sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey& key,
- GrSurfaceOrigin origin) {
+sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey& key) {
ASSERT_SINGLE_OWNER
sk_sp<GrTexture> texture(this->findAndRefTextureByUniqueKey(key));
@@ -321,7 +320,7 @@ sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey
return nullptr;
}
- return GrSurfaceProxy::MakeWrapped(std::move(texture), origin);
+ return GrSurfaceProxy::MakeWrapped(std::move(texture));
}
const GrBuffer* GrResourceProvider::createPatternedIndexBuffer(const uint16_t* pattern,
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 28207b7a87..44155a834f 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -53,9 +53,7 @@ public:
void assignUniqueKeyToProxy(const GrUniqueKey& key, GrTextureProxy*);
/** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */
- // MDB TODO (caching): If this were actually caching proxies (rather than shallowly
- // wrapping GrSurface caching) we would not need the origin parameter.
- sk_sp<GrTextureProxy> findProxyByUniqueKey(const GrUniqueKey& key, GrSurfaceOrigin);
+ sk_sp<GrTextureProxy> findProxyByUniqueKey(const GrUniqueKey& key);
/**
* Finds a texture that approximately matches the descriptor. Will be at least as large in width
diff --git a/src/gpu/GrSoftwarePathRenderer.cpp b/src/gpu/GrSoftwarePathRenderer.cpp
index f479a483fe..e171b78b4a 100644
--- a/src/gpu/GrSoftwarePathRenderer.cpp
+++ b/src/gpu/GrSoftwarePathRenderer.cpp
@@ -205,7 +205,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
sk_sp<GrTextureProxy> proxy;
if (useCache) {
- proxy = fResourceProvider->findProxyByUniqueKey(maskKey, kTopLeft_GrSurfaceOrigin);
+ proxy = fResourceProvider->findProxyByUniqueKey(maskKey);
}
if (!proxy) {
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
@@ -217,7 +217,6 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
return false;
}
if (useCache) {
- SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
fResourceProvider->assignUniqueKeyToProxy(maskKey, proxy.get());
}
}
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 18c0c32402..0932971f8b 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -20,22 +20,19 @@
#include "SkMathPriv.h"
-GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin, SkBackingFit fit)
+GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, SkBackingFit fit)
: INHERITED(std::move(surface))
, fConfig(fTarget->config())
, fWidth(fTarget->width())
, fHeight(fTarget->height())
- , fOrigin(origin)
+ , fOrigin(fTarget->origin())
, fFit(fit)
, fBudgeted(fTarget->resourcePriv().isBudgeted())
, fFlags(0)
, fUniqueID(fTarget->uniqueID()) // Note: converting from unique resource ID to a proxy ID!
, fNeedsClear(false)
, fGpuMemorySize(kInvalidGpuMemorySize)
- , fLastOpList(nullptr) {
- SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
- SkASSERT(fTarget->origin() == fOrigin);
-}
+ , fLastOpList(nullptr) {}
GrSurfaceProxy::~GrSurfaceProxy() {
// For this to be deleted the opList that held a ref on it (if there was one) must have been
@@ -120,34 +117,34 @@ GrTextureOpList* GrSurfaceProxy::getLastTextureOpList() {
return fLastOpList ? fLastOpList->asTextureOpList() : nullptr;
}
-sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrSurface> surf, GrSurfaceOrigin origin) {
+sk_sp<GrSurfaceProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrSurface> surf) {
if (!surf) {
return nullptr;
}
if (surf->asTexture()) {
if (surf->asRenderTarget()) {
- return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(std::move(surf), origin));
+ return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(std::move(surf)));
} else {
- return sk_sp<GrSurfaceProxy>(new GrTextureProxy(std::move(surf), origin));
+ return sk_sp<GrSurfaceProxy>(new GrTextureProxy(std::move(surf)));
}
} else {
SkASSERT(surf->asRenderTarget());
// Not texturable
- return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(surf), origin));
+ return sk_sp<GrSurfaceProxy>(new GrRenderTargetProxy(std::move(surf)));
}
}
-sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex, GrSurfaceOrigin origin) {
+sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrapped(sk_sp<GrTexture> tex) {
if (!tex) {
return nullptr;
}
if (tex->asRenderTarget()) {
- return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin));
+ return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex)));
} else {
- return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin));
+ return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex)));
}
}
@@ -245,14 +242,14 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
return nullptr;
}
- return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
+ return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
GrBackendTexture& backendTex,
GrSurfaceOrigin origin) {
sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex, origin));
- return GrSurfaceProxy::MakeWrapped(std::move(tex), origin);
+ return GrSurfaceProxy::MakeWrapped(std::move(tex));
}
#ifdef SK_DEBUG
diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp
index 166cb9d54b..be29857e3b 100644
--- a/src/gpu/GrTextureAdjuster.cpp
+++ b/src/gpu/GrTextureAdjuster.cpp
@@ -46,8 +46,7 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxyCopy(const CopyParams& c
GrUniqueKey key;
this->makeCopyKey(copyParams, &key, nullptr);
if (key.isValid()) {
- sk_sp<GrTextureProxy> cachedCopy = fContext->resourceProvider()->findProxyByUniqueKey(
- key, this->originalProxy()->origin());
+ sk_sp<GrTextureProxy> cachedCopy = fContext->resourceProvider()->findProxyByUniqueKey(key);
if (cachedCopy) {
return cachedCopy;
}
@@ -59,7 +58,6 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxyCopy(const CopyParams& c
sk_sp<GrTextureProxy> copy = CopyOnGpu(fContext, std::move(proxy), contentArea, copyParams);
if (copy) {
if (key.isValid()) {
- SkASSERT(copy->origin() == this->originalProxy()->origin());
fContext->resourceProvider()->assignUniqueKeyToProxy(key, copy.get());
this->didCacheCopy(key);
}
diff --git a/src/gpu/GrTextureMaker.cpp b/src/gpu/GrTextureMaker.cpp
index e8ef215772..44212fe433 100644
--- a/src/gpu/GrTextureMaker.cpp
+++ b/src/gpu/GrTextureMaker.cpp
@@ -41,12 +41,10 @@ sk_sp<GrTextureProxy> GrTextureMaker::refTextureProxyForParams(const GrSamplerPa
}
}
- GrSurfaceOrigin origOrigin = original->origin();
GrUniqueKey copyKey;
this->makeCopyKey(copyParams, &copyKey, dstColorSpace);
if (copyKey.isValid()) {
- sk_sp<GrTextureProxy> result(fContext->resourceProvider()->findProxyByUniqueKey(
- copyKey, origOrigin));
+ sk_sp<GrTextureProxy> result(fContext->resourceProvider()->findProxyByUniqueKey(copyKey));
if (result) {
return result;
}
@@ -64,7 +62,6 @@ sk_sp<GrTextureProxy> GrTextureMaker::refTextureProxyForParams(const GrSamplerPa
}
if (copyKey.isValid()) {
- SkASSERT(result->origin() == origOrigin);
fContext->resourceProvider()->assignUniqueKeyToProxy(copyKey, result.get());
this->didCacheCopy(copyKey);
}
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index 78d143b435..276dc10f02 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -24,8 +24,7 @@ sk_sp<GrTextureProxy> GrTextureProducer::CopyOnGpu(GrContext* context,
const SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight);
sk_sp<GrRenderTargetContext> copyRTC = context->makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kExact, dstRect.width(), dstRect.height(), inputProxy->config(), nullptr,
- 0, inputProxy->origin());
+ SkBackingFit::kExact, dstRect.width(), dstRect.height(), inputProxy->config(), nullptr);
if (!copyRTC) {
return nullptr;
}
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index 21533df0ee..310b36d7c6 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -17,8 +17,8 @@ GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, S
SkASSERT(!srcData); // currently handled in Make()
}
-GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
- : INHERITED(std::move(surf), origin, SkBackingFit::kExact)
+GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf)
+ : INHERITED(std::move(surf), SkBackingFit::kExact)
, fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps())
, fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) {
}
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index 1bb0e239fd..a9a56e18c4 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -24,11 +24,10 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
// Wrapped version
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
// GrRenderTargetProxy) so its constructor must be explicitly called.
-GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf,
- GrSurfaceOrigin origin)
- : GrSurfaceProxy(surf, origin, SkBackingFit::kExact)
- , GrTextureProxy(surf, origin)
- , GrRenderTargetProxy(surf, origin) {
+GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf)
+ : GrSurfaceProxy(surf, SkBackingFit::kExact)
+ , GrTextureProxy(surf)
+ , GrRenderTargetProxy(surf) {
SkASSERT(surf->asTexture());
SkASSERT(surf->asRenderTarget());
}
diff --git a/src/gpu/GrTextureRenderTargetProxy.h b/src/gpu/GrTextureRenderTargetProxy.h
index 7005169b22..ed64d9072d 100644
--- a/src/gpu/GrTextureRenderTargetProxy.h
+++ b/src/gpu/GrTextureRenderTargetProxy.h
@@ -30,7 +30,7 @@ private:
SkBackingFit, SkBudgeted, uint32_t flags);
// Wrapped version
- GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
+ GrTextureRenderTargetProxy(sk_sp<GrSurface>);
bool instantiate(GrResourceProvider*) override;
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index 12390aaab0..341b711fbf 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -124,11 +124,10 @@ sk_sp<GrTextureProxy> GrYUVProvider::refAsTextureProxy(GrContext* ctx, const GrS
// We never want to perform color-space conversion during the decode
sk_sp<GrRenderTargetContext> renderTargetContext(ctx->makeDeferredRenderTargetContext(
- SkBackingFit::kExact,
- desc.fWidth, desc.fHeight,
- desc.fConfig, nullptr,
- desc.fSampleCnt,
- kTopLeft_GrSurfaceOrigin));
+ SkBackingFit::kExact,
+ desc.fWidth, desc.fHeight,
+ desc.fConfig, nullptr,
+ desc.fSampleCnt));
if (!renderTargetContext) {
return nullptr;
}
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index e426b95af0..af0a55a156 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -42,7 +42,6 @@
GrSurfaceDesc GrImageInfoToSurfaceDesc(const SkImageInfo& info, const GrCaps& caps) {
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
- desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = info.width();
desc.fHeight = info.height();
desc.fConfig = SkImageInfo2GrPixelConfig(info, caps);
@@ -246,7 +245,7 @@ sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider* resourceProvid
sk_sp<GrTextureProxy> proxy;
if (originalKey.isValid()) {
- proxy = resourceProvider->findProxyByUniqueKey(originalKey, kTopLeft_GrSurfaceOrigin);
+ proxy = resourceProvider->findProxyByUniqueKey(originalKey);
}
if (!proxy) {
// Pass nullptr for |dstColorSpace|. This is lenient - we allow a wider range of
@@ -254,7 +253,6 @@ sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider* resourceProvid
// we can't necessarily know the |dstColorSpace| at this time.
proxy = GrUploadBitmapToTextureProxy(resourceProvider, bitmap, nullptr);
if (proxy && originalKey.isValid()) {
- SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
resourceProvider->assignUniqueKeyToProxy(originalKey, proxy.get());
// MDB TODO (caching): this has to play nice with the GrSurfaceProxy's caching
GrInstallBitmapUniqueKeyInvalidator(originalKey, bitmap.pixelRef());
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.cpp b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
index 1e6fd0829a..bc2e45cb24 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.cpp
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.cpp
@@ -86,7 +86,7 @@ GrCCPRPathProcessor::GrCCPRPathProcessor(GrResourceProvider* rp, sk_sp<GrTexture
}
void GrCCPRPathProcessor::getGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder* b) const {
- b->add32((fFillType << 16) | this->proxy()->origin());
+ b->add32((fFillType << 16) | this->atlas()->origin());
}
class GLSLPathProcessor : public GrGLSLGeometryProcessor {
@@ -161,10 +161,10 @@ void GLSLPathProcessor::onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) {
// Convert to atlas coordinates in order to do our texture lookup.
v->codeAppendf("highp vec2 atlascoord = octocoord + vec2(%s);",
proc.getInstanceAttrib(InstanceAttribs::kAtlasOffset).fName);
- if (kTopLeft_GrSurfaceOrigin == proc.proxy()->origin()) {
+ if (kTopLeft_GrSurfaceOrigin == proc.atlas()->origin()) {
v->codeAppendf("%s = atlascoord * %s;", texcoord.vsOut(), atlasAdjust);
} else {
- SkASSERT(kBottomLeft_GrSurfaceOrigin == proc.proxy()->origin());
+ SkASSERT(kBottomLeft_GrSurfaceOrigin == proc.atlas()->origin());
v->codeAppendf("%s = vec2(atlascoord.x * %s.x, 1 - atlascoord.y * %s.y);",
texcoord.vsOut(), atlasAdjust, atlasAdjust);
}
diff --git a/src/gpu/ccpr/GrCCPRPathProcessor.h b/src/gpu/ccpr/GrCCPRPathProcessor.h
index 29f4e06b44..a74455bc8e 100644
--- a/src/gpu/ccpr/GrCCPRPathProcessor.h
+++ b/src/gpu/ccpr/GrCCPRPathProcessor.h
@@ -58,7 +58,6 @@ public:
const GrShaderCaps&);
const char* name() const override { return "GrCCPRPathProcessor"; }
- const GrSurfaceProxy* proxy() const { return fAtlasAccess.proxy(); }
const GrTexture* atlas() const { return fAtlasAccess.peekTexture(); }
SkPath::FillType fillType() const { return fFillType; }
const Attribute& getInstanceAttrib(InstanceAttribs attribID) const {
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index f7441bc043..6d8072f231 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -120,14 +120,13 @@ void GrGLBicubicEffect::emitCode(EmitArgs& args) {
void GrGLBicubicEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrBicubicEffect& bicubicEffect = processor.cast<GrBicubicEffect>();
- GrSurfaceProxy* proxy = processor.textureSampler(0).proxy();
- GrTexture* texture = proxy->priv().peekTexture();
+ GrTexture* texture = processor.textureSampler(0).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(), proxy);
+ fDomain.setData(pdman, bicubicEffect.domain(), texture);
if (SkToBool(bicubicEffect.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, bicubicEffect.colorSpaceXform());
}
diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp
index e8d04771f5..e4989de507 100644
--- a/src/gpu/effects/GrConfigConversionEffect.cpp
+++ b/src/gpu/effects/GrConfigConversionEffect.cpp
@@ -133,7 +133,6 @@ 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 1ab9b78cfc..4d1a99d83e 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -121,11 +121,10 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrGaussianConvolutionFragmentProcessor& conv =
processor.cast<GrGaussianConvolutionFragmentProcessor>();
- GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
- GrTexture& texture = *proxy->priv().peekTexture();
+ GrTexture& texture = *conv.textureSampler(0).peekTexture();
float imageIncrement[2] = {0};
- float ySign = proxy->origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ float ySign = texture.origin() != kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
switch (conv.direction()) {
case Gr1DKernelEffect::kX_Direction:
imageIncrement[0] = 1.0f / texture.width();
@@ -150,7 +149,7 @@ void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
pdman.set2f(fBoundsUni, inv * bounds[0], inv * bounds[1]);
} else {
SkScalar inv = SkScalarInvert(SkIntToScalar(texture.height()));
- if (proxy->origin() != kTopLeft_GrSurfaceOrigin) {
+ if (texture.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 abfe5b3774..bc1537c8b4 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -131,11 +131,10 @@ void GrGLMatrixConvolutionEffect::GenKey(const GrProcessor& processor,
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
- GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
- GrTexture* texture = proxy->priv().peekTexture();
+ GrTexture* texture = conv.textureSampler(0).peekTexture();
float imageIncrement[2];
- float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
+ float ySign = texture->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
imageIncrement[0] = 1.0f / texture->width();
imageIncrement[1] = ySign / texture->height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
@@ -146,7 +145,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(), proxy);
+ fDomain.setData(pdman, conv.domain(), texture);
}
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy,
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index f2b78586d7..a8ce0ab6c5 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -161,8 +161,7 @@ void GrTextureDomain::GLDomain::sampleTexture(GrGLSLShaderBuilder* builder,
void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
const GrTextureDomain& textureDomain,
- GrSurfaceProxy* proxy) {
- GrTexture* tex = proxy->priv().peekTexture();
+ GrTexture* tex) {
SkASSERT(textureDomain.mode() == fMode);
if (kIgnore_Mode != textureDomain.mode()) {
SkScalar wInv = SK_Scalar1 / tex->width();
@@ -181,7 +180,7 @@ void GrTextureDomain::GLDomain::setData(const GrGLSLProgramDataManager& pdman,
SkASSERT(values[3] >= 0.0f && values[3] <= 1.0f);
// vertical flip if necessary
- if (kBottomLeft_GrSurfaceOrigin == proxy->origin()) {
+ if (kBottomLeft_GrSurfaceOrigin == tex->origin()) {
values[1] = 1.0f - values[1];
values[3] = 1.0f - values[3];
// The top and bottom were just flipped, so correct the ordering
@@ -271,9 +270,9 @@ GrGLSLFragmentProcessor* GrTextureDomainEffect::onCreateGLSLInstance() const {
const GrFragmentProcessor& fp) override {
const GrTextureDomainEffect& tde = fp.cast<GrTextureDomainEffect>();
const GrTextureDomain& domain = tde.fTextureDomain;
- GrSurfaceProxy* proxy = tde.textureSampler(0).proxy();
+ GrTexture* texture = tde.textureSampler(0).peekTexture();
- fGLDomain.setData(pdman, domain, proxy);
+ fGLDomain.setData(pdman, domain, texture);
if (SkToBool(tde.colorSpaceXform())) {
fColorSpaceHelper.setData(pdman, tde.colorSpaceXform());
}
@@ -373,17 +372,16 @@ GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLS
const GrFragmentProcessor& fp) override {
const GrDeviceSpaceTextureDecalFragmentProcessor& dstdfp =
fp.cast<GrDeviceSpaceTextureDecalFragmentProcessor>();
- GrSurfaceProxy* proxy = dstdfp.textureSampler(0).proxy();
- GrTexture* texture = proxy->priv().peekTexture();
+ GrTexture* texture = dstdfp.textureSampler(0).peekTexture();
- fGLDomain.setData(pdman, dstdfp.fTextureDomain, proxy);
+ fGLDomain.setData(pdman, dstdfp.fTextureDomain, texture);
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 (proxy->origin() == kBottomLeft_GrSurfaceOrigin) {
+ if (texture->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 8be1a2bc66..cbc55ecdba 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -115,7 +115,8 @@ public:
* texture domain. The rectangle is automatically adjusted to account for the texture's
* origin.
*/
- void setData(const GrGLSLProgramDataManager&, const GrTextureDomain&, GrSurfaceProxy*);
+ void setData(const GrGLSLProgramDataManager& pdman, const GrTextureDomain& textureDomain,
+ GrTexture* texure);
enum {
kDomainKeyBits = 2, // See DomainKey().
diff --git a/src/gpu/effects/GrTextureStripAtlas.cpp b/src/gpu/effects/GrTextureStripAtlas.cpp
index 02c8ce8faa..72817b2133 100644
--- a/src/gpu/effects/GrTextureStripAtlas.cpp
+++ b/src/gpu/effects/GrTextureStripAtlas.cpp
@@ -193,6 +193,11 @@ GrTextureStripAtlas::AtlasRow* GrTextureStripAtlas::getLRU() {
}
void GrTextureStripAtlas::lockTexture() {
+ GrSurfaceDesc texDesc;
+ texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
+ texDesc.fWidth = fDesc.fWidth;
+ texDesc.fHeight = fDesc.fHeight;
+ texDesc.fConfig = fDesc.fConfig;
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
@@ -200,15 +205,8 @@ void GrTextureStripAtlas::lockTexture() {
builder[0] = static_cast<uint32_t>(fCacheKey);
builder.finish();
- sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(
- key, kTopLeft_GrSurfaceOrigin);
+ sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(key);
if (!proxy) {
- GrSurfaceDesc texDesc;
- texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
- texDesc.fWidth = fDesc.fWidth;
- texDesc.fHeight = fDesc.fHeight;
- texDesc.fConfig = fDesc.fConfig;
-
proxy = GrSurfaceProxy::MakeDeferred(fDesc.fContext->resourceProvider(),
texDesc, SkBackingFit::kExact,
SkBudgeted::kYes,
@@ -217,7 +215,6 @@ void GrTextureStripAtlas::lockTexture() {
return;
}
- SkASSERT(proxy->origin() == kTopLeft_GrSurfaceOrigin);
fDesc.fContext->resourceProvider()->assignUniqueKeyToProxy(key, proxy.get());
// This is a new texture, so all of our cache info is now invalid
this->initLRU();