Move MIP color mode from GrSurfaceProxy to GrTextureProxy
Change-Id: I76bc7f551ea4052fc611cf01e0ce81102c9c3395 Reviewed-on: https://skia-review.googlesource.com/17263 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
parent
c96da1e51e
commit
081e0e6a32
@ -323,8 +323,6 @@ protected:
|
|||||||
, fFit(fit)
|
, fFit(fit)
|
||||||
, fBudgeted(budgeted)
|
, fBudgeted(budgeted)
|
||||||
, fFlags(flags)
|
, fFlags(flags)
|
||||||
// fMipColorMode is only valid for texturable proxies
|
|
||||||
, fMipColorMode(SkDestinationSurfaceColorMode::kLegacy)
|
|
||||||
, fGpuMemorySize(kInvalidGpuMemorySize)
|
, fGpuMemorySize(kInvalidGpuMemorySize)
|
||||||
, fLastOpList(nullptr) {
|
, fLastOpList(nullptr) {
|
||||||
// Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
|
// Note: this ctor pulls a new uniqueID from the same pool at the GrGpuResources
|
||||||
@ -347,7 +345,8 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrSurface* instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
|
GrSurface* instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
|
||||||
GrSurfaceFlags flags, bool isMipMapped);
|
GrSurfaceFlags flags, bool isMipMapped,
|
||||||
|
SkDestinationSurfaceColorMode mipColorMode);
|
||||||
|
|
||||||
// For wrapped resources, 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always be filled in
|
// For wrapped resources, 'fConfig', 'fWidth', 'fHeight', and 'fOrigin; will always be filled in
|
||||||
// from the wrapped resource.
|
// from the wrapped resource.
|
||||||
@ -360,7 +359,6 @@ protected:
|
|||||||
// mutable bc of SkSurface/SkImage wishy-washiness
|
// mutable bc of SkSurface/SkImage wishy-washiness
|
||||||
const uint32_t fFlags;
|
const uint32_t fFlags;
|
||||||
|
|
||||||
SkDestinationSurfaceColorMode fMipColorMode;
|
|
||||||
|
|
||||||
const UniqueID fUniqueID; // set from the backing resource for wrapped resources
|
const UniqueID fUniqueID; // set from the backing resource for wrapped resources
|
||||||
|
|
||||||
|
@ -53,8 +53,11 @@ protected:
|
|||||||
// Wrapped version
|
// Wrapped version
|
||||||
GrTextureProxy(sk_sp<GrSurface>);
|
GrTextureProxy(sk_sp<GrSurface>);
|
||||||
|
|
||||||
|
SkDestinationSurfaceColorMode mipColorMode() const { return fMipColorMode; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool fIsMipMapped;
|
bool fIsMipMapped;
|
||||||
|
SkDestinationSurfaceColorMode fMipColorMode;
|
||||||
|
|
||||||
size_t onUninstantiatedGpuMemorySize() const override;
|
size_t onUninstantiatedGpuMemorySize() const override;
|
||||||
|
|
||||||
|
@ -49,7 +49,8 @@ GrSurface* GrRenderTargetProxy::instantiate(GrResourceProvider* resourceProvider
|
|||||||
static constexpr GrSurfaceFlags kFlags = kRenderTarget_GrSurfaceFlag;
|
static constexpr GrSurfaceFlags kFlags = kRenderTarget_GrSurfaceFlag;
|
||||||
|
|
||||||
GrSurface* surf = this->instantiateImpl(resourceProvider, fSampleCnt, kFlags,
|
GrSurface* surf = this->instantiateImpl(resourceProvider, fSampleCnt, kFlags,
|
||||||
/* isMipped = */ false);
|
/* isMipped = */ false,
|
||||||
|
SkDestinationSurfaceColorMode::kLegacy);
|
||||||
if (!surf) {
|
if (!surf) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -40,7 +40,8 @@ GrSurfaceProxy::~GrSurfaceProxy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrSurface* GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
|
GrSurface* GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
|
||||||
GrSurfaceFlags flags, bool isMipMapped) {
|
GrSurfaceFlags flags, bool isMipMapped,
|
||||||
|
SkDestinationSurfaceColorMode mipColorMode) {
|
||||||
if (fTarget) {
|
if (fTarget) {
|
||||||
return fTarget;
|
return fTarget;
|
||||||
}
|
}
|
||||||
@ -62,7 +63,7 @@ GrSurface* GrSurfaceProxy::instantiateImpl(GrResourceProvider* resourceProvider,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
fTarget->asTexture()->texturePriv().setMipColorMode(fMipColorMode);
|
fTarget->asTexture()->texturePriv().setMipColorMode(mipColorMode);
|
||||||
this->INHERITED::transferRefs();
|
this->INHERITED::transferRefs();
|
||||||
|
|
||||||
#ifdef SK_DEBUG
|
#ifdef SK_DEBUG
|
||||||
|
@ -13,17 +13,20 @@
|
|||||||
GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted,
|
GrTextureProxy::GrTextureProxy(const GrSurfaceDesc& srcDesc, SkBackingFit fit, SkBudgeted budgeted,
|
||||||
const void* srcData, size_t /*rowBytes*/, uint32_t flags)
|
const void* srcData, size_t /*rowBytes*/, uint32_t flags)
|
||||||
: INHERITED(srcDesc, fit, budgeted, flags)
|
: INHERITED(srcDesc, fit, budgeted, flags)
|
||||||
, fIsMipMapped(srcDesc.fIsMipMapped) {
|
, fIsMipMapped(srcDesc.fIsMipMapped)
|
||||||
|
, fMipColorMode(SkDestinationSurfaceColorMode::kLegacy) {
|
||||||
SkASSERT(!srcData); // currently handled in Make()
|
SkASSERT(!srcData); // currently handled in Make()
|
||||||
}
|
}
|
||||||
|
|
||||||
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf)
|
GrTextureProxy::GrTextureProxy(sk_sp<GrSurface> surf)
|
||||||
: INHERITED(std::move(surf), SkBackingFit::kExact)
|
: INHERITED(std::move(surf), SkBackingFit::kExact)
|
||||||
, fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps()) {}
|
, fIsMipMapped(fTarget->asTexture()->texturePriv().hasMipMaps())
|
||||||
|
, fMipColorMode(fTarget->asTexture()->texturePriv().mipColorMode()) {}
|
||||||
|
|
||||||
GrSurface* GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
|
GrSurface* GrTextureProxy::instantiate(GrResourceProvider* resourceProvider) {
|
||||||
GrSurface* surf =
|
GrSurface* surf =
|
||||||
this->instantiateImpl(resourceProvider, 0, kNone_GrSurfaceFlags, fIsMipMapped);
|
this->instantiateImpl(resourceProvider, 0, kNone_GrSurfaceFlags, fIsMipMapped,
|
||||||
|
fMipColorMode);
|
||||||
if (!surf) {
|
if (!surf) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ GrSurface* GrTextureRenderTargetProxy::instantiate(GrResourceProvider* resourceP
|
|||||||
static constexpr GrSurfaceFlags kFlags = kRenderTarget_GrSurfaceFlag;
|
static constexpr GrSurfaceFlags kFlags = kRenderTarget_GrSurfaceFlag;
|
||||||
|
|
||||||
GrSurface* surf = this->instantiateImpl(resourceProvider, this->numStencilSamples(), kFlags,
|
GrSurface* surf = this->instantiateImpl(resourceProvider, this->numStencilSamples(), kFlags,
|
||||||
this->isMipMapped());
|
this->isMipMapped(), this->mipColorMode());
|
||||||
if (!surf) {
|
if (!surf) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user