diff options
Diffstat (limited to 'src/gpu/gl')
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 8 | ||||
-rw-r--r-- | src/gpu/gl/GrGLRenderTarget.cpp | 12 | ||||
-rw-r--r-- | src/gpu/gl/GrGLTexture.cpp | 10 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.cpp | 35 | ||||
-rw-r--r-- | src/gpu/gl/GrGLUtil.h | 2 |
5 files changed, 42 insertions, 25 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 9a9f90c04e..4e88f7dde2 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -4411,9 +4411,7 @@ GrBackendTexture GrGLGpu::createTestingOnlyBackendTexture(const void* pixels, in // unbind the texture from the texture unit to avoid asserts GL_CALL(BindTexture(info.fTarget, 0)); - GrBackendTexture beTex = GrBackendTexture(w, h, mipMapped, info); - beTex.setPixelConfig(config); - return beTex; + return GrBackendTexture(w, h, mipMapped, info); } bool GrGLGpu::isTestingOnlyBackendTexture(const GrBackendTexture& tex) const { @@ -4503,9 +4501,7 @@ GrBackendRenderTarget GrGLGpu::createTestingOnlyBackendRenderTarget(int w, int h return {}; } auto stencilBits = SkToInt(this->glCaps().stencilFormats()[sFormatIdx].fStencilBits); - GrBackendRenderTarget beRT = {w, h, 1, stencilBits, info}; - beRT.setPixelConfig(config); - return beRT; + return {w, h, 1, stencilBits, config, info}; } void GrGLGpu::deleteTestingOnlyBackendRenderTarget(const GrBackendRenderTarget& backendRT) { diff --git a/src/gpu/gl/GrGLRenderTarget.cpp b/src/gpu/gl/GrGLRenderTarget.cpp index 73c5fdf4b3..de7399bd92 100644 --- a/src/gpu/gl/GrGLRenderTarget.cpp +++ b/src/gpu/gl/GrGLRenderTarget.cpp @@ -91,16 +91,8 @@ GrBackendRenderTarget GrGLRenderTarget::getBackendRenderTarget() const { numStencilBits = stencil->bits(); } - GrBackendRenderTarget beRT = GrBackendRenderTarget(this->width(), this->height(), - this->numColorSamples(), numStencilBits, - fbi); -#if GR_TEST_UTILS - // We shouldn't have to set this since the client can't access it and we will handle the config - // correctly if we go through our public SkSurface APIs. However, some of our tests bypass the - // public APIs so we need to set this manually here. - beRT.setPixelConfig(this->config()); -#endif - return beRT; + return GrBackendRenderTarget(this->width(), this->height(), this->numColorSamples(), + numStencilBits, fbi); } size_t GrGLRenderTarget::onGpuMemorySize() const { diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 771006919b..0f36dd0f32 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -98,15 +98,7 @@ GrBackendObject GrGLTexture::getTextureHandle() const { } GrBackendTexture GrGLTexture::getBackendTexture() const { - GrBackendTexture beTex = GrBackendTexture(this->width(), this->height(), - this->texturePriv().mipMapped(), fInfo); -#if GR_TEST_UTILS - // We shouldn't have to set this since the client can't access it and we will handle the config - // correctly if we go through our public SkSurface and SkImage APIs. However, some of our tests - // bypass the public APIs so we need to set this manually here. - beTex.setPixelConfig(this->config()); -#endif - return beTex; + return GrBackendTexture(this->width(), this->height(), this->texturePriv().mipMapped(), fInfo); } void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, diff --git a/src/gpu/gl/GrGLUtil.cpp b/src/gpu/gl/GrGLUtil.cpp index a268827e23..6b44402c1b 100644 --- a/src/gpu/gl/GrGLUtil.cpp +++ b/src/gpu/gl/GrGLUtil.cpp @@ -486,3 +486,38 @@ GrGLenum GrToGLStencilFunc(GrStencilTest test) { return gTable[(int)test]; } +GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat) { + switch (sizedFormat) { + case GR_GL_R8: + return kAlpha_8_as_Red_GrPixelConfig; + case GR_GL_ALPHA8: + return kAlpha_8_as_Alpha_GrPixelConfig; + case GR_GL_RGBA8: + return kRGBA_8888_GrPixelConfig; + case GR_GL_BGRA8: + return kBGRA_8888_GrPixelConfig; + case GR_GL_SRGB8_ALPHA8: + return kSRGBA_8888_GrPixelConfig; + case GR_GL_RGB565: + return kRGB_565_GrPixelConfig; + case GR_GL_RGB5: + return kRGB_565_GrPixelConfig; + case GR_GL_RGBA4: + return kRGBA_4444_GrPixelConfig; + case GR_GL_RGB10_A2: + return kRGBA_1010102_GrPixelConfig; + case GR_GL_LUMINANCE8: + return kGray_8_GrPixelConfig; + case GR_GL_RGBA32F: + return kRGBA_float_GrPixelConfig; + case GR_GL_RG32F: + return kRG_float_GrPixelConfig; + case GR_GL_R16F: + return kAlpha_half_as_Red_GrPixelConfig; + case GR_GL_RGBA16F: + return kRGBA_half_GrPixelConfig; + default: + return kUnknown_GrPixelConfig; + } +} + diff --git a/src/gpu/gl/GrGLUtil.h b/src/gpu/gl/GrGLUtil.h index 88e8901047..9905d75ef1 100644 --- a/src/gpu/gl/GrGLUtil.h +++ b/src/gpu/gl/GrGLUtil.h @@ -248,4 +248,6 @@ void GrGLClearErr(const GrGLInterface* gl); GrGLenum GrToGLStencilFunc(GrStencilTest test); +GrPixelConfig GrGLSizedFormatToPixelConfig(GrGLenum sizedFormat); + #endif |