More SkISizification in GPU code.
Uses SkISize instead of separate width/height variables in many places.
No functional change.
Change-Id: If87b2c57e43d810f0820c4e3c9ef8e6b8ebd10ba
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/249886
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index 3c72e61..b0bface 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -118,7 +118,7 @@
return nullptr;
}
- const SkIRect rect = SkIRect::MakeWH(proxy->width(), proxy->height());
+ const SkIRect rect = SkIRect::MakeSize(proxy->dimensions());
// GrMakeCachedBitmapProxy has uploaded only the specified subset of 'bmp' so we need not
// bother with SkBitmap::getSubset
@@ -492,9 +492,7 @@
// TODO: if this becomes a bottle neck we could base this logic on what the size
// will be when it is finally instantiated - but that is more fraught.
if (GrProxyProvider::IsFunctionallyExact(fTextureProxy.get()) &&
- 0 == subset->fLeft && 0 == subset->fTop &&
- fTextureProxy->width() == subset->width() &&
- fTextureProxy->height() == subset->height()) {
+ *subset == SkIRect::MakeSize(fTextureProxy->dimensions())) {
fTextureProxy->priv().exactify(false);
// The existing GrTexture is already tight so reuse it in the SkImage
return wrap_proxy_in_image(fContext, fTextureProxy, fAlphaType, fColorSpace);
diff --git a/src/effects/imagefilters/SkDisplacementMapEffect.cpp b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
index ede0de4..8b4284d 100644
--- a/src/effects/imagefilters/SkDisplacementMapEffect.cpp
+++ b/src/effects/imagefilters/SkDisplacementMapEffect.cpp
@@ -561,7 +561,7 @@
SkISize colorDimensions;
colorDimensions.fWidth = d->fRandom->nextRangeU(0, colorProxy->width());
colorDimensions.fHeight = d->fRandom->nextRangeU(0, colorProxy->height());
- SkIRect dispRect = SkIRect::MakeWH(dispProxy->width(), dispProxy->height());
+ SkIRect dispRect = SkIRect::MakeSize(dispProxy->dimensions());
return GrDisplacementMapEffect::Make(xChannelSelector, yChannelSelector, scale,
std::move(dispProxy),
dispRect,
diff --git a/src/effects/imagefilters/SkMorphologyImageFilter.cpp b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
index 3fa7eb1..47e563b 100644
--- a/src/effects/imagefilters/SkMorphologyImageFilter.cpp
+++ b/src/effects/imagefilters/SkMorphologyImageFilter.cpp
@@ -565,7 +565,7 @@
GrColorType colorType = ctx.grColorType();
// setup new clip
- const GrFixedClip clip(SkIRect::MakeWH(srcTexture->width(), srcTexture->height()));
+ const GrFixedClip clip(SkIRect::MakeSize(srcTexture->dimensions()));
const SkIRect dstRect = SkIRect::MakeWH(rect.width(), rect.height());
SkIRect srcRect = rect;
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 7c922cb..eae8224 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -185,10 +185,10 @@
// event that MakeApprox does not change the size, reads outside the right and/or bottom will do
// the same. We should offset our filter within the render target and expand the size as needed
// to guarantee at least 1px of padding on all sides.
+ auto approxSize = GrResourceProvider::MakeApprox(maskRect.size());
auto rtContext = context->priv().makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kExact, GrResourceProvider::MakeApprox(maskRect.width()),
- GrResourceProvider::MakeApprox(maskRect.height()), GrColorType::kAlpha_8, nullptr,
- sampleCnt, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
+ SkBackingFit::kExact, approxSize.width(), approxSize.height(), GrColorType::kAlpha_8,
+ nullptr, sampleCnt, GrMipMapped::kNo, kTopLeft_GrSurfaceOrigin);
if (!rtContext) {
return nullptr;
}
diff --git a/src/gpu/GrCaps.cpp b/src/gpu/GrCaps.cpp
index 0b93e58..dd2aa36 100644
--- a/src/gpu/GrCaps.cpp
+++ b/src/gpu/GrCaps.cpp
@@ -263,7 +263,7 @@
return this->onCanCopySurface(dst, src, srcRect, dstPoint);
}
-bool GrCaps::validateSurfaceParams(const SkISize& size, const GrBackendFormat& format,
+bool GrCaps::validateSurfaceParams(const SkISize& dimensions, const GrBackendFormat& format,
GrPixelConfig config, GrRenderable renderable,
int renderTargetSampleCnt, GrMipMapped mipped) const {
if (!this->isFormatTexturable(format)) {
@@ -274,7 +274,7 @@
return false;
}
- if (size.width() < 1 || size.height() < 1) {
+ if (dimensions.width() < 1 || dimensions.height() < 1) {
return false;
}
@@ -283,7 +283,7 @@
return false;
}
int maxRTSize = this->maxRenderTargetSize();
- if (size.width() > maxRTSize || size.height() > maxRTSize) {
+ if (dimensions.width() > maxRTSize || dimensions.height() > maxRTSize) {
return false;
}
} else {
@@ -292,7 +292,7 @@
return false;
}
int maxSize = this->maxTextureSize();
- if (size.width() > maxSize || size.height() > maxSize) {
+ if (dimensions.width() > maxSize || dimensions.height() > maxSize) {
return false;
}
}
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index d9f37f0..f099361 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -256,7 +256,7 @@
const GrCaps& caps = *gpuImage->context()->priv().caps();
int colorSamplesPerPixel = 1;
- return GrSurface::ComputeSize(caps, proxy->backendFormat(), image->width(), image->height(),
+ return GrSurface::ComputeSize(caps, proxy->backendFormat(), image->dimensions(),
colorSamplesPerPixel, mipMapped, useNextPow2);
}
diff --git a/src/gpu/GrCopyRenderTask.cpp b/src/gpu/GrCopyRenderTask.cpp
index 23e8086..9e44187 100644
--- a/src/gpu/GrCopyRenderTask.cpp
+++ b/src/gpu/GrCopyRenderTask.cpp
@@ -21,7 +21,7 @@
SkIRect clippedSrcRect;
SkIPoint clippedDstPoint;
// If the rect is outside the srcProxy or dstProxy then we've already succeeded.
- if (!GrClipSrcRectAndDstPoint(dstProxy->isize(), srcProxy->isize(), srcRect, dstPoint,
+ if (!GrClipSrcRectAndDstPoint(dstProxy->dimensions(), srcProxy->dimensions(), srcRect, dstPoint,
&clippedSrcRect, &clippedDstPoint)) {
return nullptr;
}
diff --git a/src/gpu/GrOpsTask.cpp b/src/gpu/GrOpsTask.cpp
index 4d4236b..63ff79f 100644
--- a/src/gpu/GrOpsTask.cpp
+++ b/src/gpu/GrOpsTask.cpp
@@ -572,7 +572,7 @@
fColorLoadOp = op;
fLoadClearColor = color;
if (GrLoadOp::kClear == fColorLoadOp) {
- fTotalBounds.setWH(fTarget->width(), fTarget->height());
+ fTotalBounds = fTarget->getBoundsRect();
}
}
@@ -843,7 +843,7 @@
const GrCaps& caps, SkIRect* targetUpdateBounds) {
this->forwardCombine(caps);
if (!this->isNoOp()) {
- SkRect clippedContentBounds = SkRect::MakeIWH(fTarget->width(), fTarget->height());
+ SkRect clippedContentBounds = fTarget->getBoundsRect();
// TODO: If we can fix up GLPrograms test to always intersect the fTarget bounds then we can
// simply assert here that the bounds intersect.
if (clippedContentBounds.intersect(fTotalBounds)) {
diff --git a/src/gpu/GrPathRenderer.cpp b/src/gpu/GrPathRenderer.cpp
index 16d98db..d576b4c 100644
--- a/src/gpu/GrPathRenderer.cpp
+++ b/src/gpu/GrPathRenderer.cpp
@@ -81,13 +81,12 @@
SkDrawTreatAAStrokeAsHairline(stroke.getWidth(), matrix, outCoverage);
}
-
void GrPathRenderer::GetPathDevBounds(const SkPath& path,
- int devW, int devH,
+ SkISize devSize,
const SkMatrix& matrix,
SkRect* bounds) {
if (path.isInverseFillType()) {
- *bounds = SkRect::MakeWH(SkIntToScalar(devW), SkIntToScalar(devH));
+ *bounds = SkRect::Make(devSize);
return;
}
*bounds = path.getBounds();
diff --git a/src/gpu/GrPathRenderer.h b/src/gpu/GrPathRenderer.h
index a1d0741..ab61a3a 100644
--- a/src/gpu/GrPathRenderer.h
+++ b/src/gpu/GrPathRenderer.h
@@ -173,8 +173,7 @@
// Helper for getting the device bounds of a path. Inverse filled paths will have bounds set
// by devSize. Non-inverse path bounds will not necessarily be clipped to devSize.
static void GetPathDevBounds(const SkPath& path,
- int devW,
- int devH,
+ SkISize devSize,
const SkMatrix& matrix,
SkRect* bounds);
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index 6abdc24..caaa800 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -115,7 +115,7 @@
#if GR_TEST_UTILS
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
- const SkISize& size,
+ const SkISize& dimensions,
GrColorType colorType,
const GrBackendFormat& format,
GrRenderable renderable,
@@ -139,8 +139,8 @@
GrSurfaceDesc desc;
desc.fConfig = GrColorTypeToPixelConfig(colorType);
desc.fConfig = this->caps()->makeConfigSpecific(desc.fConfig, format);
- desc.fWidth = size.width();
- desc.fHeight = size.height();
+ desc.fWidth = dimensions.width();
+ desc.fHeight = dimensions.height();
GrResourceProvider* resourceProvider = direct->priv().resourceProvider();
sk_sp<GrTexture> tex;
@@ -160,7 +160,7 @@
}
sk_sp<GrTextureProxy> GrProxyProvider::testingOnly_createInstantiatedProxy(
- const SkISize& size,
+ const SkISize& dimensions,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
@@ -169,7 +169,7 @@
SkBudgeted budgeted,
GrProtected isProtected) {
auto format = this->caps()->getDefaultBackendFormat(colorType, renderable);
- return this->testingOnly_createInstantiatedProxy(size,
+ return this->testingOnly_createInstantiatedProxy(dimensions,
colorType,
format,
renderable,
@@ -881,8 +881,7 @@
// it is already instantiated and the proxy covers the entire backing surface
return proxy->priv().isExact() ||
(!isInstantiated && SkIsPow2(proxy->width()) && SkIsPow2(proxy->height())) ||
- (isInstantiated && proxy->worstCaseWidth() == proxy->width() &&
- proxy->worstCaseHeight() == proxy->height());
+ (isInstantiated && proxy->worstCaseDimensions() == proxy->dimensions());
}
void GrProxyProvider::processInvalidUniqueKey(const GrUniqueKey& key, GrTextureProxy* proxy,
diff --git a/src/gpu/GrProxyProvider.h b/src/gpu/GrProxyProvider.h
index b8de8c8..6e15367 100644
--- a/src/gpu/GrProxyProvider.h
+++ b/src/gpu/GrProxyProvider.h
@@ -246,7 +246,7 @@
* Create a texture proxy that is backed by an instantiated GrSurface.
* TODO: Remove GrColorType. Currently used to infer a GrPixelConfig.
*/
- sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const SkISize& size,
+ sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const SkISize& dimensions,
GrColorType colorType,
const GrBackendFormat& format,
GrRenderable renderable,
@@ -257,7 +257,7 @@
GrProtected isProtected);
/** Version of above that picks the default format for the color type. */
- sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const SkISize& size,
+ sk_sp<GrTextureProxy> testingOnly_createInstantiatedProxy(const SkISize& dimensions,
GrColorType colorType,
GrRenderable renderable,
int renderTargetSampleCnt,
diff --git a/src/gpu/GrRenderTarget.cpp b/src/gpu/GrRenderTarget.cpp
index 2197d63..f29eea4 100644
--- a/src/gpu/GrRenderTarget.cpp
+++ b/src/gpu/GrRenderTarget.cpp
@@ -18,14 +18,13 @@
#include "src/gpu/GrStencilAttachment.h"
#include "src/gpu/GrStencilSettings.h"
-GrRenderTarget::GrRenderTarget(GrGpu* gpu, const SkISize& size, GrPixelConfig config,
+GrRenderTarget::GrRenderTarget(GrGpu* gpu, const SkISize& dimensions, GrPixelConfig config,
int sampleCount, GrProtected isProtected,
GrStencilAttachment* stencil)
- : INHERITED(gpu, size, config, isProtected)
+ : INHERITED(gpu, dimensions, config, isProtected)
, fSampleCnt(sampleCount)
, fSamplePatternKey(GrSamplePatternDictionary::kInvalidSamplePatternKey)
- , fStencilAttachment(stencil) {
-}
+ , fStencilAttachment(stencil) {}
GrRenderTarget::~GrRenderTarget() = default;
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index 911ab7e..2db8b22 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -432,8 +432,7 @@
if (stencilSettings) {
// Must use worst case bounds so that stencil buffer updates on approximately sized render
// targets don't get corrupted.
- rtRect = SkRect::MakeWH(fRenderTargetProxy->worstCaseWidth(),
- fRenderTargetProxy->worstCaseHeight());
+ rtRect = SkRect::Make(fRenderTargetProxy->worstCaseDimensions());
} else {
// Use the logical size of the render target, which allows for "fullscreen" clears even if
// the render target has an approximate backing fit
@@ -1641,7 +1640,7 @@
size_t rowBytes(int i) const override { return fPlanes[i].fRowBytes; }
bool addTransferResult(const PixelTransferResult& result,
- SkISize size,
+ SkISize dimensions,
size_t rowBytes,
GrClientMappedBufferManager* manager) {
SkASSERT(!result.fTransferBuffer->isMapped());
@@ -1650,7 +1649,7 @@
return false;
}
if (result.fPixelConverter) {
- std::unique_ptr<char[]> convertedData(new char[rowBytes * size.height()]);
+ std::unique_ptr<char[]> convertedData(new char[rowBytes * dimensions.height()]);
result.fPixelConverter(convertedData.get(), mappedData);
this->addCpuPlane(std::move(convertedData), rowBytes);
result.fTransferBuffer->unmap();
@@ -2390,7 +2389,7 @@
}
}
- SkIRect copyRect = SkIRect::MakeWH(fRenderTargetProxy->width(), fRenderTargetProxy->height());
+ SkIRect copyRect = SkIRect::MakeSize(fRenderTargetProxy->dimensions());
SkIRect clippedRect;
clip.getConservativeBounds(
@@ -2404,8 +2403,7 @@
// performance we may ignore the clip when the draw is entirely inside the clip is float
// space but will hit pixels just outside the clip when actually rasterizing.
clippedRect.outset(1, 1);
- clippedRect.intersect(SkIRect::MakeWH(
- fRenderTargetProxy->width(), fRenderTargetProxy->height()));
+ clippedRect.intersect(SkIRect::MakeSize(fRenderTargetProxy->dimensions()));
}
SkIRect opIBounds;
opBounds.roundOut(&opIBounds);
@@ -2448,8 +2446,8 @@
const SkIRect& srcRect, const SkIPoint& dstPoint) {
SkIRect clippedSrcRect;
SkIPoint clippedDstPoint;
- if (!GrClipSrcRectAndDstPoint(this->asSurfaceProxy()->isize(), src->isize(), srcRect, dstPoint,
- &clippedSrcRect, &clippedDstPoint)) {
+ if (!GrClipSrcRectAndDstPoint(this->asSurfaceProxy()->dimensions(), src->dimensions(), srcRect,
+ dstPoint, &clippedSrcRect, &clippedDstPoint)) {
return false;
}
diff --git a/src/gpu/GrRenderTargetProxy.cpp b/src/gpu/GrRenderTargetProxy.cpp
index 6e7d3a5..c3c92e8 100644
--- a/src/gpu/GrRenderTargetProxy.cpp
+++ b/src/gpu/GrRenderTargetProxy.cpp
@@ -127,7 +127,7 @@
}
// TODO: do we have enough information to improve this worst case estimate?
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
colorSamplesPerPixel, GrMipMapped::kNo, !this->priv().isExact());
}
diff --git a/src/gpu/GrRenderTargetProxy.h b/src/gpu/GrRenderTargetProxy.h
index d4fad64..944fe81 100644
--- a/src/gpu/GrRenderTargetProxy.h
+++ b/src/gpu/GrRenderTargetProxy.h
@@ -64,7 +64,7 @@
bool wrapsVkSecondaryCB() const { return fWrapsVkSecondaryCB == WrapsVkSecondaryCB::kYes; }
void markMSAADirty(const SkIRect& dirtyRect) {
- SkASSERT(SkIRect::MakeWH(this->width(), this->height()).contains(dirtyRect));
+ SkASSERT(SkIRect::MakeSize(this->dimensions()).contains(dirtyRect));
SkASSERT(this->requiresManualMSAAResolve());
fMSAADirtyRect.join(dirtyRect);
}
diff --git a/src/gpu/GrRenderTask.cpp b/src/gpu/GrRenderTask.cpp
index a69c48b..2f6c0e6 100644
--- a/src/gpu/GrRenderTask.cpp
+++ b/src/gpu/GrRenderTask.cpp
@@ -53,7 +53,7 @@
SkIRect targetUpdateBounds;
if (ExpectedOutcome::kTargetDirty == this->onMakeClosed(caps, &targetUpdateBounds)) {
- SkASSERT(SkIRect::MakeWH(fTarget->width(), fTarget->height()).contains(targetUpdateBounds));
+ SkASSERT(SkIRect::MakeSize(fTarget->dimensions()).contains(targetUpdateBounds));
if (fTarget->requiresManualMSAAResolve()) {
SkASSERT(fTarget->asRenderTargetProxy());
fTarget->asRenderTargetProxy()->markMSAADirty(targetUpdateBounds);
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 92b71ae..b1ec572 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -28,7 +28,7 @@
#include "src/gpu/GrTexturePriv.h"
#include "src/gpu/SkGr.h"
-const uint32_t GrResourceProvider::kMinScratchTextureSize = 16;
+const int GrResourceProvider::kMinScratchTextureSize = 16;
#define ASSERT_SINGLE_OWNER \
SkDEBUGCODE(GrSingleOwner::AutoEnforce debug_SingleOwner(fSingleOwner);)
@@ -190,28 +190,31 @@
// Map 'value' to a larger multiple of 2. Values <= 'kMagicTol' will pop up to
// the next power of 2. Those above 'kMagicTol' will only go up half the floor power of 2.
-uint32_t GrResourceProvider::MakeApprox(uint32_t value) {
- static const int kMagicTol = 1024;
+SkISize GrResourceProvider::MakeApprox(SkISize dimensions) {
+ auto adjust = [](int value) {
+ static const int kMagicTol = 1024;
- value = SkTMax(kMinScratchTextureSize, value);
+ value = SkTMax(kMinScratchTextureSize, value);
- if (SkIsPow2(value)) {
+ if (SkIsPow2(value)) {
+ return value;
+ }
+
+ int ceilPow2 = SkNextPow2(value);
+ if (value <= kMagicTol) {
+ return ceilPow2;
+ }
+
+ int floorPow2 = ceilPow2 >> 1;
+ int mid = floorPow2 + (floorPow2 >> 1);
+
+ if (value <= mid) {
+ return mid;
+ }
return value;
- }
+ };
- uint32_t ceilPow2 = GrNextPow2(value);
- if (value <= kMagicTol) {
- return ceilPow2;
- }
-
- uint32_t floorPow2 = ceilPow2 >> 1;
- uint32_t mid = floorPow2 + (floorPow2 >> 1);
-
- if (value <= mid) {
- return mid;
- }
-
- return ceilPow2;
+ return {adjust(dimensions.width()), adjust(dimensions.height())};
}
sk_sp<GrTexture> GrResourceProvider::createApproxTexture(const GrSurfaceDesc& desc,
@@ -236,8 +239,9 @@
// bin by some multiple or power of 2 with a reasonable min
GrSurfaceDesc copyDesc(desc);
- copyDesc.fWidth = MakeApprox(desc.fWidth);
- copyDesc.fHeight = MakeApprox(desc.fHeight);
+ auto size = MakeApprox({desc.fWidth, desc.fHeight});
+ copyDesc.fWidth = size.width();
+ copyDesc.fHeight = size.height();
if (auto tex = this->refScratchTexture(copyDesc, format, renderable, renderTargetSampleCnt,
GrMipMapped::kNo, isProtected)) {
@@ -264,7 +268,7 @@
// to fall back to making a new texture.
if (fGpu->caps()->reuseScratchTextures() || renderable == GrRenderable::kYes) {
GrScratchKey key;
- GrTexturePriv::ComputeScratchKey(desc.fConfig, desc.fWidth, desc.fHeight, renderable,
+ GrTexturePriv::ComputeScratchKey(desc.fConfig, {desc.fWidth, desc.fHeight}, renderable,
renderTargetSampleCnt, mipMapped, isProtected, &key);
GrGpuResource* resource = fCache->findAndRefScratchResource(key);
if (resource) {
@@ -500,7 +504,7 @@
// Ensures the row bytes are populated (not 0) and makes a copy to a temporary
// to make the row bytes tight if necessary. Returns false if the input row bytes are invalid.
static bool prepare_level(const GrMipLevel& inLevel,
- const SkISize& size,
+ const SkISize& dimensions,
bool rowBytesSupport,
GrColorType origColorType,
GrColorType allowedColorType,
@@ -511,7 +515,7 @@
outLevel->fRowBytes = 0;
return true;
}
- size_t minRB = size.fWidth * GrColorTypeBytesPerPixel(origColorType);
+ size_t minRB = dimensions.fWidth * GrColorTypeBytesPerPixel(origColorType);
size_t actualRB = inLevel.fRowBytes ? inLevel.fRowBytes : minRB;
if (actualRB < minRB) {
return false;
@@ -521,12 +525,12 @@
outLevel->fPixels = inLevel.fPixels;
return true;
}
- auto tempRB = size.fWidth * GrColorTypeBytesPerPixel(allowedColorType);
- data->reset(new char[tempRB * size.fHeight]);
+ auto tempRB = dimensions.fWidth * GrColorTypeBytesPerPixel(allowedColorType);
+ data->reset(new char[tempRB * dimensions.fHeight]);
outLevel->fPixels = data->get();
outLevel->fRowBytes = tempRB;
- GrImageInfo srcInfo(origColorType, kUnpremul_SkAlphaType, nullptr, size);
- GrImageInfo dstInfo(allowedColorType, kUnpremul_SkAlphaType, nullptr, size);
+ GrImageInfo srcInfo(origColorType, kUnpremul_SkAlphaType, nullptr, dimensions);
+ GrImageInfo dstInfo(allowedColorType, kUnpremul_SkAlphaType, nullptr, dimensions);
return GrConvertPixels(dstInfo, data->get(), tempRB, srcInfo, inLevel.fPixels, actualRB);
}
diff --git a/src/gpu/GrResourceProvider.h b/src/gpu/GrResourceProvider.h
index 12d5d02..1d6230f 100644
--- a/src/gpu/GrResourceProvider.h
+++ b/src/gpu/GrResourceProvider.h
@@ -154,7 +154,7 @@
sk_sp<GrRenderTarget> wrapVulkanSecondaryCBAsRenderTarget(const SkImageInfo&,
const GrVkDrawableInfo&);
- static const uint32_t kMinScratchTextureSize;
+ static const int kMinScratchTextureSize;
/**
* Either finds and refs, or creates a static buffer with the given parameters and contents.
@@ -274,7 +274,7 @@
const GrCaps* caps() const { return fCaps.get(); }
bool overBudget() const { return fCache->overBudget(); }
- static uint32_t MakeApprox(uint32_t value);
+ static SkISize MakeApprox(SkISize);
inline GrResourceProviderPriv priv();
inline const GrResourceProviderPriv priv() const;
diff --git a/src/gpu/GrSurface.cpp b/src/gpu/GrSurface.cpp
index 90f75a8..ead9401 100644
--- a/src/gpu/GrSurface.cpp
+++ b/src/gpu/GrSurface.cpp
@@ -17,29 +17,29 @@
size_t GrSurface::ComputeSize(const GrCaps& caps,
const GrBackendFormat& format,
- int width,
- int height,
+ SkISize dimensions,
int colorSamplesPerPixel,
GrMipMapped mipMapped,
bool binSize) {
size_t colorSize;
- width = binSize ? GrResourceProvider::MakeApprox(width) : width;
- height = binSize ? GrResourceProvider::MakeApprox(height) : height;
+ if (binSize) {
+ dimensions = GrResourceProvider::MakeApprox(dimensions);
+ }
// Just setting a defualt value here to appease warnings on uninitialized object.
SkImage::CompressionType compressionType = SkImage::kETC1_CompressionType;
if (caps.isFormatCompressed(format, &compressionType)) {
- colorSize = GrCompressedFormatDataSize(compressionType, width, height);
+ colorSize = GrCompressedFormatDataSize(compressionType, dimensions);
} else {
- colorSize = (size_t)width * height * caps.bytesPerPixel(format);
+ colorSize = (size_t)dimensions.width() * dimensions.height() * caps.bytesPerPixel(format);
}
SkASSERT(colorSize > 0);
size_t finalSize = colorSamplesPerPixel * colorSize;
if (GrMipMapped::kYes == mipMapped) {
- // We don't have to worry about the mipmaps being a different size than
+ // We don't have to worry about the mipmaps being a different dimensions than
// we'd expect because we never change fDesc.fWidth/fHeight.
finalSize += colorSize/3;
}
diff --git a/src/gpu/GrSurfaceContext.h b/src/gpu/GrSurfaceContext.h
index 0bcf6a6..0d2c4b3 100644
--- a/src/gpu/GrSurfaceContext.h
+++ b/src/gpu/GrSurfaceContext.h
@@ -163,7 +163,7 @@
bool copy(GrSurfaceProxy* src, const SkIRect& srcRect, const SkIPoint& dstPoint);
bool copy(GrSurfaceProxy* src) {
- return this->copy(src, SkIRect::MakeWH(src->width(), src->height()), SkIPoint::Make(0, 0));
+ return this->copy(src, SkIRect::MakeSize(src->dimensions()), SkIPoint::Make(0, 0));
}
GrColorInfo fColorInfo;
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index baa2040..d566949 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -58,8 +58,7 @@
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fConfig(desc.fConfig)
- , fWidth(desc.fWidth)
- , fHeight(desc.fHeight)
+ , fDimensions{desc.fWidth, desc.fHeight}
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -86,8 +85,7 @@
: fSurfaceFlags(surfaceFlags)
, fFormat(format)
, fConfig(desc.fConfig)
- , fWidth(desc.fWidth)
- , fHeight(desc.fHeight)
+ , fDimensions{desc.fWidth, desc.fHeight}
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -111,8 +109,7 @@
, fSurfaceFlags(fTarget->surfacePriv().flags())
, fFormat(fTarget->backendFormat())
, fConfig(fTarget->config())
- , fWidth(fTarget->width())
- , fHeight(fTarget->height())
+ , fDimensions(fTarget->dimensions())
, fOrigin(origin)
, fTextureSwizzle(textureSwizzle)
, fFit(fit)
@@ -158,8 +155,8 @@
SkASSERT(!this->isLazy());
SkASSERT(!fTarget);
GrSurfaceDesc desc;
- desc.fWidth = fWidth;
- desc.fHeight = fHeight;
+ desc.fWidth = fDimensions.width();
+ desc.fHeight = fDimensions.height();
desc.fConfig = fConfig;
sk_sp<GrSurface> surface;
@@ -269,11 +266,8 @@
mipMapped = tp->mipMapped();
}
- int width = this->worstCaseWidth();
- int height = this->worstCaseHeight();
-
- GrTexturePriv::ComputeScratchKey(this->config(), width, height, renderable, sampleCount,
- mipMapped, fIsProtected, key);
+ GrTexturePriv::ComputeScratchKey(this->config(), this->worstCaseDimensions(), renderable,
+ sampleCount, mipMapped, fIsProtected, key);
}
void GrSurfaceProxy::setLastRenderTask(GrRenderTask* renderTask) {
@@ -291,28 +285,16 @@
return fLastRenderTask ? fLastRenderTask->asOpsTask() : nullptr;
}
-int GrSurfaceProxy::worstCaseWidth() const {
+SkISize GrSurfaceProxy::worstCaseDimensions() const {
SkASSERT(!this->isFullyLazy());
if (fTarget) {
- return fTarget->width();
+ return fTarget->dimensions();
}
if (SkBackingFit::kExact == fFit) {
- return fWidth;
+ return fDimensions;
}
- return GrResourceProvider::MakeApprox(fWidth);
-}
-
-int GrSurfaceProxy::worstCaseHeight() const {
- SkASSERT(!this->isFullyLazy());
- if (fTarget) {
- return fTarget->height();
- }
-
- if (SkBackingFit::kExact == fFit) {
- return fHeight;
- }
- return GrResourceProvider::MakeApprox(fHeight);
+ return GrResourceProvider::MakeApprox(fDimensions);
}
#ifdef SK_DEBUG
@@ -347,7 +329,7 @@
dstPoint = {0, 0};
}
- if (!srcRect.intersect(SkIRect::MakeWH(src->width(), src->height()))) {
+ if (!srcRect.intersect(SkIRect::MakeSize(src->dimensions()))) {
return nullptr;
}
auto colorType = GrPixelConfigToColorType(src->config());
@@ -380,8 +362,8 @@
GrColorType srcColorType, GrMipMapped mipMapped,
SkBackingFit fit, SkBudgeted budgeted) {
SkASSERT(!src->isFullyLazy());
- return Copy(context, src, srcColorType, mipMapped, SkIRect::MakeWH(src->width(), src->height()),
- fit, budgeted);
+ return Copy(context, src, srcColorType, mipMapped, SkIRect::MakeSize(src->dimensions()), fit,
+ budgeted);
}
#if GR_TEST_UTILS
@@ -412,8 +394,7 @@
// obliterating the area of interest information. This call (exactify) only used
// when converting an SkSpecialImage to an SkImage so the proxy shouldn't be
// used for additional draws.
- fProxy->fWidth = fProxy->fTarget->width();
- fProxy->fHeight = fProxy->fTarget->height();
+ fProxy->fDimensions = fProxy->fTarget->dimensions();
return;
}
@@ -456,8 +437,7 @@
releaseCallback = surface && result.fReleaseCallback;
}
if (!surface) {
- fProxy->fWidth = 0;
- fProxy->fHeight = 0;
+ fProxy->fDimensions.setEmpty();
return false;
}
@@ -465,12 +445,11 @@
// This was a fully lazy proxy. We need to fill in the width & height. For partially
// lazy proxies we must preserve the original width & height since that indicates
// the content area.
- fProxy->fWidth = surface->width();
- fProxy->fHeight = surface->height();
+ fProxy->fDimensions = surface->dimensions();
}
- SkASSERT(fProxy->fWidth <= surface->width());
- SkASSERT(fProxy->fHeight <= surface->height());
+ SkASSERT(fProxy->width() <= surface->width());
+ SkASSERT(fProxy->height() <= surface->height());
auto rt = fProxy->asRenderTargetProxy();
int minStencilSampleCount = rt ? rt->numSamples() : 0;
diff --git a/src/gpu/GrSurfaceProxy.h b/src/gpu/GrSurfaceProxy.h
index 7ce65d8..7dc5b6c 100644
--- a/src/gpu/GrSurfaceProxy.h
+++ b/src/gpu/GrSurfaceProxy.h
@@ -102,42 +102,32 @@
bool isLazy() const { return !this->isInstantiated() && SkToBool(fLazyInstantiateCallback); }
bool isFullyLazy() const {
- bool result = fHeight < 0;
- SkASSERT(result == (fWidth < 0));
+ bool result = fDimensions.width() < 0;
+ SkASSERT(result == (fDimensions.height() < 0));
SkASSERT(!result || this->isLazy());
return result;
}
GrPixelConfig config() const { return fConfig; }
- int width() const {
+ SkISize dimensions() const {
SkASSERT(!this->isFullyLazy());
- return fWidth;
+ return fDimensions;
}
+ int width() const { return this->dimensions().width(); }
+ int height() const { return this->dimensions().height(); }
- int height() const {
- SkASSERT(!this->isFullyLazy());
- return fHeight;
- }
+ SkISize worstCaseDimensions() const;
- SkISize isize() const { return {fWidth, fHeight}; }
-
- int worstCaseWidth() const;
- int worstCaseHeight() const;
/**
* Helper that gets the width and height of the surface as a bounding rectangle.
*/
- SkRect getBoundsRect() const {
- SkASSERT(!this->isFullyLazy());
- return SkRect::MakeIWH(this->width(), this->height());
- }
+ SkRect getBoundsRect() const { return SkRect::Make(this->dimensions()); }
+
/**
* Helper that gets the worst case width and height of the surface as a bounding rectangle.
*/
- SkRect getWorstCaseBoundsRect() const {
- SkASSERT(!this->isFullyLazy());
- return SkRect::MakeIWH(this->worstCaseWidth(), this->worstCaseHeight());
- }
+ SkRect getWorstCaseBoundsRect() const { return SkRect::Make(this->worstCaseDimensions()); }
GrSurfaceOrigin origin() const {
SkASSERT(kTopLeft_GrSurfaceOrigin == fOrigin || kBottomLeft_GrSurfaceOrigin == fOrigin);
@@ -365,15 +355,14 @@
sk_sp<GrSurface> createSurfaceImpl(GrResourceProvider*, int sampleCnt,
int minStencilSampleCount, GrRenderable, GrMipMapped) const;
- // Once the size of a fully-lazy proxy is decided, and before it gets instantiated, the client
- // can use this optional method to specify the proxy's size. (A proxy's size can be less than
- // the GPU surface that backs it. e.g., SkBackingFit::kApprox.) Otherwise, the proxy's size will
- // be set to match the underlying GPU surface upon instantiation.
- void setLazySize(int width, int height) {
+ // Once the dimensions of a fully-lazy proxy are decided, and before it gets instantiated, the
+ // client can use this optional method to specify the proxy's dimensions. (A proxy's dimensions
+ // can be less than the GPU surface that backs it. e.g., SkBackingFit::kApprox.) Otherwise,
+ // the proxy's dimensions will be set to match the underlying GPU surface upon instantiation.
+ void setLazyDimensions(SkISize dimensions) {
SkASSERT(this->isFullyLazy());
- SkASSERT(width > 0 && height > 0);
- fWidth = width;
- fHeight = height;
+ SkASSERT(!dimensions.isEmpty());
+ fDimensions = dimensions;
}
bool instantiateImpl(GrResourceProvider* resourceProvider, int sampleCnt,
@@ -396,8 +385,7 @@
// be filled in from the wrapped resource.
const GrBackendFormat fFormat;
const GrPixelConfig fConfig;
- int fWidth;
- int fHeight;
+ SkISize fDimensions;
const GrSurfaceOrigin fOrigin;
const GrSwizzle fTextureSwizzle;
diff --git a/src/gpu/GrSurfaceProxyPriv.h b/src/gpu/GrSurfaceProxyPriv.h
index 60704ac..7377651 100644
--- a/src/gpu/GrSurfaceProxyPriv.h
+++ b/src/gpu/GrSurfaceProxyPriv.h
@@ -34,7 +34,7 @@
// Don't. Just don't.
void exactify(bool allocatedCaseOnly);
- void setLazySize(int width, int height) { fProxy->setLazySize(width, height); }
+ void setLazyDimensions(SkISize dimensions) { fProxy->setLazyDimensions(dimensions); }
bool doLazyInstantiation(GrResourceProvider*);
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index df0f2eb..2373610 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -32,14 +32,18 @@
size_t GrTexture::onGpuMemorySize() const {
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
- 1, this->texturePriv().mipMapped());
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), 1,
+ this->texturePriv().mipMapped());
}
/////////////////////////////////////////////////////////////////////////////
-GrTexture::GrTexture(GrGpu* gpu, const SkISize& size, GrPixelConfig config, GrProtected isProtected,
- GrTextureType textureType, GrMipMapsStatus mipMapsStatus)
- : INHERITED(gpu, size, config, isProtected)
+GrTexture::GrTexture(GrGpu* gpu,
+ const SkISize& dimensions,
+ GrPixelConfig config,
+ GrProtected isProtected,
+ GrTextureType textureType,
+ GrMipMapsStatus mipMapsStatus)
+ : INHERITED(gpu, dimensions, config, isProtected)
, fTextureType(textureType)
, fMipMapsStatus(mipMapsStatus) {
if (GrMipMapsStatus::kNotAllocated == fMipMapsStatus) {
@@ -88,23 +92,21 @@
renderable = GrRenderable::kYes;
}
auto isProtected = this->isProtected() ? GrProtected::kYes : GrProtected::kNo;
- GrTexturePriv::ComputeScratchKey(this->config(), this->width(), this->height(), renderable,
+ GrTexturePriv::ComputeScratchKey(this->config(), this->dimensions(), renderable,
sampleCount, this->texturePriv().mipMapped(), isProtected,
key);
}
}
void GrTexturePriv::ComputeScratchKey(GrPixelConfig config,
- int width,
- int height,
+ SkISize dimensions,
GrRenderable renderable,
int sampleCnt,
GrMipMapped mipMapped,
GrProtected isProtected,
GrScratchKey* key) {
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType();
- SkASSERT(width > 0);
- SkASSERT(height > 0);
+ SkASSERT(!dimensions.isEmpty());
SkASSERT(sampleCnt > 0);
SkASSERT(1 == sampleCnt || renderable == GrRenderable::kYes);
@@ -117,8 +119,8 @@
SkASSERT(static_cast<uint32_t>(sampleCnt) < (1 << (32 - 8)));
GrScratchKey::Builder builder(key, kType, 3);
- builder[0] = width;
- builder[1] = height;
+ builder[0] = dimensions.width();
+ builder[1] = dimensions.height();
builder[2] = (static_cast<uint32_t>(config) << 0)
| (static_cast<uint32_t>(mipMapped) << 5)
| (static_cast<uint32_t>(isProtected) << 6)
diff --git a/src/gpu/GrTexturePriv.h b/src/gpu/GrTexturePriv.h
index 4ce3e05..309e46d 100644
--- a/src/gpu/GrTexturePriv.h
+++ b/src/gpu/GrTexturePriv.h
@@ -54,8 +54,7 @@
}
static void ComputeScratchKey(GrPixelConfig config,
- int width,
- int height,
+ SkISize dimensions,
GrRenderable,
int sampleCnt,
GrMipMapped,
diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp
index 7b54e9c..61feebd 100644
--- a/src/gpu/GrTextureProducer.cpp
+++ b/src/gpu/GrTextureProducer.cpp
@@ -30,7 +30,7 @@
const SkRect dstRect = SkRect::MakeIWH(copyParams.fWidth, copyParams.fHeight);
GrMipMapped mipMapped = dstWillRequireMipMaps ? GrMipMapped::kYes : GrMipMapped::kNo;
- SkRect localRect = SkRect::MakeWH(inputProxy->width(), inputProxy->height());
+ SkRect localRect = inputProxy->getBoundsRect();
bool needsDomain = false;
bool resizing = false;
@@ -97,7 +97,7 @@
GrTextureProxy* proxy,
const GrSamplerState::Filter* filterModeOrNullForBicubic,
SkRect* domainRect) {
- const SkIRect proxyBounds = SkIRect::MakeWH(proxy->width(), proxy->height());
+ const SkIRect proxyBounds = SkIRect::MakeSize(proxy->dimensions());
SkASSERT(proxyBounds.contains(constraintRect));
diff --git a/src/gpu/GrTextureProxy.cpp b/src/gpu/GrTextureProxy.cpp
index ba8530e..d9c90b7 100644
--- a/src/gpu/GrTextureProxy.cpp
+++ b/src/gpu/GrTextureProxy.cpp
@@ -144,8 +144,8 @@
}
size_t GrTextureProxy::onUninstantiatedGpuMemorySize(const GrCaps& caps) const {
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
- 1, this->proxyMipMapped(), !this->priv().isExact());
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), 1,
+ this->proxyMipMapped(), !this->priv().isExact());
}
bool GrTextureProxy::ProxiesAreCompatibleAsDynamicState(const GrTextureProxy* first,
diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp
index ae70c0f..0c1a2cc 100644
--- a/src/gpu/GrTextureRenderTargetProxy.cpp
+++ b/src/gpu/GrTextureRenderTargetProxy.cpp
@@ -114,7 +114,7 @@
}
// TODO: do we have enough information to improve this worst case estimate?
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
colorSamplesPerPixel, this->proxyMipMapped(),
!this->priv().isExact());
}
diff --git a/src/gpu/GrYUVProvider.cpp b/src/gpu/GrYUVProvider.cpp
index b61b8c3..e6003bf 100644
--- a/src/gpu/GrYUVProvider.cpp
+++ b/src/gpu/GrYUVProvider.cpp
@@ -153,8 +153,7 @@
yuvTextureProxies[i] =
proxyProvider->createTextureProxy(yuvImage, 1, SkBudgeted::kYes, fit);
- SkASSERT(yuvTextureProxies[i]->width() == yuvSizeInfo.fSizes[i].fWidth);
- SkASSERT(yuvTextureProxies[i]->height() == yuvSizeInfo.fSizes[i].fHeight);
+ SkASSERT(yuvTextureProxies[i]->dimensions() == yuvSizeInfo.fSizes[i]);
}
// TODO: investigate preallocating mip maps here
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 22b2238..412c008 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -670,7 +670,7 @@
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkMatrix& srcToDstRect,
- const SkISize& imageSize,
+ const SkISize& imageDimensions,
const SkRect* srcRectPtr,
SkIRect* clippedSrcIRect) {
clip.getConservativeBounds(width, height, clippedSrcIRect, nullptr);
@@ -688,7 +688,7 @@
}
}
clippedSrcRect.roundOut(clippedSrcIRect);
- SkIRect bmpBounds = SkIRect::MakeSize(imageSize);
+ SkIRect bmpBounds = SkIRect::MakeSize(imageDimensions);
if (!clippedSrcIRect->intersect(bmpBounds)) {
clippedSrcIRect->setEmpty();
}
@@ -1200,7 +1200,7 @@
return nullptr;
}
- const SkIRect rect = SkIRect::MakeWH(proxy->width(), proxy->height());
+ const SkIRect rect = SkIRect::MakeSize(proxy->dimensions());
// GrMakeCachedBitmapProxy creates a tight copy of 'bitmap' so we don't have to subset
// the special image
@@ -1266,7 +1266,7 @@
// Since this copied only the requested subset, the special image wrapping the proxy no
// longer needs the original subset.
- finalSubset = SkIRect::MakeSize(proxy->isize());
+ finalSubset = SkIRect::MakeSize(proxy->dimensions());
}
GrColorType ct = SkColorTypeToGrColorType(this->imageInfo().colorType());
diff --git a/src/gpu/SkGpuDevice_drawTexture.cpp b/src/gpu/SkGpuDevice_drawTexture.cpp
index 809ac10..f3a3546 100644
--- a/src/gpu/SkGpuDevice_drawTexture.cpp
+++ b/src/gpu/SkGpuDevice_drawTexture.cpp
@@ -201,7 +201,7 @@
// 1/2 pixel for AA and 1/2 pixel for bilerp
float buffer = 0.5f * (aa == GrAA::kYes) +
0.5f * (filter == GrSamplerState::Filter::kBilerp);
- SkRect safeBounds = SkRect::MakeWH(proxy->width(), proxy->height());
+ SkRect safeBounds = proxy->getBoundsRect();
safeBounds.inset(buffer, buffer);
if (!safeBounds.contains(srcRect)) {
constraint = SkCanvas::kStrict_SrcRectConstraint;
diff --git a/src/gpu/ccpr/GrCCAtlas.cpp b/src/gpu/ccpr/GrCCAtlas.cpp
index 55d8f97..d0639bf 100644
--- a/src/gpu/ccpr/GrCCAtlas.cpp
+++ b/src/gpu/ccpr/GrCCAtlas.cpp
@@ -226,7 +226,7 @@
// Finalize the content size of our proxy. The GPU can potentially make optimizations if it
// knows we only intend to write out a smaller sub-rectangle of the backing texture.
- fTextureProxy->priv().setLazySize(fDrawBounds.width(), fDrawBounds.height());
+ fTextureProxy->priv().setLazyDimensions(fDrawBounds);
if (backingTexture) {
#ifdef SK_DEBUG
diff --git a/src/gpu/dawn/GrDawnGpu.cpp b/src/gpu/dawn/GrDawnGpu.cpp
index 54c7c56..186c1e6 100644
--- a/src/gpu/dawn/GrDawnGpu.cpp
+++ b/src/gpu/dawn/GrDawnGpu.cpp
@@ -230,12 +230,12 @@
return nullptr;
}
- SkISize size = { backendTex.width(), backendTex.height() };
+ SkISize dimensions = { backendTex.width(), backendTex.height() };
GrPixelConfig config = this->caps()->getConfigFromBackendFormat(backendTex.getBackendFormat(),
colorType);
GrMipMapsStatus status = GrMipMapsStatus::kNotAllocated;
- return GrDawnTexture::MakeWrapped(this, size, config, GrRenderable::kNo, 1, status, cacheable,
- info);
+ return GrDawnTexture::MakeWrapped(this, dimensions, config, GrRenderable::kNo, 1, status,
+ cacheable, info);
}
sk_sp<GrTexture> GrDawnGpu::onWrapRenderableBackendTexture(const GrBackendTexture& tex,
@@ -247,7 +247,7 @@
return nullptr;
}
- SkISize size = { tex.width(), tex.height() };
+ SkISize dimensions = { tex.width(), tex.height() };
GrPixelConfig config = this->caps()->getConfigFromBackendFormat(tex.getBackendFormat(),
colorType);
sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, tex.getBackendFormat());
@@ -256,8 +256,8 @@
}
GrMipMapsStatus status = GrMipMapsStatus::kNotAllocated;
- return GrDawnTexture::MakeWrapped(this, size, config, GrRenderable::kYes, sampleCnt, status,
- cacheable, info);
+ return GrDawnTexture::MakeWrapped(this, dimensions, config, GrRenderable::kYes, sampleCnt,
+ status, cacheable, info);
}
sk_sp<GrRenderTarget> GrDawnGpu::onWrapBackendRenderTarget(const GrBackendRenderTarget& rt,
@@ -267,11 +267,11 @@
return nullptr;
}
- SkISize size = { rt.width(), rt.height() };
+ SkISize dimensions = { rt.width(), rt.height() };
GrPixelConfig config = this->caps()->getConfigFromBackendFormat(rt.getBackendFormat(),
colorType);
int sampleCnt = 1;
- return GrDawnRenderTarget::MakeWrapped(this, size, config, sampleCnt, info);
+ return GrDawnRenderTarget::MakeWrapped(this, dimensions, config, sampleCnt, info);
}
sk_sp<GrRenderTarget> GrDawnGpu::onWrapBackendTextureAsRenderTarget(const GrBackendTexture& tex,
@@ -282,7 +282,7 @@
return nullptr;
}
- SkISize size = { tex.width(), tex.height() };
+ SkISize dimensions = { tex.width(), tex.height() };
GrPixelConfig config = this->caps()->getConfigFromBackendFormat(tex.getBackendFormat(),
colorType);
sampleCnt = this->caps()->getRenderTargetSampleCount(sampleCnt, tex.getBackendFormat());
@@ -290,7 +290,7 @@
return nullptr;
}
- return GrDawnRenderTarget::MakeWrapped(this, size, config, sampleCnt, info);
+ return GrDawnRenderTarget::MakeWrapped(this, dimensions, config, sampleCnt, info);
}
GrStencilAttachment* GrDawnGpu::createStencilAttachmentForRenderTarget(const GrRenderTarget* rt,
diff --git a/src/gpu/dawn/GrDawnProgramBuilder.cpp b/src/gpu/dawn/GrDawnProgramBuilder.cpp
index 84e4067..a1e3693 100644
--- a/src/gpu/dawn/GrDawnProgramBuilder.cpp
+++ b/src/gpu/dawn/GrDawnProgramBuilder.cpp
@@ -474,12 +474,11 @@
}
// set RT adjustment
- SkISize size;
- size.set(rt->width(), rt->height());
+ SkISize dimensions = rt->dimensions();
SkASSERT(fBuiltinUniformHandles.fRTAdjustmentUni.isValid());
if (fRenderTargetState.fRenderTargetOrigin != origin ||
- fRenderTargetState.fRenderTargetSize != size) {
- fRenderTargetState.fRenderTargetSize = size;
+ fRenderTargetState.fRenderTargetSize != dimensions) {
+ fRenderTargetState.fRenderTargetSize = dimensions;
fRenderTargetState.fRenderTargetOrigin = origin;
float rtAdjustmentVec[4];
diff --git a/src/gpu/dawn/GrDawnRenderTarget.cpp b/src/gpu/dawn/GrDawnRenderTarget.cpp
index a75ab13..36c1fce 100644
--- a/src/gpu/dawn/GrDawnRenderTarget.cpp
+++ b/src/gpu/dawn/GrDawnRenderTarget.cpp
@@ -12,22 +12,20 @@
#include "src/gpu/dawn/GrDawnUtil.h"
GrDawnRenderTarget::GrDawnRenderTarget(GrDawnGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrPixelConfig config,
int sampleCnt,
const GrDawnImageInfo& info)
- : GrSurface(gpu, size, config, GrProtected::kNo)
- , GrRenderTarget(gpu, size, config, sampleCnt, GrProtected::kNo)
- , fInfo(info) {
-}
+ : GrSurface(gpu, size, config, GrProtected::kNo)
+ , GrRenderTarget(gpu, dimensions, config, sampleCnt, GrProtected::kNo)
+ , fInfo(info) {}
-sk_sp<GrDawnRenderTarget>
-GrDawnRenderTarget::MakeWrapped(GrDawnGpu* gpu,
- const SkISize& size,
- GrPixelConfig config,
- int sampleCnt,
- const GrDawnImageInfo& info) {
- sk_sp<GrDawnRenderTarget> rt(new GrDawnRenderTarget(gpu, size, config, sampleCnt, info));
+sk_sp<GrDawnRenderTarget> GrDawnRenderTarget::MakeWrapped(GrDawnGpu* gpu,
+ const SkISize& dimensions,
+ GrPixelConfig config,
+ int sampleCnt,
+ const GrDawnImageInfo& info) {
+ sk_sp<GrDawnRenderTarget> rt(new GrDawnRenderTarget(gpu, dimensions, config, sampleCnt, info));
rt->registerWithCacheWrapped(GrWrapCacheable::kNo);
return rt;
}
@@ -36,8 +34,8 @@
// The plus 1 is to account for the resolve texture or if not using msaa the RT itself
int numSamples = this->numSamples() + 1;
const GrCaps& caps = *getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
- numSamples, GrMipMapped::kNo);
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(), numSamples,
+ GrMipMapped::kNo);
}
bool GrDawnRenderTarget::completeStencilAttachment() {
diff --git a/src/gpu/dawn/GrDawnRenderTarget.h b/src/gpu/dawn/GrDawnRenderTarget.h
index fe5c77f..0af2a49 100644
--- a/src/gpu/dawn/GrDawnRenderTarget.h
+++ b/src/gpu/dawn/GrDawnRenderTarget.h
@@ -15,7 +15,7 @@
class GrDawnRenderTarget: public GrRenderTarget {
public:
- static sk_sp<GrDawnRenderTarget> MakeWrapped(GrDawnGpu*, const SkISize& size,
+ static sk_sp<GrDawnRenderTarget> MakeWrapped(GrDawnGpu*, const SkISize& dimensions,
GrPixelConfig config, int sampleCnt,
const GrDawnImageInfo&);
@@ -31,7 +31,7 @@
protected:
GrDawnRenderTarget(GrDawnGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrPixelConfig config,
int sampleCnt,
const GrDawnImageInfo& info);
diff --git a/src/gpu/dawn/GrDawnTexture.cpp b/src/gpu/dawn/GrDawnTexture.cpp
index e377fcf..795f439 100644
--- a/src/gpu/dawn/GrDawnTexture.cpp
+++ b/src/gpu/dawn/GrDawnTexture.cpp
@@ -13,20 +13,20 @@
#include "src/gpu/dawn/GrDawnUtil.h"
GrDawnTexture::GrDawnTexture(GrDawnGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrPixelConfig config,
dawn::TextureView textureView,
const GrDawnImageInfo& info,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, size, config, GrProtected::kNo)
- , GrTexture(gpu, size, config, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus)
- , fInfo(info)
- , fTextureView(textureView) {
-}
+ : GrSurface(gpu, dimensions, config, GrProtected::kNo)
+ , GrTexture(gpu, dimensions, config, GrProtected::kNo, GrTextureType::k2D, mipMapsStatus)
+ , fInfo(info)
+ , fTextureView(textureView) {}
-sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, const SkISize& size, GrPixelConfig config,
- dawn::TextureFormat format, GrRenderable renderable,
- int sampleCnt, SkBudgeted budgeted, int mipLevels,
+sk_sp<GrDawnTexture> GrDawnTexture::Make(GrDawnGpu* gpu, const SkISize& dimensions,
+ GrPixelConfig config, dawn::TextureFormat format,
+ GrRenderable renderable, int sampleCnt,
+ SkBudgeted budgeted, int mipLevels,
GrMipMapsStatus status) {
bool renderTarget = renderable == GrRenderable::kYes;
dawn::TextureDescriptor textureDesc;
@@ -40,8 +40,8 @@
textureDesc.usage |= dawn::TextureUsage::OutputAttachment;
}
- textureDesc.size.width = size.fWidth;
- textureDesc.size.height = size.fHeight;
+ textureDesc.size.width = dimensions.fWidth;
+ textureDesc.size.height = dimensions.fHeight;
textureDesc.size.depth = 1;
textureDesc.format = format;
textureDesc.mipLevelCount = std::max(mipLevels, 1);
@@ -66,15 +66,15 @@
sk_sp<GrDawnTexture> result;
if (renderTarget) {
result = sk_sp<GrDawnTextureRenderTarget>(new GrDawnTextureRenderTarget(gpu,
- size,
+ dimensions,
config,
textureView,
sampleCnt,
info,
status));
} else {
- result = sk_sp<GrDawnTexture>(new GrDawnTexture(gpu, size, config, textureView, info,
- status));
+ result = sk_sp<GrDawnTexture>(
+ new GrDawnTexture(gpu, dimensions, config, textureView, info, status));
}
result->registerWithCache(budgeted);
return result;
@@ -84,7 +84,7 @@
return GrBackendFormat::MakeDawn(fInfo.fFormat);
}
-sk_sp<GrDawnTexture> GrDawnTexture::MakeWrapped(GrDawnGpu* gpu, const SkISize& size,
+sk_sp<GrDawnTexture> GrDawnTexture::MakeWrapped(GrDawnGpu* gpu, const SkISize& dimensions,
GrPixelConfig config, GrRenderable renderable,
int sampleCnt, GrMipMapsStatus status,
GrWrapCacheable cacheable,
@@ -96,10 +96,11 @@
sk_sp<GrDawnTexture> tex;
if (GrRenderable::kYes == renderable) {
- tex = sk_sp<GrDawnTexture>(new GrDawnTextureRenderTarget(gpu, size, config, textureView,
- sampleCnt, info, status));
+ tex = sk_sp<GrDawnTexture>(new GrDawnTextureRenderTarget(
+ gpu, dimensions, config, textureView, sampleCnt, info, status));
} else {
- tex = sk_sp<GrDawnTexture>(new GrDawnTexture(gpu, size, config, textureView, info, status));
+ tex = sk_sp<GrDawnTexture>(
+ new GrDawnTexture(gpu, dimensions, config, textureView, info, status));
}
tex->registerWithCacheWrapped(cacheable);
return tex;
diff --git a/src/gpu/dawn/GrDawnTexture.h b/src/gpu/dawn/GrDawnTexture.h
index cc69fd7..bbea6f8 100644
--- a/src/gpu/dawn/GrDawnTexture.h
+++ b/src/gpu/dawn/GrDawnTexture.h
@@ -16,12 +16,12 @@
class GrDawnTexture : public GrTexture {
public:
- static sk_sp<GrDawnTexture> Make(GrDawnGpu*, const SkISize& size, GrPixelConfig config,
+ static sk_sp<GrDawnTexture> Make(GrDawnGpu*, const SkISize& dimensions, GrPixelConfig config,
dawn::TextureFormat format, GrRenderable, int sampleCnt,
SkBudgeted, int mipLevels, GrMipMapsStatus);
- static sk_sp<GrDawnTexture> MakeWrapped(GrDawnGpu*, const SkISize& size, GrPixelConfig config,
- GrRenderable, int sampleCnt,
+ static sk_sp<GrDawnTexture> MakeWrapped(GrDawnGpu*, const SkISize& dimensions,
+ GrPixelConfig config, GrRenderable, int sampleCnt,
GrMipMapsStatus, GrWrapCacheable,
const GrDawnImageInfo&);
@@ -39,8 +39,8 @@
dawn::Texture texture() const { return fInfo.fTexture; }
dawn::TextureView textureView() const { return fTextureView; }
protected:
- GrDawnTexture(GrDawnGpu*, const SkISize& size, GrPixelConfig config,
- dawn::TextureView, const GrDawnImageInfo&, GrMipMapsStatus);
+ GrDawnTexture(GrDawnGpu*, const SkISize& dimensions, GrPixelConfig config, dawn::TextureView,
+ const GrDawnImageInfo&, GrMipMapsStatus);
GrDawnGpu* getDawnGpu() const;
diff --git a/src/gpu/dawn/GrDawnTextureRenderTarget.cpp b/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
index a9e70d7..e453379 100644
--- a/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
+++ b/src/gpu/dawn/GrDawnTextureRenderTarget.cpp
@@ -13,16 +13,15 @@
#include "src/gpu/dawn/GrDawnGpu.h"
GrDawnTextureRenderTarget::GrDawnTextureRenderTarget(GrDawnGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrPixelConfig config,
dawn::TextureView textureView,
int sampleCnt,
const GrDawnImageInfo& info,
GrMipMapsStatus mipMapsStatus)
- : GrSurface(gpu, size, config, GrProtected::kNo)
- , GrDawnTexture(gpu, size, config, textureView, info, mipMapsStatus)
- , GrDawnRenderTarget(gpu, size, config, sampleCnt, info) {
-}
+ : GrSurface(gpu, dimensions, config, GrProtected::kNo)
+ , GrDawnTexture(gpu, dimensions, config, textureView, info, mipMapsStatus)
+ , GrDawnRenderTarget(gpu, dimensions, config, sampleCnt, info) {}
bool GrDawnTextureRenderTarget::canAttemptStencilAttachment() const {
return true;
@@ -30,7 +29,7 @@
size_t GrDawnTextureRenderTarget::onGpuMemorySize() const {
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
1, // FIXME: for MSAA
this->texturePriv().mipMapped());
}
diff --git a/src/gpu/dawn/GrDawnTextureRenderTarget.h b/src/gpu/dawn/GrDawnTextureRenderTarget.h
index 69c94b0..73dbcc5 100644
--- a/src/gpu/dawn/GrDawnTextureRenderTarget.h
+++ b/src/gpu/dawn/GrDawnTextureRenderTarget.h
@@ -22,7 +22,7 @@
class GrDawnTextureRenderTarget : public GrDawnTexture, public GrDawnRenderTarget {
public:
GrDawnTextureRenderTarget(GrDawnGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrPixelConfig config,
const dawn::TextureView textureView,
int sampleCnt,
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index a2dc249..5e274e0 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -86,8 +86,13 @@
Direction direction,
SkAlphaType alphaType,
const SkRect* domain = nullptr) {
- SkRect resolvedDomain = domain ? *domain : GrTextureDomain::MakeTexelDomain(
- SkIRect::MakeWH(proxy->width(), proxy->height()), modeX, modeY);
+ SkRect resolvedDomain;
+ if (domain) {
+ resolvedDomain = *domain;
+ } else {
+ resolvedDomain = GrTextureDomain::MakeTexelDomain(
+ SkIRect::MakeSize(proxy->dimensions()), modeX, modeY);
+ }
return std::unique_ptr<GrFragmentProcessor>(
new GrBicubicEffect(std::move(proxy), srcColorType, matrix, resolvedDomain,
wrapModes, modeX, modeY, direction, alphaType));
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 5bbe8fb..c58eb82 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -149,11 +149,11 @@
this->setVertexAttributes(&fInPosition, 3);
if (numActiveProxies) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numActiveProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
proxies[i]->textureSwizzle());
}
@@ -166,12 +166,12 @@
SkASSERT(numActiveProxies <= kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numActiveProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
if (!fTextureSamplers[i].isInitialized()) {
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index 321aef5..50ddb47 100644
--- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp
+++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
@@ -236,11 +236,11 @@
this->setVertexAttributes(&fInPosition, 3);
if (numProxies) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
proxies[i]->textureSwizzle());
}
@@ -253,12 +253,12 @@
SkASSERT(numProxies <= kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
if (!fTextureSamplers[i].isInitialized()) {
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
proxies[i]->textureSwizzle());
@@ -531,12 +531,12 @@
this->setVertexAttributes(&fInPosition, 3);
if (numProxies) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
proxies[i]->textureSwizzle());
}
@@ -549,12 +549,12 @@
SkASSERT(numProxies <= kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
if (!fTextureSamplers[i].isInitialized()) {
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
@@ -855,12 +855,12 @@
this->setVertexAttributes(&fInPosition, 3);
if (numProxies) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
proxies[i]->textureSwizzle());
}
@@ -873,12 +873,12 @@
SkASSERT(numProxies <= kMaxTextures);
if (!fTextureSamplers[0].isInitialized()) {
- fAtlasSize = proxies[0]->isize();
+ fAtlasSize = proxies[0]->dimensions();
}
for (int i = 0; i < numProxies; ++i) {
SkASSERT(proxies[i]);
- SkASSERT(proxies[i]->isize() == fAtlasSize);
+ SkASSERT(proxies[i]->dimensions() == fAtlasSize);
if (!fTextureSamplers[i].isInitialized()) {
fTextureSamplers[i].reset(params, proxies[i]->backendFormat(),
diff --git a/src/gpu/effects/GrRRectBlurEffect.fp b/src/gpu/effects/GrRRectBlurEffect.fp
index b0b770e..3ee1eea 100644
--- a/src/gpu/effects/GrRRectBlurEffect.fp
+++ b/src/gpu/effects/GrRRectBlurEffect.fp
@@ -31,7 +31,7 @@
@class {
static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrRecordingContext* context,
const SkRRect& rrectToDraw,
- const SkISize& size,
+ const SkISize& dimensions,
float xformedSigma) {
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
@@ -57,8 +57,8 @@
// 1) The texture coords would need to be updated.
// 2) We would have to use GrTextureDomain::kClamp_Mode for the GaussianBlur.
auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kExact, size.fWidth, size.fHeight, GrColorType::kAlpha_8,
- nullptr);
+ SkBackingFit::kExact, dimensions.fWidth, dimensions.fHeight,
+ GrColorType::kAlpha_8, nullptr);
if (!rtc) {
return nullptr;
}
@@ -81,7 +81,7 @@
rtc->colorInfo().alphaType(),
SkIPoint::Make(0, 0),
nullptr,
- SkIRect::MakeWH(size.fWidth, size.fHeight),
+ SkIRect::MakeSize(dimensions),
SkIRect::EmptyIRect(),
xformedSigma,
xformedSigma,
@@ -132,7 +132,7 @@
// sufficiently small relative to both the size of the corner radius and the
// width (and height) of the rrect.
SkRRect rrectToDraw;
- SkISize size;
+ SkISize dimensions;
SkScalar ignored[kSkBlurRRectMaxDivisions];
int ignoredSize;
uint32_t ignored32;
@@ -140,7 +140,7 @@
bool ninePatchable = SkComputeBlurredRRectParams(srcRRect, devRRect,
SkRect::MakeEmpty(),
sigma, xformedSigma,
- &rrectToDraw, &size,
+ &rrectToDraw, &dimensions,
ignored, ignored,
ignored, ignored,
&ignoredSize, &ignoredSize,
@@ -150,7 +150,7 @@
}
sk_sp<GrTextureProxy> mask(find_or_create_rrect_blur_mask(context, rrectToDraw,
- size, xformedSigma));
+ dimensions, xformedSigma));
if (!mask) {
return nullptr;
}
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 25b5bb3..8bb662b 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -32,7 +32,7 @@
return;
}
- const SkRect kFullRect = SkRect::MakeIWH(proxy->width(), proxy->height());
+ const SkRect kFullRect = proxy->getBoundsRect();
// We don't currently handle domains that are empty or don't intersect the texture.
// It is OK if the domain rect is a line or point, but it should not be inverted. We do not
diff --git a/src/gpu/effects/GrYUVtoRGBEffect.cpp b/src/gpu/effects/GrYUVtoRGBEffect.cpp
index a82aec7..0de89f1 100644
--- a/src/gpu/effects/GrYUVtoRGBEffect.cpp
+++ b/src/gpu/effects/GrYUVtoRGBEffect.cpp
@@ -44,7 +44,7 @@
int numPlanes;
SkAssertResult(SkYUVAIndex::AreValidIndices(yuvaIndices, &numPlanes));
- const SkISize YSize = proxies[yuvaIndices[SkYUVAIndex::kY_Index].fIndex]->isize();
+ const SkISize YDimensions = proxies[yuvaIndices[SkYUVAIndex::kY_Index].fIndex]->dimensions();
GrSamplerState::Filter minimizeFilterMode = GrSamplerState::Filter::kMipMap == filterMode ?
GrSamplerState::Filter::kMipMap :
@@ -53,10 +53,11 @@
GrSamplerState::Filter filterModes[4];
SkSize scales[4];
for (int i = 0; i < numPlanes; ++i) {
- SkISize size = proxies[i]->isize();
- scales[i] = SkSize::Make(SkIntToScalar(size.width()) / SkIntToScalar(YSize.width()),
- SkIntToScalar(size.height()) / SkIntToScalar(YSize.height()));
- filterModes[i] = (size == YSize) ? filterMode : minimizeFilterMode;
+ SkISize dimensions = proxies[i]->dimensions();
+ scales[i] = SkSize::Make(
+ SkIntToScalar(dimensions.width()) / SkIntToScalar(YDimensions.width()),
+ SkIntToScalar(dimensions.height()) / SkIntToScalar(YDimensions.height()));
+ filterModes[i] = (dimensions == YDimensions) ? filterMode : minimizeFilterMode;
}
return std::unique_ptr<GrFragmentProcessor>(new GrYUVtoRGBEffect(
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.cpp b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
index 88ab11a..630c66c 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.cpp
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.cpp
@@ -27,20 +27,20 @@
// sufficiently small relative to both the size of the corner radius and the
// width (and height) of the rrect.
SkRRect rrectToDraw;
- SkISize size;
+ SkISize dimensions;
SkScalar ignored[kSkBlurRRectMaxDivisions];
int ignoredSize;
uint32_t ignored32;
bool ninePatchable = SkComputeBlurredRRectParams(
- srcRRect, devRRect, SkRect::MakeEmpty(), sigma, xformedSigma, &rrectToDraw, &size,
+ srcRRect, devRRect, SkRect::MakeEmpty(), sigma, xformedSigma, &rrectToDraw, &dimensions,
ignored, ignored, ignored, ignored, &ignoredSize, &ignoredSize, &ignored32);
if (!ninePatchable) {
return nullptr;
}
sk_sp<GrTextureProxy> mask(
- find_or_create_rrect_blur_mask(context, rrectToDraw, size, xformedSigma));
+ find_or_create_rrect_blur_mask(context, rrectToDraw, dimensions, xformedSigma));
if (!mask) {
return nullptr;
}
diff --git a/src/gpu/effects/generated/GrRRectBlurEffect.h b/src/gpu/effects/generated/GrRRectBlurEffect.h
index 436f604..9a3ff66 100644
--- a/src/gpu/effects/generated/GrRRectBlurEffect.h
+++ b/src/gpu/effects/generated/GrRRectBlurEffect.h
@@ -32,7 +32,7 @@
public:
static sk_sp<GrTextureProxy> find_or_create_rrect_blur_mask(GrRecordingContext* context,
const SkRRect& rrectToDraw,
- const SkISize& size,
+ const SkISize& dimensions,
float xformedSigma) {
static const GrUniqueKey::Domain kDomain = GrUniqueKey::GenerateDomain();
GrUniqueKey key;
@@ -58,8 +58,8 @@
// 1) The texture coords would need to be updated.
// 2) We would have to use GrTextureDomain::kClamp_Mode for the GaussianBlur.
auto rtc = context->priv().makeDeferredRenderTargetContextWithFallback(
- SkBackingFit::kExact, size.fWidth, size.fHeight, GrColorType::kAlpha_8,
- nullptr);
+ SkBackingFit::kExact, dimensions.fWidth, dimensions.fHeight,
+ GrColorType::kAlpha_8, nullptr);
if (!rtc) {
return nullptr;
}
@@ -81,7 +81,7 @@
rtc->colorInfo().alphaType(),
SkIPoint::Make(0, 0),
nullptr,
- SkIRect::MakeWH(size.fWidth, size.fHeight),
+ SkIRect::MakeSize(dimensions),
SkIRect::EmptyIRect(),
xformedSigma,
xformedSigma,
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 937e168..45f1111 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1020,7 +1020,7 @@
bool GrGLGpu::uploadCompressedTexData(GrGLFormat format,
SkImage::CompressionType compressionType,
- const SkISize& size,
+ const SkISize& dimensions,
GrGLenum target,
const void* data) {
SkASSERT(format != GrGLFormat::kUnknown);
@@ -1038,13 +1038,14 @@
// Make sure that the width and height that we pass to OpenGL
// is a multiple of the block size.
- size_t dataSize = GrCompressedDataSize(compressionType, size.width(), size.height());
+ size_t dataSize =
+ GrCompressedDataSize(compressionType, dimensions.width(), dimensions.height());
if (useTexStorage) {
// We never resize or change formats of textures.
- GL_ALLOC_CALL(
- this->glInterface(),
- TexStorage2D(target, kMipLevelCount, internalFormat, size.width(), size.height()));
+ GL_ALLOC_CALL(this->glInterface(),
+ TexStorage2D(target, kMipLevelCount, internalFormat, dimensions.width(),
+ dimensions.height()));
GrGLenum error = CHECK_ALLOC_ERROR(this->glInterface());
if (error != GR_GL_NO_ERROR) {
return false;
@@ -1053,8 +1054,8 @@
0, // level
0, // left
0, // top
- size.width(),
- size.height(),
+ dimensions.width(),
+ dimensions.height(),
internalFormat,
SkToInt(dataSize),
data));
@@ -1062,8 +1063,8 @@
GL_ALLOC_CALL(this->glInterface(), CompressedTexImage2D(target,
0, // level
internalFormat,
- size.width(),
- size.height(),
+ dimensions.width(),
+ dimensions.height(),
0, // border
SkToInt(dataSize),
data));
@@ -1451,7 +1452,7 @@
}
GrGLuint GrGLGpu::createCompressedTexture2D(
- const SkISize& size,
+ const SkISize& dimensions,
GrGLFormat format,
SkImage::CompressionType compression,
GrGLTextureParameters::SamplerOverriddenState* initialState,
@@ -1469,14 +1470,14 @@
*initialState = set_initial_texture_params(this->glInterface(), GR_GL_TEXTURE_2D);
- if (!this->uploadCompressedTexData(format, compression, size, GR_GL_TEXTURE_2D, data)) {
+ if (!this->uploadCompressedTexData(format, compression, dimensions, GR_GL_TEXTURE_2D, data)) {
GL_CALL(DeleteTextures(1, &id));
return 0;
}
return id;
}
-GrGLuint GrGLGpu::createTexture2D(const SkISize& size,
+GrGLuint GrGLGpu::createTexture2D(const SkISize& dimensions,
GrGLFormat format,
GrRenderable renderable,
GrGLTextureParameters::SamplerOverriddenState* initialState,
@@ -1512,7 +1513,7 @@
if (this->glCaps().formatSupportsTexStorage(format)) {
GL_ALLOC_CALL(this->glInterface(),
TexStorage2D(GR_GL_TEXTURE_2D, SkTMax(mipLevelCount, 1), internalFormat,
- size.width(), size.height()));
+ dimensions.width(), dimensions.height()));
success = (GR_GL_NO_ERROR == CHECK_ALLOC_ERROR(this->glInterface()));
} else {
GrGLenum externalFormat, externalType;
@@ -1521,8 +1522,8 @@
if (externalFormat && externalType) {
for (int level = 0; level < mipLevelCount && error == GR_GL_NO_ERROR; level++) {
const int twoToTheMipLevel = 1 << level;
- const int currentWidth = SkTMax(1, size.width() / twoToTheMipLevel);
- const int currentHeight = SkTMax(1, size.height() / twoToTheMipLevel);
+ const int currentWidth = SkTMax(1, dimensions.width() / twoToTheMipLevel);
+ const int currentHeight = SkTMax(1, dimensions.height() / twoToTheMipLevel);
GL_ALLOC_CALL(
this->glInterface(),
TexImage2D(GR_GL_TEXTURE_2D, level, internalFormat, currentWidth,
diff --git a/src/gpu/gl/GrGLGpu.h b/src/gpu/gl/GrGLGpu.h
index e49f459..3af1dd5 100644
--- a/src/gpu/gl/GrGLGpu.h
+++ b/src/gpu/gl/GrGLGpu.h
@@ -225,13 +225,13 @@
// returned. On failure, zero is returned.
// The texture is populated with |texels|, if it is non-null.
// The texture parameters are cached in |initialTexParams|.
- GrGLuint createTexture2D(const SkISize& size,
+ GrGLuint createTexture2D(const SkISize& dimensions,
GrGLFormat format,
GrRenderable,
GrGLTextureParameters::SamplerOverriddenState* initialState,
int mipLevelCount);
- GrGLuint createCompressedTexture2D(const SkISize& size, GrGLFormat format,
+ GrGLuint createCompressedTexture2D(const SkISize& dimensions, GrGLFormat format,
SkImage::CompressionType compression,
GrGLTextureParameters::SamplerOverriddenState* initialState,
const void* data);
@@ -378,7 +378,7 @@
// to populate a new texture. Returns false if we failed to create and upload the texture.
bool uploadCompressedTexData(GrGLFormat,
SkImage::CompressionType,
- const SkISize& size,
+ const SkISize& dimensions,
GrGLenum target,
const void* data);
diff --git a/src/gpu/gl/GrGLPathRendering.cpp b/src/gpu/gl/GrGLPathRendering.cpp
index abcae33..884bb9f 100644
--- a/src/gpu/gl/GrGLPathRendering.cpp
+++ b/src/gpu/gl/GrGLPathRendering.cpp
@@ -89,8 +89,8 @@
gpu->flushColorWrite(false);
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(args.fProxy->peekRenderTarget());
- SkISize size = SkISize::Make(rt->width(), rt->height());
- this->setProjectionMatrix(*args.fViewMatrix, size, args.fProxy->origin());
+ SkISize dimensions = rt->dimensions();
+ this->setProjectionMatrix(*args.fViewMatrix, dimensions, args.fProxy->origin());
gpu->flushScissor(*args.fScissor, rt->width(), rt->height(), args.fProxy->origin());
gpu->flushHWAAState(rt, args.fUseHWAA);
gpu->flushRenderTarget(rt);
diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp
index 74cf539..38f81ca 100644
--- a/src/gpu/gl/GrGLProgram.cpp
+++ b/src/gpu/gl/GrGLProgram.cpp
@@ -147,12 +147,11 @@
}
// set RT adjustment
- SkISize size;
- size.set(rt->width(), rt->height());
+ SkISize dimensions = rt->dimensions();
if (!primProc.isPathRendering()) {
if (fRenderTargetState.fRenderTargetOrigin != origin ||
- fRenderTargetState.fRenderTargetSize != size) {
- fRenderTargetState.fRenderTargetSize = size;
+ fRenderTargetState.fRenderTargetSize != dimensions) {
+ fRenderTargetState.fRenderTargetSize = dimensions;
fRenderTargetState.fRenderTargetOrigin = origin;
float rtAdjustmentVec[4];
@@ -162,7 +161,6 @@
} else {
SkASSERT(fGpu->glCaps().shaderCaps()->pathRenderingSupport());
const GrPathProcessor& pathProc = primProc.cast<GrPathProcessor>();
- fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(),
- size, origin);
+ fGpu->glPathRendering()->setProjectionMatrix(pathProc.viewMatrix(), dimensions, origin);
}
}
diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp
index 0442945..48aad47 100644
--- a/src/gpu/gl/GrGLRenderTarget.cpp
+++ b/src/gpu/gl/GrGLRenderTarget.cpp
@@ -20,27 +20,27 @@
// Because this class is virtually derived from GrSurface we must explicitly call its constructor.
// Constructor for wrapped render targets.
GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrGLFormat format,
GrPixelConfig config,
int sampleCount,
const IDs& ids,
GrGLStencilAttachment* stencil)
- : GrSurface(gpu, size, config, GrProtected::kNo)
- , INHERITED(gpu, size, config, sampleCount, GrProtected::kNo, stencil) {
+ : GrSurface(gpu, dimensions, config, GrProtected::kNo)
+ , INHERITED(gpu, dimensions, config, sampleCount, GrProtected::kNo, stencil) {
this->setFlags(gpu->glCaps(), ids);
this->init(format, ids);
this->registerWithCacheWrapped(GrWrapCacheable::kNo);
}
GrGLRenderTarget::GrGLRenderTarget(GrGLGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrGLFormat format,
GrPixelConfig config,
int sampleCount,
const IDs& ids)
- : GrSurface(gpu, size, config, GrProtected::kNo)
- , INHERITED(gpu, size, config, sampleCount, GrProtected::kNo) {
+ : GrSurface(gpu, dimensions, config, GrProtected::kNo)
+ , INHERITED(gpu, dimensions, config, sampleCount, GrProtected::kNo) {
this->setFlags(gpu->glCaps(), ids);
this->init(format, ids);
}
@@ -61,7 +61,7 @@
}
sk_sp<GrGLRenderTarget> GrGLRenderTarget::MakeWrapped(GrGLGpu* gpu,
- const SkISize& size,
+ const SkISize& dimensions,
GrGLFormat format,
GrPixelConfig config,
int sampleCount,
@@ -76,11 +76,11 @@
format.fStencilBits = stencilBits;
format.fTotalBits = stencilBits;
// Ownership of sb is passed to the GrRenderTarget so doesn't need to be deleted
- sb = new GrGLStencilAttachment(gpu, sbDesc, size.width(), size.height(), sampleCount,
- format);
+ sb = new GrGLStencilAttachment(gpu, sbDesc, dimensions.width(), dimensions.height(),
+ sampleCount, format);
}
return sk_sp<GrGLRenderTarget>(
- new GrGLRenderTarget(gpu, size, format, config, sampleCount, idDesc, sb));
+ new GrGLRenderTarget(gpu, dimensions, format, config, sampleCount, idDesc, sb));
}
GrBackendRenderTarget GrGLRenderTarget::getBackendRenderTarget() const {
@@ -104,7 +104,7 @@
size_t GrGLRenderTarget::onGpuMemorySize() const {
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
fNumSamplesOwnedPerPixel, GrMipMapped::kNo);
}
@@ -222,8 +222,8 @@
// Log any renderbuffer's contribution to memory.
if (fMSColorRenderbufferID) {
const GrCaps& caps = *this->getGpu()->caps();
- size_t size = GrSurface::ComputeSize(caps, this->backendFormat(), this->width(),
- this->height(), this->msaaSamples(), GrMipMapped::kNo);
+ size_t size = GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
+ this->msaaSamples(), GrMipMapped::kNo);
// Due to this resource having both a texture and a renderbuffer component, dump as
// skia/gpu_resources/resource_#/renderbuffer
diff --git a/src/gpu/gl/GrGLTextureRenderTarget.cpp b/src/gpu/gl/GrGLTextureRenderTarget.cpp
index 38bc4ef..6648828 100644
--- a/src/gpu/gl/GrGLTextureRenderTarget.cpp
+++ b/src/gpu/gl/GrGLTextureRenderTarget.cpp
@@ -73,6 +73,6 @@
size_t GrGLTextureRenderTarget::onGpuMemorySize() const {
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
this->numSamplesOwnedPerPixel(), this->texturePriv().mipMapped());
}
diff --git a/src/gpu/mock/GrMockTexture.h b/src/gpu/mock/GrMockTexture.h
index 21d0634..9590e07 100644
--- a/src/gpu/mock/GrMockTexture.h
+++ b/src/gpu/mock/GrMockTexture.h
@@ -103,7 +103,7 @@
++numColorSamples;
}
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
numColorSamples, GrMipMapped::kNo);
}
@@ -188,7 +188,7 @@
++numColorSamples;
}
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
numColorSamples, this->texturePriv().mipMapped());
}
diff --git a/src/gpu/mtl/GrMtlPipelineState.mm b/src/gpu/mtl/GrMtlPipelineState.mm
index 83af603..9b4dc40 100644
--- a/src/gpu/mtl/GrMtlPipelineState.mm
+++ b/src/gpu/mtl/GrMtlPipelineState.mm
@@ -144,12 +144,11 @@
}
// set RT adjustment
- SkISize size;
- size.set(rt->width(), rt->height());
+ SkISize dimensions = rt->dimensions();
SkASSERT(fBuiltinUniformHandles.fRTAdjustmentUni.isValid());
if (fRenderTargetState.fRenderTargetOrigin != origin ||
- fRenderTargetState.fRenderTargetSize != size) {
- fRenderTargetState.fRenderTargetSize = size;
+ fRenderTargetState.fRenderTargetSize != dimensions) {
+ fRenderTargetState.fRenderTargetSize = dimensions;
fRenderTargetState.fRenderTargetOrigin = origin;
float rtAdjustmentVec[4];
diff --git a/src/gpu/mtl/GrMtlRenderTarget.h b/src/gpu/mtl/GrMtlRenderTarget.h
index 4ae34d7..0ef1bcc 100644
--- a/src/gpu/mtl/GrMtlRenderTarget.h
+++ b/src/gpu/mtl/GrMtlRenderTarget.h
@@ -63,7 +63,7 @@
++numColorSamples;
}
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
numColorSamples, GrMipMapped::kNo);
}
diff --git a/src/gpu/mtl/GrMtlTextureRenderTarget.h b/src/gpu/mtl/GrMtlTextureRenderTarget.h
index 18656e1..2e1bda7 100644
--- a/src/gpu/mtl/GrMtlTextureRenderTarget.h
+++ b/src/gpu/mtl/GrMtlTextureRenderTarget.h
@@ -78,7 +78,7 @@
++numColorSamples;
}
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
numColorSamples, GrMipMapped::kNo);
}
};
diff --git a/src/gpu/ops/GrClearOp.cpp b/src/gpu/ops/GrClearOp.cpp
index b6dcab3..a138dbc 100644
--- a/src/gpu/ops/GrClearOp.cpp
+++ b/src/gpu/ops/GrClearOp.cpp
@@ -18,7 +18,7 @@
const GrFixedClip& clip,
const SkPMColor4f& color,
GrSurfaceProxy* dstProxy) {
- const SkIRect rect = SkIRect::MakeWH(dstProxy->width(), dstProxy->height());
+ const SkIRect rect = SkIRect::MakeSize(dstProxy->dimensions());
if (clip.scissorEnabled() && !SkIRect::Intersects(clip.scissorRect(), rect)) {
return nullptr;
}
@@ -43,7 +43,7 @@
: INHERITED(ClassID())
, fClip(clip)
, fColor(color) {
- const SkIRect rtRect = SkIRect::MakeWH(proxy->width(), proxy->height());
+ const SkIRect rtRect = SkIRect::MakeSize(proxy->dimensions());
if (fClip.scissorEnabled()) {
// Don't let scissors extend outside the RT. This may improve op combining.
if (!fClip.intersect(rtRect)) {
diff --git a/src/gpu/ops/GrClearStencilClipOp.h b/src/gpu/ops/GrClearStencilClipOp.h
index 0a4a740..a233153 100644
--- a/src/gpu/ops/GrClearStencilClipOp.h
+++ b/src/gpu/ops/GrClearStencilClipOp.h
@@ -49,9 +49,8 @@
: INHERITED(ClassID())
, fClip(clip)
, fInsideStencilMask(insideStencilMask) {
- const SkRect& bounds = fClip.scissorEnabled()
- ? SkRect::Make(fClip.scissorRect())
- : SkRect::MakeIWH(proxy->width(), proxy->height());
+ const SkRect& bounds =
+ fClip.scissorEnabled() ? SkRect::Make(fClip.scissorRect()) : proxy->getBoundsRect();
this->setBounds(bounds, HasAABloat::kNo, IsHairline::kNo);
}
diff --git a/src/gpu/ops/GrDefaultPathRenderer.cpp b/src/gpu/ops/GrDefaultPathRenderer.cpp
index 535b3ee..6e4b241 100644
--- a/src/gpu/ops/GrDefaultPathRenderer.cpp
+++ b/src/gpu/ops/GrDefaultPathRenderer.cpp
@@ -588,9 +588,7 @@
SkScalar srcSpaceTol = GrPathUtils::scaleToleranceToSrc(tol, viewMatrix, path.getBounds());
SkRect devBounds;
- GetPathDevBounds(path,
- renderTargetContext->asRenderTargetProxy()->worstCaseWidth(),
- renderTargetContext->asRenderTargetProxy()->worstCaseHeight(),
+ GetPathDevBounds(path, renderTargetContext->asRenderTargetProxy()->worstCaseDimensions(),
viewMatrix, &devBounds);
for (int p = 0; p < passCount; ++p) {
diff --git a/src/gpu/ops/GrOp.h b/src/gpu/ops/GrOp.h
index ac738f9..0ad0a2b 100644
--- a/src/gpu/ops/GrOp.h
+++ b/src/gpu/ops/GrOp.h
@@ -268,8 +268,7 @@
this->setBoundsFlags(aabloat, zeroArea);
}
void makeFullScreen(GrSurfaceProxy* proxy) {
- this->setBounds(SkRect::MakeIWH(proxy->width(), proxy->height()),
- HasAABloat::kNo, IsHairline::kNo);
+ this->setBounds(proxy->getBoundsRect(), HasAABloat::kNo, IsHairline::kNo);
}
static uint32_t GenOpClassID() { return GenID(&gCurrOpClassID); }
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index 29e3216..8fb2a97 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -89,8 +89,8 @@
return false;
}
- SkImageInfo ii = SkImageInfo::Make(sProxy->width(), sProxy->height(),
- kRGBA_8888_SkColorType, kPremul_SkAlphaType);
+ SkImageInfo ii =
+ SkImageInfo::Make(sProxy->dimensions(), kRGBA_8888_SkColorType, kPremul_SkAlphaType);
SkBitmap bm;
if (!bm.tryAllocPixels(ii)) {
return false;
diff --git a/src/gpu/vk/GrVkPipelineState.cpp b/src/gpu/vk/GrVkPipelineState.cpp
index b48f155..d511e71 100644
--- a/src/gpu/vk/GrVkPipelineState.cpp
+++ b/src/gpu/vk/GrVkPipelineState.cpp
@@ -318,12 +318,11 @@
}
// set RT adjustment
- SkISize size;
- size.set(rt->width(), rt->height());
+ SkISize dimensions = rt->dimensions();
SkASSERT(fBuiltinUniformHandles.fRTAdjustmentUni.isValid());
if (fRenderTargetState.fRenderTargetOrigin != origin ||
- fRenderTargetState.fRenderTargetSize != size) {
- fRenderTargetState.fRenderTargetSize = size;
+ fRenderTargetState.fRenderTargetSize != dimensions) {
+ fRenderTargetState.fRenderTargetSize = dimensions;
fRenderTargetState.fRenderTargetOrigin = origin;
float rtAdjustmentVec[4];
diff --git a/src/gpu/vk/GrVkRenderTarget.h b/src/gpu/vk/GrVkRenderTarget.h
index 09bb3d6..9372aa1 100644
--- a/src/gpu/vk/GrVkRenderTarget.h
+++ b/src/gpu/vk/GrVkRenderTarget.h
@@ -118,7 +118,7 @@
numColorSamples += 1;
}
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
numColorSamples, GrMipMapped::kNo);
}
diff --git a/src/gpu/vk/GrVkTextureRenderTarget.cpp b/src/gpu/vk/GrVkTextureRenderTarget.cpp
index d89822d..556e3ea 100644
--- a/src/gpu/vk/GrVkTextureRenderTarget.cpp
+++ b/src/gpu/vk/GrVkTextureRenderTarget.cpp
@@ -245,7 +245,7 @@
++numColorSamples;
}
const GrCaps& caps = *this->getGpu()->caps();
- return GrSurface::ComputeSize(caps, this->backendFormat(), this->width(), this->height(),
+ return GrSurface::ComputeSize(caps, this->backendFormat(), this->dimensions(),
numColorSamples, // TODO: this still correct?
this->texturePriv().mipMapped());
}
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 30254e5..bab12fa 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -56,7 +56,7 @@
SkImage_Gpu::SkImage_Gpu(sk_sp<GrContext> context, uint32_t uniqueID, SkAlphaType at,
sk_sp<GrTextureProxy> proxy, sk_sp<SkColorSpace> colorSpace)
- : INHERITED(std::move(context), proxy->worstCaseWidth(), proxy->worstCaseHeight(), uniqueID,
+ : INHERITED(std::move(context), proxy->worstCaseDimensions(), uniqueID,
proxy_color_type(proxy.get()), at, colorSpace)
, fProxy(std::move(proxy)) {}
diff --git a/src/image/SkImage_GpuBase.cpp b/src/image/SkImage_GpuBase.cpp
index 58d0eb8..d31e10d 100644
--- a/src/image/SkImage_GpuBase.cpp
+++ b/src/image/SkImage_GpuBase.cpp
@@ -23,13 +23,11 @@
#include "src/image/SkImage_GpuBase.h"
#include "src/image/SkReadPixelsRec.h"
-SkImage_GpuBase::SkImage_GpuBase(sk_sp<GrContext> context, int width, int height, uint32_t uniqueID,
+SkImage_GpuBase::SkImage_GpuBase(sk_sp<GrContext> context, SkISize size, uint32_t uniqueID,
SkColorType ct, SkAlphaType at, sk_sp<SkColorSpace> cs)
- : INHERITED(SkImageInfo::Make(width, height, ct, at, std::move(cs)), uniqueID)
+ : INHERITED(SkImageInfo::Make(size, ct, at, std::move(cs)), uniqueID)
, fContext(std::move(context)) {}
-SkImage_GpuBase::~SkImage_GpuBase() {}
-
//////////////////////////////////////////////////////////////////////////////////////////////////
#if GR_TEST_UTILS
diff --git a/src/image/SkImage_GpuBase.h b/src/image/SkImage_GpuBase.h
index c78f799..f64633c 100644
--- a/src/image/SkImage_GpuBase.h
+++ b/src/image/SkImage_GpuBase.h
@@ -20,10 +20,6 @@
class SkImage_GpuBase : public SkImage_Base {
public:
- SkImage_GpuBase(sk_sp<GrContext>, int width, int height, uint32_t uniqueID, SkColorType,
- SkAlphaType, sk_sp<SkColorSpace>);
- ~SkImage_GpuBase() override;
-
GrContext* context() const final { return fContext.get(); }
bool getROPixels(SkBitmap*, CachingHint) const final;
@@ -78,6 +74,9 @@
using PromiseImageTextureDoneProc = SkDeferredDisplayListRecorder::PromiseImageTextureDoneProc;
protected:
+ SkImage_GpuBase(sk_sp<GrContext>, SkISize size, uint32_t uniqueID, SkColorType, SkAlphaType,
+ sk_sp<SkColorSpace>);
+
using PromiseImageApiVersion = SkDeferredDisplayListRecorder::PromiseImageApiVersion;
// Helper for making a lazy proxy for a promise image. The PromiseDoneProc we be called,
// if not null, immediately if this function fails. Othwerwise, it is installed in the
diff --git a/src/image/SkImage_GpuYUVA.cpp b/src/image/SkImage_GpuYUVA.cpp
index 03a7cac..3470f7e 100644
--- a/src/image/SkImage_GpuYUVA.cpp
+++ b/src/image/SkImage_GpuYUVA.cpp
@@ -29,12 +29,12 @@
static constexpr auto kAssumedColorType = kRGBA_8888_SkColorType;
-SkImage_GpuYUVA::SkImage_GpuYUVA(sk_sp<GrContext> context, int width, int height, uint32_t uniqueID,
+SkImage_GpuYUVA::SkImage_GpuYUVA(sk_sp<GrContext> context, SkISize size, uint32_t uniqueID,
SkYUVColorSpace colorSpace, sk_sp<GrTextureProxy> proxies[],
GrColorType proxyColorTypes[], int numProxies,
const SkYUVAIndex yuvaIndices[4], GrSurfaceOrigin origin,
sk_sp<SkColorSpace> imageColorSpace)
- : INHERITED(std::move(context), width, height, uniqueID, kAssumedColorType,
+ : INHERITED(std::move(context), size, uniqueID, kAssumedColorType,
// If an alpha channel is present we always switch to kPremul. This is because,
// although the planar data is always un-premul, the final interleaved RGB image
// is/would-be premul.
@@ -56,8 +56,7 @@
// For onMakeColorSpace()
SkImage_GpuYUVA::SkImage_GpuYUVA(const SkImage_GpuYUVA* image, sk_sp<SkColorSpace> targetCS)
- : INHERITED(image->fContext, image->width(), image->height(), kNeedNewImageUniqueID,
- kAssumedColorType,
+ : INHERITED(image->fContext, image->dimensions(), kNeedNewImageUniqueID, kAssumedColorType,
// If an alpha channel is present we always switch to kPremul. This is because,
// although the planar data is always un-premul, the final interleaved RGB image
// is/would-be premul.
@@ -84,8 +83,6 @@
memcpy(fYUVAIndices, image->fYUVAIndices, 4 * sizeof(SkYUVAIndex));
}
-SkImage_GpuYUVA::~SkImage_GpuYUVA() {}
-
bool SkImage_GpuYUVA::setupMipmapsForPlanes(GrRecordingContext* context) const {
// We shouldn't get here if the planes were already flattened to RGBA.
SkASSERT(fProxies[0] && !fRGBProxy);
@@ -213,10 +210,9 @@
}
sk_sp<SkImage> SkImage_GpuYUVA::onReinterpretColorSpace(sk_sp<SkColorSpace> newCS) const {
- return sk_make_sp<SkImage_GpuYUVA>(fContext, this->width(), this->height(),
- kNeedNewImageUniqueID, fYUVColorSpace, fProxies,
- fProxyColorTypes, fNumProxies, fYUVAIndices, fOrigin,
- std::move(newCS));
+ return sk_make_sp<SkImage_GpuYUVA>(fContext, this->dimensions(), kNeedNewImageUniqueID,
+ fYUVColorSpace, fProxies, fProxyColorTypes, fNumProxies,
+ fYUVAIndices, fOrigin, std::move(newCS));
}
//////////////////////////////////////////////////////////////////////////////////////////////////
@@ -244,10 +240,9 @@
yuvaTextures[i].getBackendFormat(), yuvaIndices[3].fIndex == i);
}
- return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(ctx), imageSize.width(), imageSize.height(),
- kNeedNewImageUniqueID, colorSpace, tempTextureProxies,
- proxyColorTypes, numTextures, yuvaIndices, imageOrigin,
- imageColorSpace);
+ return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(ctx), imageSize, kNeedNewImageUniqueID, colorSpace,
+ tempTextureProxies, proxyColorTypes, numTextures,
+ yuvaIndices, imageOrigin, imageColorSpace);
}
sk_sp<SkImage> SkImage::MakeFromYUVAPixmaps(
@@ -300,10 +295,9 @@
proxyColorTypes[i] = SkColorTypeToGrColorType(bmp.colorType());
}
- return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(context), imageSize.width(), imageSize.height(),
- kNeedNewImageUniqueID, yuvColorSpace, tempTextureProxies,
- proxyColorTypes, numPixmaps, yuvaIndices, imageOrigin,
- imageColorSpace);
+ return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(context), imageSize, kNeedNewImageUniqueID,
+ yuvColorSpace, tempTextureProxies, proxyColorTypes,
+ numPixmaps, yuvaIndices, imageOrigin, imageColorSpace);
}
@@ -393,7 +387,7 @@
proxyColorTypes[texIdx] = colorType;
}
- return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(context), imageWidth, imageHeight,
+ return sk_make_sp<SkImage_GpuYUVA>(sk_ref_sp(context), SkISize{imageWidth, imageHeight},
kNeedNewImageUniqueID, yuvColorSpace, proxies,
proxyColorTypes, numTextures, yuvaIndices, imageOrigin,
std::move(imageColorSpace));
diff --git a/src/image/SkImage_GpuYUVA.h b/src/image/SkImage_GpuYUVA.h
index eac04e4..6ed7d79 100644
--- a/src/image/SkImage_GpuYUVA.h
+++ b/src/image/SkImage_GpuYUVA.h
@@ -24,10 +24,9 @@
public:
friend class GrYUVAImageTextureMaker;
- SkImage_GpuYUVA(sk_sp<GrContext>, int width, int height, uint32_t uniqueID, SkYUVColorSpace,
+ SkImage_GpuYUVA(sk_sp<GrContext>, SkISize size, uint32_t uniqueID, SkYUVColorSpace,
sk_sp<GrTextureProxy> proxies[], GrColorType proxyColorTypes[], int numProxies,
const SkYUVAIndex[4], GrSurfaceOrigin, sk_sp<SkColorSpace>);
- ~SkImage_GpuYUVA() override;
GrSemaphoresSubmitted onFlush(GrContext*, const GrFlushInfo&) override;
diff --git a/src/shaders/SkImageShader.cpp b/src/shaders/SkImageShader.cpp
index 5bc13e5..028027d 100644
--- a/src/shaders/SkImageShader.cpp
+++ b/src/shaders/SkImageShader.cpp
@@ -241,9 +241,8 @@
domainY, kDir, fImage->alphaType());
} else {
if (domainX != GrTextureDomain::kIgnore_Mode || domainY != GrTextureDomain::kIgnore_Mode) {
- SkRect domain = GrTextureDomain::MakeTexelDomain(
- SkIRect::MakeWH(proxy->width(), proxy->height()),
- domainX, domainY);
+ SkRect domain = GrTextureDomain::MakeTexelDomain(SkIRect::MakeSize(proxy->dimensions()),
+ domainX, domainY);
inner = GrTextureDomainEffect::Make(std::move(proxy), srcColorType, lmInverse, domain,
domainX, domainY, samplerState);
} else {