Properly decode colors spaces in BitmapRegionDecoder
Reusing a bitmap with BitmapRegionDecoder would preserve the
previous color space. This change also tweaks color space
matching to make sure we pick Display P3 with parameter d=0.039
or d=0.04045
Bug: 36905374
Test: CtsGraphicsTestCases
Change-Id: I4d2d66e5babebb0b5ce5cbdc7e8244177b4b7f9c
diff --git a/libs/hwui/GlopBuilder.cpp b/libs/hwui/GlopBuilder.cpp
index 3e7a246..931a55a 100644
--- a/libs/hwui/GlopBuilder.cpp
+++ b/libs/hwui/GlopBuilder.cpp
@@ -600,12 +600,12 @@
void GlopBuilder::build() {
REQUIRE_STAGES(kAllStages);
if (mOutGlop->mesh.vertices.attribFlags & VertexAttribFlags::TextureCoord) {
- if (mOutGlop->fill.texture.texture->target() == GL_TEXTURE_2D) {
+ Texture* texture = mOutGlop->fill.texture.texture;
+ if (texture->target() == GL_TEXTURE_2D) {
mDescription.hasTexture = true;
} else {
mDescription.hasExternalTexture = true;
}
- Texture* texture = mOutGlop->fill.texture.texture;
mDescription.hasLinearTexture = texture->isLinear();
mDescription.hasColorSpaceConversion = texture->hasColorSpaceConversion();
mDescription.transferFunction = texture->getTransferFunctionType();