summaryrefslogtreecommitdiff
path: root/libs/hwui/DeferredLayerUpdater.h
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2018-04-20 16:13:31 -0400
committerDerek Sollenberger <djsollen@google.com>2018-04-30 15:53:46 -0400
commitbe3876c434864d6c05212158b25d778d29b07eb0 (patch)
tree1b099cca944f453327b8d486ad4455c391912d9e /libs/hwui/DeferredLayerUpdater.h
parent1ce9dde87e0fe4e01c031f9cec19e6aae3807f48 (diff)
Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositing
This CL extracts the android_dataspace from the GLConsumer and converts it to a SkColorSpace. HWUI always expects to composite into an sRGB destination so when we draw the layer we run the draw through a colorFilter that converts the input colorSpace into that of the destination. Test: CtsViewTestCases Bug: 78016220 Change-Id: Ic0446a0d861e86a5a9d0382346b57fcc45c8a61b
Diffstat (limited to 'libs/hwui/DeferredLayerUpdater.h')
-rw-r--r--libs/hwui/DeferredLayerUpdater.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/libs/hwui/DeferredLayerUpdater.h b/libs/hwui/DeferredLayerUpdater.h
index 9dc029fd3852..fe3ee7a2b4c6 100644
--- a/libs/hwui/DeferredLayerUpdater.h
+++ b/libs/hwui/DeferredLayerUpdater.h
@@ -20,6 +20,7 @@
#include <SkMatrix.h>
#include <cutils/compiler.h>
#include <gui/GLConsumer.h>
+#include <system/graphics.h>
#include <utils/StrongPointer.h>
#include <GLES2/gl2.h>
@@ -41,7 +42,7 @@ public:
// Note that DeferredLayerUpdater assumes it is taking ownership of the layer
// and will not call incrementRef on it as a result.
typedef std::function<Layer*(RenderState& renderState, uint32_t layerWidth,
- uint32_t layerHeight, SkColorFilter* colorFilter, int alpha,
+ uint32_t layerHeight, sk_sp<SkColorFilter> colorFilter, int alpha,
SkBlendMode mode, bool blend)>
CreateLayerFn;
ANDROID_API explicit DeferredLayerUpdater(RenderState& renderState, CreateLayerFn createLayerFn,
@@ -96,7 +97,7 @@ public:
void detachSurfaceTexture();
- void updateLayer(bool forceFilter, const float* textureTransform);
+ void updateLayer(bool forceFilter, const float* textureTransform, android_dataspace dataspace);
void destroyLayer();
@@ -109,7 +110,7 @@ private:
int mWidth = 0;
int mHeight = 0;
bool mBlend = false;
- SkColorFilter* mColorFilter = nullptr;
+ sk_sp<SkColorFilter> mColorFilter;
int mAlpha = 255;
SkBlendMode mMode = SkBlendMode::kSrcOver;
sp<GLConsumer> mSurfaceTexture;