From 9505a6552764461c22ce48f1ac13d025d23e1579 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Wed, 14 Dec 2016 09:43:50 -0800 Subject: Add new RGBA_F16 bitmap config This configuration uses 64 bits per pixel. Heach component is stored as a half precision float value (16 bits). Half floats can be decoded/encoded using android.util.Half. RGBA_F16 bitmaps are used to decode wide-gamut images stored in 16 bit formats (PNG 16 bit for instance). aapt is currently not aware of PNG 16 bits so such files must be placed in raw/ resource directories. This first pass provides only partial drawing support with hardware acceleration. RGBA_F16 bitmaps are stored in linear space and need to be encoded to gamma space with the appropriate OETF to be rendered properly on Android's current surfaces. They are however suitable for linear blending. Full rendering support will be provided in a future CL (BitmapShaders might be a bit tricky to handle properly during shader generation). Bug: 32984164 Test: bit CtsGraphicsTestCases:android.graphics.cts.BitmapRGBAF16Test Change-Id: I328e6b567441a1b9d152a3e7be944a2cf63193bd --- libs/hwui/OpenGLReadback.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'libs/hwui/OpenGLReadback.cpp') diff --git a/libs/hwui/OpenGLReadback.cpp b/libs/hwui/OpenGLReadback.cpp index 4c8abc5da832..938b6efa7901 100644 --- a/libs/hwui/OpenGLReadback.cpp +++ b/libs/hwui/OpenGLReadback.cpp @@ -131,6 +131,13 @@ inline CopyResult copyTextureInto(Caches& caches, RenderState& renderState, destWidth, destHeight, caches.maxTextureSize); return CopyResult::DestinationInvalid; } + + // TODO: Add support for RGBA_F16 destinations + if (bitmap->colorType() == kRGBA_F16_SkColorType) { + ALOGW("Can't copy surface into bitmap, RGBA_F16 config is not supported"); + return CopyResult::DestinationInvalid; + } + GLuint fbo = renderState.createFramebuffer(); if (!fbo) { ALOGW("Could not obtain an FBO"); -- cgit v1.2.3-59-g8ed1b