diff options
Diffstat (limited to 'libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp b/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp index 0760f1610891..f2f5056bb195 100644 --- a/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp +++ b/libs/hwui/pipeline/skia/SkiaOpenGLReadback.cpp @@ -51,32 +51,31 @@ CopyResult SkiaOpenGLReadback::copyImageInto(EGLImageKHR eglImage, const Matrix4 grContext->resetContext(); } + if (bitmap->colorType() == kRGBA_F16_SkColorType && + !grContext->colorTypeSupportedAsSurface(bitmap->colorType())) { + ALOGW("Can't copy surface into bitmap, RGBA_F16 config is not supported"); + return CopyResult::DestinationInvalid; + } + GrGLTextureInfo externalTexture; externalTexture.fTarget = GL_TEXTURE_EXTERNAL_OES; externalTexture.fID = sourceTexId; - - GrPixelConfig pixelConfig; switch (bitmap->colorType()) { case kRGBA_F16_SkColorType: - pixelConfig = kRGBA_half_GrPixelConfig; + externalTexture.fFormat = GL_RGBA16F; break; case kN32_SkColorType: default: - pixelConfig = kRGBA_8888_GrPixelConfig; + externalTexture.fFormat = GL_RGBA8; break; } - if (pixelConfig == kRGBA_half_GrPixelConfig && - !grContext->caps()->isConfigRenderable(kRGBA_half_GrPixelConfig, false)) { - ALOGW("Can't copy surface into bitmap, RGBA_F16 config is not supported"); - return CopyResult::DestinationInvalid; - } - - GrBackendTexture backendTexture(imgWidth, imgHeight, pixelConfig, externalTexture); + GrBackendTexture backendTexture(imgWidth, imgHeight, GrMipMapped::kNo, externalTexture); CopyResult copyResult = CopyResult::UnknownError; sk_sp<SkImage> image(SkImage::MakeFromAdoptedTexture(grContext.get(), backendTexture, - kTopLeft_GrSurfaceOrigin)); + kTopLeft_GrSurfaceOrigin, + bitmap->colorType())); if (image) { int displayedWidth = imgWidth, displayedHeight = imgHeight; // If this is a 90 or 270 degree rotation we need to swap width/height to get the device @@ -138,6 +137,8 @@ CopyResult SkiaOpenGLReadback::copyImageInto(EGLImageKHR eglImage, const Matrix4 // make sure that we have deleted the texture (in the SkImage) before we // destroy the EGLImage that it was created from image.reset(); + glFinish(); + return copyResult; } |