Pull non-substantive changes out of omnibus GrSurface CL
https://skia-review.googlesource.com/c/26363 (Remove origin field from GrSurface) is
already too large. This pulls some of the cosmetic changes out for separate review.
Change-Id: I1d8b95522144b2f4cbd916ef38faa3dde6f78087
Reviewed-on: https://skia-review.googlesource.com/27840
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp
index 7b8adf1..c4bb813 100644
--- a/gm/image_pict.cpp
+++ b/gm/image_pict.cpp
@@ -180,10 +180,10 @@
// need to copy the subset into a new texture
GrSurfaceDesc desc;
- desc.fConfig = fProxy->config();
+ desc.fOrigin = fProxy->origin();
desc.fWidth = info.width();
desc.fHeight = info.height();
- desc.fOrigin = fProxy->origin();
+ desc.fConfig = fProxy->config();
sk_sp<GrSurfaceContext> dstContext(fCtx->contextPriv().makeDeferredSurfaceContext(
desc,
diff --git a/include/gpu/GrTypes.h b/include/gpu/GrTypes.h
index a343f03..572aa52 100644
--- a/include/gpu/GrTypes.h
+++ b/include/gpu/GrTypes.h
@@ -591,13 +591,13 @@
*/
struct GrSurfaceDesc {
GrSurfaceDesc()
- : fFlags(kNone_GrSurfaceFlags)
- , fOrigin(kDefault_GrSurfaceOrigin)
- , fWidth(0)
- , fHeight(0)
- , fConfig(kUnknown_GrPixelConfig)
- , fSampleCnt(0)
- , fIsMipMapped(false) {
+ : fFlags(kNone_GrSurfaceFlags)
+ , fOrigin(kDefault_GrSurfaceOrigin)
+ , fWidth(0)
+ , fHeight(0)
+ , fConfig(kUnknown_GrPixelConfig)
+ , fSampleCnt(0)
+ , fIsMipMapped(false) {
}
GrSurfaceFlags fFlags; //!< bitfield of TextureFlags
diff --git a/src/gpu/GrBackendTextureImageGenerator.cpp b/src/gpu/GrBackendTextureImageGenerator.cpp
index 3de6fec..ac4fee3 100644
--- a/src/gpu/GrBackendTextureImageGenerator.cpp
+++ b/src/gpu/GrBackendTextureImageGenerator.cpp
@@ -175,12 +175,12 @@
// Otherwise, make a copy of the requested subset. Make sure our temporary is renderable,
// because Vulkan will want to do the copy as a draw.
GrSurfaceDesc desc;
- desc.fConfig = proxy->config();
+ desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = proxy->origin();
desc.fWidth = info.width();
desc.fHeight = info.height();
- desc.fOrigin = proxy->origin();
+ desc.fConfig = proxy->config();
desc.fIsMipMapped = proxy->isMipMapped();
- desc.fFlags = kRenderTarget_GrSurfaceFlag;
sk_sp<GrSurfaceContext> sContext(context->contextPriv().makeDeferredSurfaceContext(
desc, SkBackingFit::kExact, SkBudgeted::kYes));
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 25408fb..347f0b5 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -401,11 +401,12 @@
return false;
}
- GrSurface* dstSurface = dst->asSurfaceProxy()->priv().peekSurface();
+ GrSurfaceProxy* dstProxy = dst->asSurfaceProxy();
+ GrSurface* dstSurface = dstProxy->priv().peekSurface();
// The src is unpremul but the dst is premul -> premul the src before or as part of the write
const bool premul = SkToBool(kUnpremul_PixelOpsFlag & pixelOpsFlags);
- if (!valid_pixel_conversion(srcConfig, dstSurface->config(), premul)) {
+ if (!valid_pixel_conversion(srcConfig, dstProxy->config(), premul)) {
return false;
}
@@ -414,7 +415,7 @@
bool useConfigConversionEffect =
premul &&
pm_upm_must_round_trip(srcConfig, srcColorSpace) &&
- pm_upm_must_round_trip(dstSurface->config(), dst->getColorSpace());
+ pm_upm_must_round_trip(dstProxy->config(), dst->getColorSpace());
// Are we going to try to premul as part of a draw? For the non-legacy case, we always allow
// this. GrConfigConversionEffect fails on some GPUs, so only allow this if it works perfectly.
@@ -432,8 +433,8 @@
GrGpu::DrawPreference drawPreference = premulOnGpu ? GrGpu::kCallerPrefersDraw_DrawPreference
: GrGpu::kNoDraw_DrawPreference;
GrGpu::WritePixelTempDrawInfo tempDrawInfo;
- if (!fContext->fGpu->getWritePixelsInfo(dstSurface, width, height, srcConfig,
- &drawPreference, &tempDrawInfo)) {
+ if (!fContext->fGpu->getWritePixelsInfo(dstSurface, width, height,
+ srcConfig, &drawPreference, &tempDrawInfo)) {
return false;
}
@@ -531,11 +532,12 @@
return false;
}
- GrSurface* srcSurface = src->asSurfaceProxy()->priv().peekSurface();
+ GrSurfaceProxy* srcProxy = src->asSurfaceProxy();
+ GrSurface* srcSurface = srcProxy->priv().peekSurface();
// The src is premul but the dst is unpremul -> unpremul the src after or as part of the read
bool unpremul = SkToBool(kUnpremul_PixelOpsFlag & flags);
- if (!valid_pixel_conversion(srcSurface->config(), dstConfig, unpremul)) {
+ if (!valid_pixel_conversion(srcProxy->config(), dstConfig, unpremul)) {
return false;
}
@@ -543,7 +545,7 @@
// without any color spaces attached, and the caller wants us to unpremul.
bool useConfigConversionEffect =
unpremul &&
- pm_upm_must_round_trip(srcSurface->config(), src->getColorSpace()) &&
+ pm_upm_must_round_trip(srcProxy->config(), src->getColorSpace()) &&
pm_upm_must_round_trip(dstConfig, dstColorSpace);
// Are we going to try to unpremul as part of a draw? For the non-legacy case, we always allow
@@ -562,8 +564,8 @@
GrGpu::DrawPreference drawPreference = unpremulOnGpu ? GrGpu::kCallerPrefersDraw_DrawPreference
: GrGpu::kNoDraw_DrawPreference;
GrGpu::ReadPixelTempDrawInfo tempDrawInfo;
- if (!fContext->fGpu->getReadPixelsInfo(srcSurface, width, height, rowBytes, dstConfig,
- &drawPreference, &tempDrawInfo)) {
+ if (!fContext->fGpu->getReadPixelsInfo(srcSurface, width, height, rowBytes,
+ dstConfig, &drawPreference, &tempDrawInfo)) {
return false;
}
@@ -639,8 +641,8 @@
this->flushSurfaceWrites(proxyToRead.get());
configToRead = tempDrawInfo.fReadConfig;
}
- if (!fContext->fGpu->readPixels(surfaceToRead, left, top, width, height, configToRead,
- buffer, rowBytes)) {
+ if (!fContext->fGpu->readPixels(surfaceToRead,
+ left, top, width, height, configToRead, buffer, rowBytes)) {
return false;
}
diff --git a/src/gpu/GrDrawOpAtlas.cpp b/src/gpu/GrDrawOpAtlas.cpp
index 8bc0521..897622a 100644
--- a/src/gpu/GrDrawOpAtlas.cpp
+++ b/src/gpu/GrDrawOpAtlas.cpp
@@ -21,6 +21,7 @@
void* data) {
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = width;
desc.fHeight = height;
desc.fConfig = config;
diff --git a/src/gpu/GrGpu.h b/src/gpu/GrGpu.h
index c6684ac..27a2d79 100644
--- a/src/gpu/GrGpu.h
+++ b/src/gpu/GrGpu.h
@@ -107,13 +107,13 @@
* @param mipLevelCount the number of levels in 'texels'
* @return The texture object if successful, otherwise nullptr.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted,
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc&, SkBudgeted,
const GrMipLevel texels[], int mipLevelCount);
/**
* Simplified createTexture() interface for when there is no initial texel data to upload.
*/
- sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted);
+ sk_sp<GrTexture> createTexture(const GrSurfaceDesc& desc, SkBudgeted);
/**
* Implements GrResourceProvider::wrapBackendTexture
@@ -544,8 +544,7 @@
// overridden by backend-specific derived class to create objects.
// Texture size and sample size will have already been validated in base class before
// onCreateTexture is called.
- virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc& desc,
- SkBudgeted budgeted,
+ virtual sk_sp<GrTexture> onCreateTexture(const GrSurfaceDesc&, SkBudgeted,
const GrMipLevel texels[],
int mipLevelCount) = 0;
diff --git a/src/gpu/GrRenderTargetContext.cpp b/src/gpu/GrRenderTargetContext.cpp
index c9898c7..4ec14bc 100644
--- a/src/gpu/GrRenderTargetContext.cpp
+++ b/src/gpu/GrRenderTargetContext.cpp
@@ -1806,8 +1806,8 @@
}
bool GrRenderTargetContext::setupDstProxy(GrRenderTargetProxy* rtProxy, const GrClip& clip,
- const SkRect& opBounds,
- GrXferProcessor::DstProxy* dstProxy) {
+ const SkRect& opBounds,
+ GrXferProcessor::DstProxy* dstProxy) {
if (this->caps()->textureBarrierSupport()) {
if (GrTextureProxy* texProxy = rtProxy->asTextureProxy()) {
// The render target is a texture, so we can read from it directly in the shader. The XP
@@ -1839,8 +1839,8 @@
bool rectsMustMatch = false;
bool disallowSubrect = false;
if (!this->caps()->initDescForDstCopy(rtProxy, &desc, &rectsMustMatch, &disallowSubrect)) {
- desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fConfig = rtProxy->config();
}
diff --git a/src/gpu/GrSurfaceProxy.cpp b/src/gpu/GrSurfaceProxy.cpp
index 804cabb..f863940 100644
--- a/src/gpu/GrSurfaceProxy.cpp
+++ b/src/gpu/GrSurfaceProxy.cpp
@@ -48,16 +48,16 @@
GrSurfaceFlags flags, bool isMipMapped,
SkDestinationSurfaceColorMode mipColorMode) const {
GrSurfaceDesc desc;
- desc.fConfig = fConfig;
- desc.fWidth = fWidth;
- desc.fHeight = fHeight;
- desc.fOrigin = fOrigin;
- desc.fSampleCnt = sampleCnt;
- desc.fIsMipMapped = isMipMapped;
desc.fFlags = flags;
if (fNeedsClear) {
desc.fFlags |= kPerformInitialClear_GrSurfaceFlag;
}
+ desc.fOrigin = fOrigin;
+ desc.fWidth = fWidth;
+ desc.fHeight = fHeight;
+ desc.fConfig = fConfig;
+ desc.fSampleCnt = sampleCnt;
+ desc.fIsMipMapped = isMipMapped;
sk_sp<GrSurface> surface;
if (SkBackingFit::kApprox == fFit) {
@@ -300,10 +300,10 @@
}
GrSurfaceDesc dstDesc;
- dstDesc.fConfig = src->config();
+ dstDesc.fOrigin = src->origin();
dstDesc.fWidth = srcRect.width();
dstDesc.fHeight = srcRect.height();
- dstDesc.fOrigin = src->origin();
+ dstDesc.fConfig = src->config();
sk_sp<GrSurfaceContext> dstContext(context->contextPriv().makeDeferredSurfaceContext(
dstDesc,
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 412f3c5..3c35def 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -1742,12 +1742,7 @@
GrSurfaceOrigin rtOrigin) {
if (scissorState.enabled()) {
GrGLIRect scissor;
- scissor.setRelativeTo(rtViewport,
- scissorState.rect().fLeft,
- scissorState.rect().fTop,
- scissorState.rect().width(),
- scissorState.rect().height(),
- rtOrigin);
+ scissor.setRelativeTo(rtViewport, scissorState.rect(), rtOrigin);
// if the scissor fully contains the viewport then we fall through and
// disable the scissor test.
if (!scissor.contains(rtViewport)) {
@@ -1860,7 +1855,7 @@
glRT->renderTargetPriv().numStencilBits());
}
this->flushStencil(stencil);
- this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), glRT->origin());
+ this->flushScissor(pipeline.getScissorState(), glRT->getViewport(), pipeline.proxy()->origin());
this->flushWindowRectangles(pipeline.getWindowRectsState(), glRT);
this->flushHWAAState(glRT, pipeline.isHWAntialiasState(), !stencil.isDisabled());
@@ -2123,11 +2118,12 @@
bool GrGLGpu::readPixelsSupported(GrPixelConfig rtConfig, GrPixelConfig readConfig) {
sk_sp<GrTexture> temp;
auto bindRenderTarget = [this, rtConfig, &temp]() -> bool {
- GrTextureDesc desc;
+ GrSurfaceDesc desc;
desc.fConfig = rtConfig;
desc.fWidth = desc.fHeight = 16;
if (this->glCaps().isConfigRenderable(rtConfig, false)) {
desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
temp = this->createTexture(desc, SkBudgeted::kNo);
if (!temp) {
return false;
@@ -2136,6 +2132,7 @@
this->flushRenderTarget(glrt, &SkIRect::EmptyIRect());
return true;
} else if (this->glCaps().canConfigBeFBOColorAttachment(rtConfig)) {
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
temp = this->createTexture(desc, SkBudgeted::kNo);
if (!temp) {
return false;
@@ -2553,7 +2550,7 @@
if (pipeline.getScissorState().enabled()) {
GrGLRenderTarget* glRT = static_cast<GrGLRenderTarget*>(pipeline.renderTarget());
this->flushScissor(dynamicStates[i].fScissorRect,
- glRT->getViewport(), glRT->origin());
+ glRT->getViewport(), pipeline.proxy()->origin());
}
}
if (this->glCaps().requiresCullFaceEnableDisableWhenDrawingLinesAfterNonLines() &&
@@ -2694,8 +2691,7 @@
t = target->height();
} else {
GrGLIRect rect;
- rect.setRelativeTo(vp, dirtyRect.fLeft, dirtyRect.fTop,
- dirtyRect.width(), dirtyRect.height(), target->origin());
+ rect.setRelativeTo(vp, dirtyRect, target->origin());
l = rect.fLeft;
b = rect.fBottom;
r = rect.fLeft + rect.fWidth;
@@ -3951,12 +3947,7 @@
// We modified the bound FBO
fHWBoundRenderTargetUniqueID.makeInvalid();
GrGLIRect srcGLRect;
- srcGLRect.setRelativeTo(srcVP,
- srcRect.fLeft,
- srcRect.fTop,
- srcRect.width(),
- srcRect.height(),
- src->origin());
+ srcGLRect.setRelativeTo(srcVP, srcRect, src->origin());
this->setScratchTextureUnit();
GL_CALL(BindTexture(dstTex->target(), dstTex->textureID()));
@@ -3997,18 +3988,8 @@
fHWBoundRenderTargetUniqueID.makeInvalid();
GrGLIRect srcGLRect;
GrGLIRect dstGLRect;
- srcGLRect.setRelativeTo(srcVP,
- srcRect.fLeft,
- srcRect.fTop,
- srcRect.width(),
- srcRect.height(),
- src->origin());
- dstGLRect.setRelativeTo(dstVP,
- dstRect.fLeft,
- dstRect.fTop,
- dstRect.width(),
- dstRect.height(),
- dst->origin());
+ srcGLRect.setRelativeTo(srcVP, srcRect, src->origin());
+ dstGLRect.setRelativeTo(dstVP, dstRect, dst->origin());
// BlitFrameBuffer respects the scissor, so disable it.
this->disableScissor();
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index 0d87c4f..5c78c07 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -231,7 +231,7 @@
dstTextureSamplerHandle =
this->emitSampler(dstTexture->texturePriv().samplerType(), dstTexture->config(),
"DstTextureSampler", kFragment_GrShaderFlag);
- dstTextureOrigin = dstTexture->origin();
+ dstTextureOrigin = fPipeline.dstTextureProxy()->origin();
SkASSERT(kTextureExternalSampler_GrSLType != dstTexture->texturePriv().samplerType());
}
diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp
index d1e535e..31e55de 100644
--- a/src/gpu/vk/GrVkGpu.cpp
+++ b/src/gpu/vk/GrVkGpu.cpp
@@ -933,14 +933,13 @@
}
GrSurfaceDesc desc;
- desc.fConfig = backendRT.config();
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fWidth = backendRT.width();
- desc.fHeight = backendRT.height();
- desc.fSampleCnt = 0;
-
SkASSERT(kDefault_GrSurfaceOrigin != origin);
desc.fOrigin = origin;
+ desc.fWidth = backendRT.width();
+ desc.fHeight = backendRT.height();
+ desc.fConfig = backendRT.config();
+ desc.fSampleCnt = 0;
sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, info);
if (tgt && backendRT.stencilBits()) {
@@ -965,13 +964,12 @@
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fConfig = tex.config();
+ desc.fOrigin = resolve_origin(origin);
desc.fWidth = tex.width();
desc.fHeight = tex.height();
+ desc.fConfig = tex.config();
desc.fSampleCnt = this->caps()->getSampleCount(sampleCnt, tex.config());
- desc.fOrigin = resolve_origin(origin);
-
sk_sp<GrVkRenderTarget> tgt = GrVkRenderTarget::MakeWrappedRenderTarget(this, desc, info);
return tgt;
}
diff --git a/src/image/SkImage_Gpu.cpp b/src/image/SkImage_Gpu.cpp
index 3bed9e8..a19556b 100644
--- a/src/image/SkImage_Gpu.cpp
+++ b/src/image/SkImage_Gpu.cpp
@@ -230,10 +230,10 @@
sk_sp<SkImage> SkImage_Gpu::onMakeSubset(const SkIRect& subset) const {
GrSurfaceDesc desc;
- desc.fConfig = fProxy->config();
+ desc.fOrigin = fProxy->origin();
desc.fWidth = subset.width();
desc.fHeight = subset.height();
- desc.fOrigin = fProxy->origin();
+ desc.fConfig = fProxy->config();
sk_sp<GrSurfaceContext> sContext(fContext->contextPriv().makeDeferredSurfaceContext(
desc,
@@ -491,8 +491,8 @@
sk_sp<GrSemaphore> sema = context->getGpu()->prepareTextureForCrossContextUsage(texture.get());
- auto gen = GrBackendTextureImageGenerator::Make(std::move(texture), std::move(sema),
- codecImage->alphaType(),
+ auto gen = GrBackendTextureImageGenerator::Make(std::move(texture),
+ std::move(sema), codecImage->alphaType(),
std::move(texColorSpace));
return SkImage::MakeFromGenerator(std::move(gen));
}
diff --git a/tests/DetermineDomainModeTest.cpp b/tests/DetermineDomainModeTest.cpp
index add746f..ee9a694 100644
--- a/tests/DetermineDomainModeTest.cpp
+++ b/tests/DetermineDomainModeTest.cpp
@@ -137,9 +137,10 @@
SkBackingFit fit = isExact ? SkBackingFit::kExact : SkBackingFit::kApprox;
GrSurfaceDesc desc;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = size;
desc.fHeight = size;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
static const char* name = "proxy";
diff --git a/tests/FloatingPointTextureTest.cpp b/tests/FloatingPointTextureTest.cpp
index 06a99a5..816b0d3 100644
--- a/tests/FloatingPointTextureTest.cpp
+++ b/tests/FloatingPointTextureTest.cpp
@@ -48,10 +48,10 @@
for (int origin = 0; origin < 2; ++origin) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = 0 == origin ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
desc.fWidth = DEV_W;
desc.fHeight = DEV_H;
desc.fConfig = config;
- desc.fOrigin = 0 == origin ? kTopLeft_GrSurfaceOrigin : kBottomLeft_GrSurfaceOrigin;
sk_sp<GrTextureProxy> fpProxy = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kNo,
controlPixelData.begin(), 0);
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index dd98a6e..8b07568 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -262,16 +262,16 @@
GrSurfaceDesc dummyDesc;
dummyDesc.fFlags = kRenderTarget_GrSurfaceFlag;
dummyDesc.fOrigin = kBottomLeft_GrSurfaceOrigin;
- dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
dummyDesc.fWidth = 34;
dummyDesc.fHeight = 18;
+ dummyDesc.fConfig = kRGBA_8888_GrPixelConfig;
proxies[0] = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
dummyDesc, SkBudgeted::kNo, nullptr, 0);
dummyDesc.fFlags = kNone_GrSurfaceFlags;
dummyDesc.fOrigin = kTopLeft_GrSurfaceOrigin;
- dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
dummyDesc.fWidth = 16;
dummyDesc.fHeight = 22;
+ dummyDesc.fConfig = kAlpha_8_GrPixelConfig;
proxies[1] = GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
dummyDesc, SkBudgeted::kNo, nullptr, 0);
diff --git a/tests/GpuSampleLocationsTest.cpp b/tests/GpuSampleLocationsTest.cpp
index b11c0f2..399f431 100644
--- a/tests/GpuSampleLocationsTest.cpp
+++ b/tests/GpuSampleLocationsTest.cpp
@@ -138,7 +138,7 @@
GrRenderTarget* rt = rtc->accessRenderTarget();
assert_equal(reporter, kTestPatterns[i],
rt->renderTargetPriv().getMultisampleSpecs(dummyPipeline),
- kBottomLeft_GrSurfaceOrigin == rt->origin());
+ kBottomLeft_GrSurfaceOrigin == rtc->asSurfaceProxy()->origin());
}
}
}
diff --git a/tests/GrSurfaceTest.cpp b/tests/GrSurfaceTest.cpp
index 71575c7..5c665d1 100644
--- a/tests/GrSurfaceTest.cpp
+++ b/tests/GrSurfaceTest.cpp
@@ -25,10 +25,11 @@
DEF_GPUTEST_FOR_NULLGL_CONTEXT(GrSurface, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
GrSurfaceDesc desc;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = 256;
desc.fHeight = 256;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fSampleCnt = 0;
sk_sp<GrSurface> texRT1 = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
@@ -42,6 +43,7 @@
static_cast<GrSurface*>(texRT1->asTexture()));
desc.fFlags = kNone_GrSurfaceFlags;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
sk_sp<GrTexture> tex1 = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, nullptr == tex1->asRenderTarget());
REPORTER_ASSERT(reporter, tex1.get() == tex1->asTexture());
@@ -113,8 +115,8 @@
for (GrSurfaceOrigin origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin }) {
desc.fFlags = kNone_GrSurfaceFlags;
desc.fOrigin = origin;
- desc.fSampleCnt = 0;
desc.fConfig = config;
+ desc.fSampleCnt = 0;
sk_sp<GrSurface> tex = resourceProvider->createTexture(desc, SkBudgeted::kNo);
REPORTER_ASSERT(reporter, SkToBool(tex.get()) == caps->isConfigTexturable(desc.fConfig));
diff --git a/tests/ImageFilterCacheTest.cpp b/tests/ImageFilterCacheTest.cpp
index 86ecb15..4e6df3b 100644
--- a/tests/ImageFilterCacheTest.cpp
+++ b/tests/ImageFilterCacheTest.cpp
@@ -192,9 +192,9 @@
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
return GrSurfaceProxy::MakeDeferred(resourceProvider,
desc, SkBudgeted::kYes,
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index c7503bc..e5dc4cc 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -496,10 +496,10 @@
sk_sp<GrTextureProxy> pre_create_atlas(GrContext* context) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
- desc.fConfig = kSkia8888_GrPixelConfig;
desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = 32;
desc.fHeight = 16;
+ desc.fConfig = kSkia8888_GrPixelConfig;
sk_sp<GrSurfaceProxy> atlasDest = GrSurfaceProxy::MakeDeferred(
context->resourceProvider(),
desc, SkBackingFit::kExact,
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index e2840ce..ec157f9 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -145,10 +145,11 @@
DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
GrContext* context = ctxInfo.grContext();
- GrTextureDesc desc;
- desc.fConfig = kRGBA_8888_GrPixelConfig;
+ GrSurfaceDesc desc;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = 10;
desc.fHeight = 10;
+ desc.fConfig = kRGBA_8888_GrPixelConfig;
for (int parentCnt = 0; parentCnt < 2; parentCnt++) {
sk_sp<GrRenderTargetContext> renderTargetContext(context->makeDeferredRenderTargetContext(
diff --git a/tests/ProxyConversionTest.cpp b/tests/ProxyConversionTest.cpp
index 23ca695..78465f9 100644
--- a/tests/ProxyConversionTest.cpp
+++ b/tests/ProxyConversionTest.cpp
@@ -26,6 +26,7 @@
GrBackendRenderTarget backendRT(desc.fWidth, desc.fHeight, desc.fSampleCnt, 8,
desc.fConfig, fboInfo);
+ SkASSERT(kDefault_GrSurfaceOrigin != desc.fOrigin);
sk_sp<GrRenderTarget> defaultFBO(provider->wrapBackendRenderTarget(backendRT, desc.fOrigin));
SkASSERT(!defaultFBO->asTexture());
@@ -122,6 +123,7 @@
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = 64;
desc.fHeight = 64;
desc.fConfig = kRGBA_8888_GrPixelConfig;
@@ -156,6 +158,7 @@
{
desc.fFlags = kNone_GrSurfaceFlags; // force no-RT
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(resourceProvider, desc,
SkBackingFit::kApprox,
diff --git a/tests/ProxyRefTest.cpp b/tests/ProxyRefTest.cpp
index 3648122..e605716 100644
--- a/tests/ProxyRefTest.cpp
+++ b/tests/ProxyRefTest.cpp
@@ -68,6 +68,7 @@
static sk_sp<GrTextureProxy> make_deferred(GrContext* context) {
GrSurfaceDesc desc;
desc.fFlags = kRenderTarget_GrSurfaceFlag;
+ desc.fOrigin = kBottomLeft_GrSurfaceOrigin;
desc.fWidth = kWidthHeight;
desc.fHeight = kWidthHeight;
desc.fConfig = kRGBA_8888_GrPixelConfig;
diff --git a/tests/ResourceAllocatorTest.cpp b/tests/ResourceAllocatorTest.cpp
index 4aa055d..4c40619 100644
--- a/tests/ResourceAllocatorTest.cpp
+++ b/tests/ResourceAllocatorTest.cpp
@@ -53,9 +53,9 @@
p.fConfig,
*backendTexHandle);
- sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(
- backendTex, p.fOrigin,
- kBorrow_GrWrapOwnership);
+ SkASSERT(kDefault_GrSurfaceOrigin != p.fOrigin);
+ sk_sp<GrSurface> tex = context->resourceProvider()->wrapBackendTexture(backendTex, p.fOrigin,
+ kBorrow_GrWrapOwnership);
return GrSurfaceProxy::MakeWrapped(std::move(tex), p.fOrigin);
}
diff --git a/tests/SRGBMipMapTest.cpp b/tests/SRGBMipMapTest.cpp
index 07332e4..11fedca 100644
--- a/tests/SRGBMipMapTest.cpp
+++ b/tests/SRGBMipMapTest.cpp
@@ -125,9 +125,9 @@
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
- desc.fConfig = kSRGBA_8888_GrPixelConfig;
desc.fWidth = texS;
desc.fHeight = texS;
+ desc.fConfig = kSRGBA_8888_GrPixelConfig;
GrResourceProvider* resourceProvider = context->resourceProvider();
sk_sp<GrTextureProxy> proxy = GrSurfaceProxy::MakeDeferred(resourceProvider,
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 8280e14..24d1b9c 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -437,7 +437,7 @@
}
SkCanvas skCanvas(bitmap);
drawPict(pic, &skCanvas, fScaleOversized ? scale : 1);
- GrTextureDesc desc;
+ GrSurfaceDesc desc;
desc.fConfig = kRGBA_8888_GrPixelConfig;
desc.fFlags = kRenderTarget_GrTextureFlagBit;
desc.fWidth = dim.fX;
diff --git a/tests/SpecialImageTest.cpp b/tests/SpecialImageTest.cpp
index 3574f38..2ac80d6 100644
--- a/tests/SpecialImageTest.cpp
+++ b/tests/SpecialImageTest.cpp
@@ -303,9 +303,9 @@
GrSurfaceDesc desc;
desc.fFlags = kNone_GrSurfaceFlags;
desc.fOrigin = kTopLeft_GrSurfaceOrigin;
- desc.fConfig = kSkia8888_GrPixelConfig;
desc.fWidth = kFullSize;
desc.fHeight = kFullSize;
+ desc.fConfig = kSkia8888_GrPixelConfig;
sk_sp<GrTextureProxy> proxy(GrSurfaceProxy::MakeDeferred(context->resourceProvider(),
desc, SkBudgeted::kNo,
diff --git a/tests/TestUtils.cpp b/tests/TestUtils.cpp
index aca7509..f608413 100644
--- a/tests/TestUtils.cpp
+++ b/tests/TestUtils.cpp
@@ -70,9 +70,9 @@
GrSurfaceProxy* proxy, uint32_t expectedPixelValues[],
bool onlyTestRTConfig, const char* testName) {
GrSurfaceDesc copyDstDesc;
- copyDstDesc.fConfig = kRGBA_8888_GrPixelConfig;
copyDstDesc.fWidth = proxy->width();
copyDstDesc.fHeight = proxy->height();
+ copyDstDesc.fConfig = kRGBA_8888_GrPixelConfig;
for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) {
if (kNone_GrSurfaceFlags == flags && onlyTestRTConfig) {
@@ -102,9 +102,9 @@
}
GrSurfaceDesc copySrcDesc;
- copySrcDesc.fConfig = kRGBA_8888_GrPixelConfig;
copySrcDesc.fWidth = dstContext->width();
copySrcDesc.fHeight = dstContext->height();
+ copySrcDesc.fConfig = kRGBA_8888_GrPixelConfig;
for (auto flags : { kNone_GrSurfaceFlags, kRenderTarget_GrSurfaceFlag }) {
copySrcDesc.fFlags = flags;
diff --git a/tests/TransferPixelsTest.cpp b/tests/TransferPixelsTest.cpp
index 5da292f..daeaada 100755
--- a/tests/TransferPixelsTest.cpp
+++ b/tests/TransferPixelsTest.cpp
@@ -92,11 +92,11 @@
// create texture
GrSurfaceDesc desc;
- desc.fConfig = config;
desc.fFlags = renderTarget ? kRenderTarget_GrSurfaceFlag : kNone_GrSurfaceFlags;
desc.fOrigin = origin;
desc.fWidth = kTextureWidth;
desc.fHeight = kTextureHeight;
+ desc.fConfig = config;
desc.fSampleCnt = 0;
sk_sp<GrTexture> tex = context->resourceProvider()->createTexture(desc, SkBudgeted::kNo);
@@ -109,8 +109,8 @@
REPORTER_ASSERT(reporter, result);
memset(dstBuffer.get(), 0xCDCD, size);
- result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, config,
- dstBuffer.get(), rowBytes);
+ result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight,
+ config, dstBuffer.get(), rowBytes);
if (result) {
REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer,
dstBuffer,
@@ -120,7 +120,7 @@
kBufferHeight,
origin));
}
-
+
//////////////////////////
// transfer partial data
@@ -141,8 +141,8 @@
REPORTER_ASSERT(reporter, result);
memset(dstBuffer.get(), 0xCDCD, size);
- result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight, config,
- dstBuffer.get(), rowBytes);
+ result = context->getGpu()->readPixels(tex.get(), 0, 0, kTextureWidth, kTextureHeight,
+ config, dstBuffer.get(), rowBytes);
if (result) {
REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_values(srcBuffer,
dstBuffer,