Revert "Reduce dependence on GrSurface's origin field (take 2)"
This reverts commit 22115b4fc6
.
Reason for revert: GrAHardwareBufferImageGenerator.cpp
Original change's description:
> Reduce dependence on GrSurface's origin field (take 2)
>
> TBR=bsalomon@google.com
> Change-Id: Ia238fc66b0fe10a3626c7967b2ac1f1a4bf4cd71
> Reviewed-on: https://skia-review.googlesource.com/25800
> Reviewed-by: Robert Phillips <robertphillips@google.com>
> Commit-Queue: Robert Phillips <robertphillips@google.com>
TBR=bsalomon@google.com,robertphillips@google.com
Change-Id: I6dc77f02eed3073317128c48f0b426b81926787f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/26480
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
parent
0e05a823f6
commit
6af2a668f4
@ -66,7 +66,7 @@ protected:
|
|||||||
SkBackingFit, SkBudgeted, uint32_t flags);
|
SkBackingFit, SkBudgeted, uint32_t flags);
|
||||||
|
|
||||||
// Wrapped version
|
// Wrapped version
|
||||||
GrRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
|
GrRenderTargetProxy(sk_sp<GrSurface>);
|
||||||
|
|
||||||
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
|
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
|
||||||
|
|
||||||
|
@ -173,8 +173,8 @@ private:
|
|||||||
|
|
||||||
class GrSurfaceProxy : public GrIORefProxy {
|
class GrSurfaceProxy : public GrIORefProxy {
|
||||||
public:
|
public:
|
||||||
static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>, GrSurfaceOrigin);
|
static sk_sp<GrSurfaceProxy> MakeWrapped(sk_sp<GrSurface>);
|
||||||
static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>, GrSurfaceOrigin);
|
static sk_sp<GrTextureProxy> MakeWrapped(sk_sp<GrTexture>);
|
||||||
|
|
||||||
static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*,
|
static sk_sp<GrTextureProxy> MakeDeferred(GrResourceProvider*,
|
||||||
const GrSurfaceDesc&, SkBackingFit,
|
const GrSurfaceDesc&, SkBackingFit,
|
||||||
@ -352,7 +352,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrapped version
|
// Wrapped version
|
||||||
GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin, SkBackingFit fit);
|
GrSurfaceProxy(sk_sp<GrSurface> surface, SkBackingFit fit);
|
||||||
|
|
||||||
virtual ~GrSurfaceProxy();
|
virtual ~GrSurfaceProxy();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ protected:
|
|||||||
GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit, SkBudgeted,
|
GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit, SkBudgeted,
|
||||||
const void* srcData, size_t srcRowBytes, uint32_t flags);
|
const void* srcData, size_t srcRowBytes, uint32_t flags);
|
||||||
// Wrapped version
|
// Wrapped version
|
||||||
GrTextureProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
|
GrTextureProxy(sk_sp<GrSurface>);
|
||||||
|
|
||||||
SkDestinationSurfaceColorMode mipColorMode() const { return fMipColorMode; }
|
SkDestinationSurfaceColorMode mipColorMode() const { return fMipColorMode; }
|
||||||
|
|
||||||
|
@ -174,8 +174,7 @@ static sk_sp<GrTextureProxy> create_profile_texture(GrResourceProvider* resource
|
|||||||
builder[0] = sigmaToCircleRRatioFixed;
|
builder[0] = sigmaToCircleRRatioFixed;
|
||||||
builder.finish();
|
builder.finish();
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> blurProfile = resourceProvider->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> blurProfile = resourceProvider->findProxyByUniqueKey(key);
|
||||||
key, kTopLeft_GrSurfaceOrigin);
|
|
||||||
if (!blurProfile) {
|
if (!blurProfile) {
|
||||||
static constexpr int kProfileTextureWidth = 512;
|
static constexpr int kProfileTextureWidth = 512;
|
||||||
GrSurfaceDesc texDesc;
|
GrSurfaceDesc texDesc;
|
||||||
|
@ -950,8 +950,7 @@ sk_sp<GrTextureProxy> GrRectBlurEffect::CreateBlurProfileTexture(
|
|||||||
builder[0] = profileSize;
|
builder[0] = profileSize;
|
||||||
builder.finish();
|
builder.finish();
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> blurProfile(resourceProvider->findProxyByUniqueKey(key));
|
||||||
key, kTopLeft_GrSurfaceOrigin));
|
|
||||||
if (!blurProfile) {
|
if (!blurProfile) {
|
||||||
GrSurfaceDesc texDesc;
|
GrSurfaceDesc texDesc;
|
||||||
texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
|
texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
|
||||||
@ -1119,8 +1118,7 @@ static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrContext* context,
|
|||||||
}
|
}
|
||||||
builder.finish();
|
builder.finish();
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> mask(context->resourceProvider()->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> mask(context->resourceProvider()->findProxyByUniqueKey(key));
|
||||||
key, kBottomLeft_GrSurfaceOrigin));
|
|
||||||
if (!mask) {
|
if (!mask) {
|
||||||
// TODO: this could be approx but the texture coords will need to be updated
|
// TODO: this could be approx but the texture coords will need to be updated
|
||||||
sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback(
|
sk_sp<GrRenderTargetContext> rtc(context->makeDeferredRenderTargetContextWithFallback(
|
||||||
|
@ -165,7 +165,7 @@ sk_sp<GrTextureProxy> GrBackendTextureImageGenerator::onGenerateTexture(
|
|||||||
|
|
||||||
SkASSERT(fRefHelper->fBorrowingContextID == context->uniqueID());
|
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 &&
|
if (0 == origin.fX && 0 == origin.fY &&
|
||||||
info.width() == fBackendTexture.width() && info.height() == fBackendTexture.height()) {
|
info.width() == fBackendTexture.width() && info.height() == fBackendTexture.height()) {
|
||||||
|
@ -37,8 +37,7 @@ sk_sp<GrTextureProxy> GrBitmapTextureMaker::refOriginalTextureProxy(bool willBeM
|
|||||||
sk_sp<GrTextureProxy> proxy;
|
sk_sp<GrTextureProxy> proxy;
|
||||||
|
|
||||||
if (fOriginalKey.isValid()) {
|
if (fOriginalKey.isValid()) {
|
||||||
proxy = this->context()->resourceProvider()->findProxyByUniqueKey(
|
proxy = this->context()->resourceProvider()->findProxyByUniqueKey(fOriginalKey);
|
||||||
fOriginalKey, kTopLeft_GrSurfaceOrigin);
|
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
@ -394,8 +394,7 @@ sk_sp<GrTextureProxy> GrClipStackClip::createAlphaClipMask(GrContext* context,
|
|||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
|
create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> proxy(resourceProvider->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> proxy(resourceProvider->findProxyByUniqueKey(key));
|
||||||
key, kBottomLeft_GrSurfaceOrigin));
|
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
@ -433,8 +432,7 @@ sk_sp<GrTextureProxy> GrClipStackClip::createSoftwareClipMask(
|
|||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
|
create_clip_mask_key(reducedClip.elementsGenID(), reducedClip.ibounds(), &key);
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> proxy(context->resourceProvider()->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> proxy(context->resourceProvider()->findProxyByUniqueKey(key));
|
||||||
key, kTopLeft_GrSurfaceOrigin));
|
|
||||||
if (proxy) {
|
if (proxy) {
|
||||||
return proxy;
|
return proxy;
|
||||||
}
|
}
|
||||||
|
@ -676,7 +676,7 @@ sk_sp<GrTextureContext> GrContextPriv::makeBackendTextureContext(const GrBackend
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface), origin));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -698,7 +698,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureRenderTargetContex
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface), origin));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -720,7 +720,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendRenderTargetRenderTargetC
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt), origin));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(rt)));
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -746,7 +746,7 @@ sk_sp<GrRenderTargetContext> GrContextPriv::makeBackendTextureAsRenderTargetRend
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface), origin));
|
sk_sp<GrSurfaceProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(surface)));
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -39,8 +39,7 @@ std::unique_ptr<GrDrawOpAtlas> GrDrawOpAtlas::Make(GrContext* ctx, GrPixelConfig
|
|||||||
// should receive special attention.
|
// should receive special attention.
|
||||||
// Note: When switching over to the deferred proxy, use the kExact flag to create
|
// 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.
|
// the atlas and assert that the width & height are powers of 2.
|
||||||
sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(texture),
|
sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeWrapped(std::move(texture));
|
||||||
kTopLeft_GrSurfaceOrigin);
|
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ GrRenderTargetProxy::GrRenderTargetProxy(const GrCaps& caps, const GrSurfaceDesc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wrapped version
|
// Wrapped version
|
||||||
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
|
GrRenderTargetProxy::GrRenderTargetProxy(sk_sp<GrSurface> surf)
|
||||||
: INHERITED(std::move(surf), origin, SkBackingFit::kExact)
|
: INHERITED(std::move(surf), SkBackingFit::kExact)
|
||||||
, fSampleCnt(fTarget->asRenderTarget()->numStencilSamples())
|
, fSampleCnt(fTarget->asRenderTarget()->numStencilSamples())
|
||||||
, fRenderTargetFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
|
, fRenderTargetFlags(fTarget->asRenderTarget()->renderTargetPriv().flags()) {
|
||||||
}
|
}
|
||||||
|
@ -140,7 +140,7 @@ sk_sp<GrTextureProxy> GrResourceProvider::createTextureProxy(const GrSurfaceDesc
|
|||||||
|
|
||||||
if (make_info(desc.fWidth, desc.fHeight, desc.fConfig, &srcInfo)) {
|
if (make_info(desc.fWidth, desc.fHeight, desc.fConfig, &srcInfo)) {
|
||||||
sk_sp<GrTexture> tex = this->getExactScratch(desc, budgeted, 0);
|
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) {
|
if (proxy) {
|
||||||
sk_sp<GrSurfaceContext> sContext =
|
sk_sp<GrSurfaceContext> sContext =
|
||||||
context->contextPriv().makeWrappedSurfaceContext(std::move(proxy), nullptr);
|
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));
|
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,
|
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
|
// MDB TODO (caching): this side-steps the issue of texture proxies with unique IDs
|
||||||
sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey& key,
|
sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey& key) {
|
||||||
GrSurfaceOrigin origin) {
|
|
||||||
ASSERT_SINGLE_OWNER
|
ASSERT_SINGLE_OWNER
|
||||||
|
|
||||||
sk_sp<GrTexture> texture(this->findAndRefTextureByUniqueKey(key));
|
sk_sp<GrTexture> texture(this->findAndRefTextureByUniqueKey(key));
|
||||||
@ -321,7 +320,7 @@ sk_sp<GrTextureProxy> GrResourceProvider::findProxyByUniqueKey(const GrUniqueKey
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(texture), origin);
|
return GrSurfaceProxy::MakeWrapped(std::move(texture));
|
||||||
}
|
}
|
||||||
|
|
||||||
const GrBuffer* GrResourceProvider::createPatternedIndexBuffer(const uint16_t* pattern,
|
const GrBuffer* GrResourceProvider::createPatternedIndexBuffer(const uint16_t* pattern,
|
||||||
|
@ -55,7 +55,7 @@ public:
|
|||||||
/** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */
|
/** 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
|
// MDB TODO (caching): If this were actually caching proxies (rather than shallowly
|
||||||
// wrapping GrSurface caching) we would not need the origin parameter.
|
// 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
|
* Finds a texture that approximately matches the descriptor. Will be at least as large in width
|
||||||
|
@ -205,7 +205,7 @@ bool GrSoftwarePathRenderer::onDrawPath(const DrawPathArgs& args) {
|
|||||||
|
|
||||||
sk_sp<GrTextureProxy> proxy;
|
sk_sp<GrTextureProxy> proxy;
|
||||||
if (useCache) {
|
if (useCache) {
|
||||||
proxy = fResourceProvider->findProxyByUniqueKey(maskKey, kTopLeft_GrSurfaceOrigin);
|
proxy = fResourceProvider->findProxyByUniqueKey(maskKey);
|
||||||
}
|
}
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
|
SkBackingFit fit = useCache ? SkBackingFit::kExact : SkBackingFit::kApprox;
|
||||||
|
@ -20,12 +20,12 @@
|
|||||||
|
|
||||||
#include "SkMathPriv.h"
|
#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))
|
: INHERITED(std::move(surface))
|
||||||
, fConfig(fTarget->config())
|
, fConfig(fTarget->config())
|
||||||
, fWidth(fTarget->width())
|
, fWidth(fTarget->width())
|
||||||
, fHeight(fTarget->height())
|
, fHeight(fTarget->height())
|
||||||
, fOrigin(origin)
|
, fOrigin(fTarget->origin())
|
||||||
, fFit(fit)
|
, fFit(fit)
|
||||||
, fBudgeted(fTarget->resourcePriv().isBudgeted())
|
, fBudgeted(fTarget->resourcePriv().isBudgeted())
|
||||||
, fFlags(0)
|
, fFlags(0)
|
||||||
@ -34,7 +34,6 @@ GrSurfaceProxy::GrSurfaceProxy(sk_sp<GrSurface> surface, GrSurfaceOrigin origin,
|
|||||||
, fGpuMemorySize(kInvalidGpuMemorySize)
|
, fGpuMemorySize(kInvalidGpuMemorySize)
|
||||||
, fLastOpList(nullptr) {
|
, fLastOpList(nullptr) {
|
||||||
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
|
SkASSERT(kDefault_GrSurfaceOrigin != fOrigin);
|
||||||
SkASSERT(fTarget->origin() == fOrigin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GrSurfaceProxy::~GrSurfaceProxy() {
|
GrSurfaceProxy::~GrSurfaceProxy() {
|
||||||
@ -146,34 +145,34 @@ GrTextureOpList* GrSurfaceProxy::getLastTextureOpList() {
|
|||||||
return fLastOpList ? fLastOpList->asTextureOpList() : nullptr;
|
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) {
|
if (!surf) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (surf->asTexture()) {
|
if (surf->asTexture()) {
|
||||||
if (surf->asRenderTarget()) {
|
if (surf->asRenderTarget()) {
|
||||||
return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(std::move(surf), origin));
|
return sk_sp<GrSurfaceProxy>(new GrTextureRenderTargetProxy(std::move(surf)));
|
||||||
} else {
|
} else {
|
||||||
return sk_sp<GrSurfaceProxy>(new GrTextureProxy(std::move(surf), origin));
|
return sk_sp<GrSurfaceProxy>(new GrTextureProxy(std::move(surf)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SkASSERT(surf->asRenderTarget());
|
SkASSERT(surf->asRenderTarget());
|
||||||
|
|
||||||
// Not texturable
|
// 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) {
|
if (!tex) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tex->asRenderTarget()) {
|
if (tex->asRenderTarget()) {
|
||||||
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex), origin));
|
return sk_sp<GrTextureProxy>(new GrTextureRenderTargetProxy(std::move(tex)));
|
||||||
} else {
|
} else {
|
||||||
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex), origin));
|
return sk_sp<GrTextureProxy>(new GrTextureProxy(std::move(tex)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -271,14 +270,14 @@ sk_sp<GrTextureProxy> GrSurfaceProxy::MakeDeferredMipMap(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
|
sk_sp<GrTextureProxy> GrSurfaceProxy::MakeWrappedBackend(GrContext* context,
|
||||||
GrBackendTexture& backendTex,
|
GrBackendTexture& backendTex,
|
||||||
GrSurfaceOrigin origin) {
|
GrSurfaceOrigin origin) {
|
||||||
sk_sp<GrTexture> tex(context->resourceProvider()->wrapBackendTexture(backendTex, 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
|
#ifdef SK_DEBUG
|
||||||
|
@ -46,8 +46,7 @@ sk_sp<GrTextureProxy> GrTextureAdjuster::refTextureProxyCopy(const CopyParams& c
|
|||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
this->makeCopyKey(copyParams, &key, nullptr);
|
this->makeCopyKey(copyParams, &key, nullptr);
|
||||||
if (key.isValid()) {
|
if (key.isValid()) {
|
||||||
sk_sp<GrTextureProxy> cachedCopy = fContext->resourceProvider()->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> cachedCopy = fContext->resourceProvider()->findProxyByUniqueKey(key);
|
||||||
key, this->originalProxy()->origin());
|
|
||||||
if (cachedCopy) {
|
if (cachedCopy) {
|
||||||
return cachedCopy;
|
return cachedCopy;
|
||||||
}
|
}
|
||||||
|
@ -41,17 +41,18 @@ sk_sp<GrTextureProxy> GrTextureMaker::refTextureProxyForParams(const GrSamplerPa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GrSurfaceOrigin origOrigin;
|
SkDEBUGCODE(GrSurfaceOrigin origOrigin);
|
||||||
GrUniqueKey copyKey;
|
GrUniqueKey copyKey;
|
||||||
this->makeCopyKey(copyParams, ©Key, dstColorSpace);
|
this->makeCopyKey(copyParams, ©Key, dstColorSpace);
|
||||||
if (copyKey.isValid()) {
|
if (copyKey.isValid()) {
|
||||||
|
#ifdef SK_DEBUG
|
||||||
if (original) {
|
if (original) {
|
||||||
origOrigin = original->origin();
|
origOrigin = original->origin();
|
||||||
} else {
|
} else {
|
||||||
origOrigin = kTopLeft_GrSurfaceOrigin;
|
origOrigin = kTopLeft_GrSurfaceOrigin;
|
||||||
}
|
}
|
||||||
sk_sp<GrTextureProxy> result(fContext->resourceProvider()->findProxyByUniqueKey(
|
#endif
|
||||||
copyKey, origOrigin));
|
sk_sp<GrTextureProxy> result(fContext->resourceProvider()->findProxyByUniqueKey(copyKey));
|
||||||
if (result) {
|
if (result) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, S
|
|||||||
SkASSERT(!srcData); // currently handled in Make()
|
SkASSERT(!srcData); // currently handled in Make()
|
||||||
}
|
}
|
||||||
|
|
||||||
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf, GrSurfaceOrigin origin)
|
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf)
|
||||||
: INHERITED(std::move(surf), origin, SkBackingFit::kExact)
|
: INHERITED(std::move(surf), SkBackingFit::kExact)
|
||||||
, fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps())
|
, fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps())
|
||||||
, fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) {
|
, fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) {
|
||||||
}
|
}
|
||||||
|
@ -24,11 +24,10 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps,
|
|||||||
// Wrapped version
|
// Wrapped version
|
||||||
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
|
// This class is virtually derived from GrSurfaceProxy (via both GrTextureProxy and
|
||||||
// GrRenderTargetProxy) so its constructor must be explicitly called.
|
// GrRenderTargetProxy) so its constructor must be explicitly called.
|
||||||
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf,
|
GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp<GrSurface> surf)
|
||||||
GrSurfaceOrigin origin)
|
: GrSurfaceProxy(surf, SkBackingFit::kExact)
|
||||||
: GrSurfaceProxy(surf, origin, SkBackingFit::kExact)
|
, GrTextureProxy(surf)
|
||||||
, GrTextureProxy(surf, origin)
|
, GrRenderTargetProxy(surf) {
|
||||||
, GrRenderTargetProxy(surf, origin) {
|
|
||||||
SkASSERT(surf->asTexture());
|
SkASSERT(surf->asTexture());
|
||||||
SkASSERT(surf->asRenderTarget());
|
SkASSERT(surf->asRenderTarget());
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ private:
|
|||||||
SkBackingFit, SkBudgeted, uint32_t flags);
|
SkBackingFit, SkBudgeted, uint32_t flags);
|
||||||
|
|
||||||
// Wrapped version
|
// Wrapped version
|
||||||
GrTextureRenderTargetProxy(sk_sp<GrSurface>, GrSurfaceOrigin);
|
GrTextureRenderTargetProxy(sk_sp<GrSurface>);
|
||||||
|
|
||||||
bool instantiate(GrResourceProvider*) override;
|
bool instantiate(GrResourceProvider*) override;
|
||||||
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
|
sk_sp<GrSurface> createSurface(GrResourceProvider*) const override;
|
||||||
|
@ -246,7 +246,7 @@ sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrResourceProvider* resourceProvid
|
|||||||
sk_sp<GrTextureProxy> proxy;
|
sk_sp<GrTextureProxy> proxy;
|
||||||
|
|
||||||
if (originalKey.isValid()) {
|
if (originalKey.isValid()) {
|
||||||
proxy = resourceProvider->findProxyByUniqueKey(originalKey, kTopLeft_GrSurfaceOrigin);
|
proxy = resourceProvider->findProxyByUniqueKey(originalKey);
|
||||||
}
|
}
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
// Pass nullptr for |dstColorSpace|. This is lenient - we allow a wider range of
|
// Pass nullptr for |dstColorSpace|. This is lenient - we allow a wider range of
|
||||||
|
@ -207,8 +207,7 @@ void GrTextureStripAtlas::lockTexture() {
|
|||||||
builder[0] = static_cast<uint32_t>(fCacheKey);
|
builder[0] = static_cast<uint32_t>(fCacheKey);
|
||||||
builder.finish();
|
builder.finish();
|
||||||
|
|
||||||
sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(
|
sk_sp<GrTextureProxy> proxy = fDesc.fContext->resourceProvider()->findProxyByUniqueKey(key);
|
||||||
key, kTopLeft_GrSurfaceOrigin);
|
|
||||||
if (!proxy) {
|
if (!proxy) {
|
||||||
GrSurfaceDesc texDesc;
|
GrSurfaceDesc texDesc;
|
||||||
texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
|
texDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
|
||||||
|
@ -277,7 +277,7 @@ static sk_sp<SkImage> new_wrapped_texture_common(GrContext* ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SkBudgeted budgeted = SkBudgeted::kNo;
|
const SkBudgeted budgeted = SkBudgeted::kNo;
|
||||||
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(tex), origin));
|
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeWrapped(std::move(tex)));
|
||||||
return sk_make_sp<SkImage_Gpu>(ctx, kNeedNewImageUniqueID,
|
return sk_make_sp<SkImage_Gpu>(ctx, kNeedNewImageUniqueID,
|
||||||
at, std::move(proxy), std::move(colorSpace), budgeted);
|
at, std::move(proxy), std::move(colorSpace), budgeted);
|
||||||
}
|
}
|
||||||
|
@ -748,8 +748,7 @@ sk_sp<GrTextureProxy> SkImage_Lazy::lockTextureProxy(GrContext* ctx,
|
|||||||
|
|
||||||
// 1. Check the cache for a pre-existing one
|
// 1. Check the cache for a pre-existing one
|
||||||
if (key.isValid()) {
|
if (key.isValid()) {
|
||||||
if (sk_sp<GrTextureProxy> proxy = ctx->resourceProvider()->findProxyByUniqueKey(
|
if (sk_sp<GrTextureProxy> proxy = ctx->resourceProvider()->findProxyByUniqueKey(key)) {
|
||||||
key, kTopLeft_GrSurfaceOrigin)) {
|
|
||||||
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath,
|
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kPreExisting_LockTexturePath,
|
||||||
kLockTexturePathCount);
|
kLockTexturePathCount);
|
||||||
return proxy;
|
return proxy;
|
||||||
|
@ -184,7 +184,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(InitialTextureClear, reporter, context_info)
|
|||||||
if (!tex) {
|
if (!tex) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto proxy = GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
|
auto proxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
auto texCtx = context->contextPriv().makeWrappedSurfaceContext(
|
auto texCtx = context->contextPriv().makeWrappedSurfaceContext(
|
||||||
std::move(proxy), nullptr);
|
std::move(proxy), nullptr);
|
||||||
SkImageInfo info = SkImageInfo::Make(
|
SkImageInfo info = SkImageInfo::Make(
|
||||||
|
@ -29,7 +29,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_FBO0(GrResourceProvider* provider,
|
|||||||
sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT, desc.fOrigin));
|
sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT, desc.fOrigin));
|
||||||
SkASSERT(!defaultFBO->asTexture());
|
SkASSERT(!defaultFBO->asTexture());
|
||||||
|
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(defaultFBO), desc.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(defaultFBO));
|
||||||
}
|
}
|
||||||
|
|
||||||
static sk_sp<GrSurfaceProxy> make_wrapped_offscreen_rt(GrResourceProvider* provider,
|
static sk_sp<GrSurfaceProxy> make_wrapped_offscreen_rt(GrResourceProvider* provider,
|
||||||
@ -40,7 +40,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_offscreen_rt(GrResourceProvider* provi
|
|||||||
|
|
||||||
sk_sp<GrTexture> tex(provider->createTexture(desc, budgeted));
|
sk_sp<GrTexture> tex(provider->createTexture(desc, budgeted));
|
||||||
|
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
static sk_sp<GrSurfaceProxy> make_wrapped_texture(GrResourceProvider* provider,
|
static sk_sp<GrSurfaceProxy> make_wrapped_texture(GrResourceProvider* provider,
|
||||||
@ -48,7 +48,7 @@ static sk_sp<GrSurfaceProxy> make_wrapped_texture(GrResourceProvider* provider,
|
|||||||
SkBudgeted budgeted) {
|
SkBudgeted budgeted) {
|
||||||
sk_sp<GrTexture> tex(provider->createTexture(desc, budgeted));
|
sk_sp<GrTexture> tex(provider->createTexture(desc, budgeted));
|
||||||
|
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test converting between RenderTargetProxies and TextureProxies for wrapped
|
// Test converting between RenderTargetProxies and TextureProxies for wrapped
|
||||||
|
@ -87,7 +87,7 @@ static sk_sp<GrTextureProxy> make_wrapped(GrContext* context) {
|
|||||||
|
|
||||||
sk_sp<GrTexture> tex(context->resourceProvider()->createTexture(desc, SkBudgeted::kNo));
|
sk_sp<GrTexture> tex(context->resourceProvider()->createTexture(desc, SkBudgeted::kNo));
|
||||||
|
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), desc.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
|
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ProxyRefTest, reporter, ctxInfo) {
|
||||||
|
@ -236,8 +236,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
|||||||
sk_sp<GrRenderTarget> defaultFBO(
|
sk_sp<GrRenderTarget> defaultFBO(
|
||||||
provider->wrapBackendRenderTarget(backendRT, origin));
|
provider->wrapBackendRenderTarget(backendRT, origin));
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(defaultFBO,
|
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(defaultFBO));
|
||||||
origin));
|
|
||||||
check_surface(reporter, sProxy.get(), origin,
|
check_surface(reporter, sProxy.get(), origin,
|
||||||
kWidthHeight, kWidthHeight, config,
|
kWidthHeight, kWidthHeight, config,
|
||||||
defaultFBO->uniqueID(), SkBudgeted::kNo);
|
defaultFBO->uniqueID(), SkBudgeted::kNo);
|
||||||
@ -253,7 +252,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
|||||||
tex = provider->createTexture(desc, budgeted);
|
tex = provider->createTexture(desc, budgeted);
|
||||||
sk_sp<GrRenderTarget> rt(sk_ref_sp(tex->asRenderTarget()));
|
sk_sp<GrRenderTarget> rt(sk_ref_sp(tex->asRenderTarget()));
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(rt, origin));
|
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(rt));
|
||||||
check_surface(reporter, sProxy.get(), origin,
|
check_surface(reporter, sProxy.get(), origin,
|
||||||
kWidthHeight, kWidthHeight, config,
|
kWidthHeight, kWidthHeight, config,
|
||||||
rt->uniqueID(), budgeted);
|
rt->uniqueID(), budgeted);
|
||||||
@ -268,7 +267,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(WrappedProxyTest, reporter, ctxInfo) {
|
|||||||
tex = provider->createTexture(desc, budgeted);
|
tex = provider->createTexture(desc, budgeted);
|
||||||
}
|
}
|
||||||
|
|
||||||
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(tex, origin));
|
sk_sp<GrSurfaceProxy> sProxy(GrSurfaceProxy::MakeWrapped(tex));
|
||||||
check_surface(reporter, sProxy.get(), origin,
|
check_surface(reporter, sProxy.get(), origin,
|
||||||
kWidthHeight, kWidthHeight, config, tex->uniqueID(), budgeted);
|
kWidthHeight, kWidthHeight, config, tex->uniqueID(), budgeted);
|
||||||
check_texture(reporter, provider, sProxy->asTextureProxy(),
|
check_texture(reporter, provider, sProxy->asTextureProxy(),
|
||||||
|
@ -56,7 +56,7 @@ static sk_sp<GrSurfaceProxy> make_backend(GrContext* context, const ProxyParams&
|
|||||||
sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(
|
sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(
|
||||||
backendTex, p.fOrigin,
|
backendTex, p.fOrigin,
|
||||||
kBorrow_GrWrapOwnership);
|
kBorrow_GrWrapOwnership);
|
||||||
return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin);
|
return GrSurfaceProxy::MakeWrapped(std::move(tex));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cleanup_backend(GrContext* context, GrBackendObject* backendTexHandle) {
|
static void cleanup_backend(GrContext* context, GrBackendObject* backendTexHandle) {
|
||||||
|
Loading…
Reference in New Issue
Block a user