Remove GrSurfaceDesc
Replace with SkISize.
Also change some const SkISize& params to just SkISize.
Change-Id: I3c72d961662eefeda545fba17d63e877cd5ca813
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/269374
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index b2cee1d..7391c01 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -29,23 +29,23 @@
#include "src/gpu/GrRenderTarget.h"
#include "src/gpu/GrRenderTargetPriv.h"
-static bool is_valid_lazy(const GrSurfaceDesc& desc, SkBackingFit fit) {
+static bool is_valid_lazy(const SkISize& dimensions, SkBackingFit fit) {
// A "fully" lazy proxy's width and height are not known until instantiation time.
// So fully lazy proxies are created with width and height < 0. Regular lazy proxies must be
// created with positive widths and heights. The width and height are set to 0 only after a
// failed instantiation. The former must be "approximate" fit while the latter can be either.
- return ((desc.fWidth < 0 && desc.fHeight < 0 && SkBackingFit::kApprox == fit) ||
- (desc.fWidth > 0 && desc.fHeight > 0));
+ return ((dimensions.fWidth < 0 && dimensions.fHeight < 0 && SkBackingFit::kApprox == fit) ||
+ (dimensions.fWidth > 0 && dimensions.fHeight > 0));
}
-static bool is_valid_non_lazy(const GrSurfaceDesc& desc) {
- return desc.fWidth > 0 && desc.fHeight > 0;
+static bool is_valid_non_lazy(SkISize dimensions) {
+ return dimensions.fWidth > 0 && dimensions.fHeight > 0;
}
#endif
// Deferred version
GrSurfaceProxy::GrSurfaceProxy(const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrRenderable renderable,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
@@ -56,7 +56,7 @@
UseAllocator useAllocator)
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
- , fDimensions{desc.fWidth, desc.fHeight}
+ , fDimensions(dimensions)
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -65,13 +65,13 @@
, fIsProtected(isProtected)
, fGpuMemorySize(kInvalidGpuMemorySize) {
SkASSERT(fFormat.isValid());
- SkASSERT(is_valid_non_lazy(desc));
+ SkASSERT(is_valid_non_lazy(dimensions));
}
// Lazy-callback version
GrSurfaceProxy::GrSurfaceProxy(LazyInstantiateCallback&& callback,
const GrBackendFormat& format,
- const GrSurfaceDesc& desc,
+ SkISize dimensions,
GrRenderable renderable,
GrSurfaceOrigin origin,
const GrSwizzle& textureSwizzle,
@@ -82,7 +82,7 @@
UseAllocator useAllocator)
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
- , fDimensions{desc.fWidth, desc.fHeight}
+ , fDimensions(dimensions)
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -93,7 +93,7 @@
, fGpuMemorySize(kInvalidGpuMemorySize) {
SkASSERT(fFormat.isValid());
SkASSERT(fLazyInstantiateCallback);
- SkASSERT(is_valid_lazy(desc, fit));
+ SkASSERT(is_valid_lazy(dimensions, fit));
}
// Wrapped version
@@ -132,17 +132,14 @@
SkASSERT(mipMapped == GrMipMapped::kNo || fFit == SkBackingFit::kExact);
SkASSERT(!this->isLazy());
SkASSERT(!fTarget);
- GrSurfaceDesc desc;
- desc.fWidth = fDimensions.width();
- desc.fHeight = fDimensions.height();
sk_sp<GrSurface> surface;
if (SkBackingFit::kApprox == fFit) {
- surface = resourceProvider->createApproxTexture(desc, fFormat, renderable, sampleCnt,
+ surface = resourceProvider->createApproxTexture(fDimensions, fFormat, renderable, sampleCnt,
fIsProtected);
} else {
- surface = resourceProvider->createTexture(desc, fFormat, renderable, sampleCnt, mipMapped,
- fBudgeted, fIsProtected);
+ surface = resourceProvider->createTexture(fDimensions, fFormat, renderable, sampleCnt,
+ mipMapped, fBudgeted, fIsProtected);
}
if (!surface) {
return nullptr;