From 154ce91dc96187229d0bc84cf10a77f480194e6f Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Wed, 17 May 2017 10:40:02 -0400 Subject: [PATCH] Replace most uses of GrSurface::desc() with conifg(), width(), etc. Change-Id: Ic283c0ddf9efa0a467e97e10f5413ba9dfcb414f Reviewed-on: https://skia-review.googlesource.com/17211 Reviewed-by: Robert Phillips Commit-Queue: Brian Salomon --- include/gpu/GrSurface.h | 2 +- src/gpu/GrGpu.cpp | 7 +++---- src/gpu/gl/GrGLGpu.cpp | 8 ++++---- src/gpu/vk/GrVkGpu.cpp | 6 +++--- tools/gpu/GrTest.cpp | 2 +- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/gpu/GrSurface.h b/include/gpu/GrSurface.h index 668838b..b6d1c50 100644 --- a/include/gpu/GrSurface.h +++ b/include/gpu/GrSurface.h @@ -50,7 +50,7 @@ public: GrPixelConfig config() const { return fDesc.fConfig; } /** - * Return the descriptor describing the surface + * Return the descriptor describing the surface. */ const GrSurfaceDesc& desc() const { return fDesc; } diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp index ceb0dee..0f7645a 100644 --- a/src/gpu/GrGpu.cpp +++ b/src/gpu/GrGpu.cpp @@ -311,8 +311,7 @@ bool GrGpu::getWritePixelsInfo(GrSurface* dstSurface, int width, int height, SkASSERT(dstSurface); SkASSERT(kGpuPrefersDraw_DrawPreference != *drawPreference); - if (GrPixelConfigIsCompressed(dstSurface->desc().fConfig) && - dstSurface->desc().fConfig != srcConfig) { + if (GrPixelConfigIsCompressed(dstSurface->config()) && dstSurface->config() != srcConfig) { return false; } @@ -464,7 +463,7 @@ void GrGpu::didWriteToSurface(GrSurface* surface, const SkIRect* bounds, uint32_ const GrGpu::MultisampleSpecs& GrGpu::queryMultisampleSpecs(const GrPipeline& pipeline) { GrRenderTarget* rt = pipeline.getRenderTarget(); - SkASSERT(rt->desc().fSampleCnt > 1); + SkASSERT(rt->numStencilSamples() > 1); GrStencilSettings stencil; if (pipeline.isStencilEnabled()) { @@ -477,7 +476,7 @@ const GrGpu::MultisampleSpecs& GrGpu::queryMultisampleSpecs(const GrPipeline& pi int effectiveSampleCnt; SkSTArray<16, SkPoint, true> pattern; this->onQueryMultisampleSpecs(rt, stencil, &effectiveSampleCnt, &pattern); - SkASSERT(effectiveSampleCnt >= rt->desc().fSampleCnt); + SkASSERT(effectiveSampleCnt >= rt->numStencilSamples()); uint8_t id; if (this->caps()->sampleLocationsSupport()) { diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 842e229..d77ca71 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -766,9 +766,9 @@ bool GrGLGpu::onWritePixels(GrSurface* surface, GL_CALL(BindTexture(glTex->target(), glTex->textureID())); bool success = false; - if (GrPixelConfigIsCompressed(glTex->desc().fConfig)) { + if (GrPixelConfigIsCompressed(glTex->config())) { // We check that config == desc.fConfig in GrGLGpu::canWriteTexturePixels() - SkASSERT(config == glTex->desc().fConfig); + SkASSERT(config == glTex->config()); success = this->uploadCompressedTexData(glTex->desc(), glTex->target(), texels, kWrite_UploadType, left, top, width, height); } else { @@ -790,7 +790,7 @@ bool GrGLGpu::onTransferPixels(GrSurface* surface, } // For the moment, can't transfer compressed data - if (GrPixelConfigIsCompressed(glTex->desc().fConfig)) { + if (GrPixelConfigIsCompressed(glTex->config())) { return false; } @@ -4271,7 +4271,7 @@ void GrGLGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSetting GR_GL_GetIntegerv(this->glInterface(), GR_GL_SAMPLES, effectiveSampleCnt); } - SkASSERT(*effectiveSampleCnt >= rt->desc().fSampleCnt); + SkASSERT(*effectiveSampleCnt >= rt->numStencilSamples()); if (this->caps()->sampleLocationsSupport()) { samplePattern->reset(*effectiveSampleCnt); diff --git a/src/gpu/vk/GrVkGpu.cpp b/src/gpu/vk/GrVkGpu.cpp index e6a69b7..8469755 100644 --- a/src/gpu/vk/GrVkGpu.cpp +++ b/src/gpu/vk/GrVkGpu.cpp @@ -379,9 +379,9 @@ bool GrVkGpu::onWritePixels(GrSurface* surface, } bool success = false; - if (GrPixelConfigIsCompressed(vkTex->desc().fConfig)) { + if (GrPixelConfigIsCompressed(vkTex->config())) { // We check that config == desc.fConfig in GrGpu::getWritePixelsInfo() - SkASSERT(config == vkTex->desc().fConfig); + SkASSERT(config == vkTex->config()); // TODO: add compressed texture support // delete the following two lines and uncomment the two after that when ready vkTex->unref(); @@ -1716,7 +1716,7 @@ void GrVkGpu::onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSetting int* effectiveSampleCnt, SamplePattern*) { // TODO: stub. SkASSERT(!this->caps()->sampleLocationsSupport()); - *effectiveSampleCnt = rt->desc().fSampleCnt; + *effectiveSampleCnt = rt->numStencilSamples(); } bool GrVkGpu::onGetReadPixelsInfo(GrSurface* srcSurface, int width, int height, size_t rowBytes, diff --git a/tools/gpu/GrTest.cpp b/tools/gpu/GrTest.cpp index b8bf681..af1a06f 100644 --- a/tools/gpu/GrTest.cpp +++ b/tools/gpu/GrTest.cpp @@ -331,7 +331,7 @@ public: void onQueryMultisampleSpecs(GrRenderTarget* rt, const GrStencilSettings&, int* effectiveSampleCnt, SamplePattern*) override { - *effectiveSampleCnt = rt->desc().fSampleCnt; + *effectiveSampleCnt = rt->numStencilSamples(); } GrGpuCommandBuffer* createCommandBuffer(const GrGpuCommandBuffer::LoadAndStoreInfo&, -- 2.7.4