summaryrefslogtreecommitdiff
path: root/libs/hwui/pipeline/skia/LayerDrawable.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-04-30 21:05:29 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-04-30 21:05:29 +0000
commit635dc181eda0e508d0960fae6c3bedbac7a8381c (patch)
tree1d9505870ae7d12f3d3da28bc17e0d41cbc6cd54 /libs/hwui/pipeline/skia/LayerDrawable.cpp
parent913f22a7fc47df578bbbf7008779747c5f0d85c9 (diff)
parentbe3876c434864d6c05212158b25d778d29b07eb0 (diff)
Merge "Respect a Layer's (e.g. SurfaceTexture) colorSpace when compositing"
Diffstat (limited to 'libs/hwui/pipeline/skia/LayerDrawable.cpp')
-rw-r--r--libs/hwui/pipeline/skia/LayerDrawable.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/libs/hwui/pipeline/skia/LayerDrawable.cpp b/libs/hwui/pipeline/skia/LayerDrawable.cpp
index 896c01ce910c..00ba71302dc2 100644
--- a/libs/hwui/pipeline/skia/LayerDrawable.cpp
+++ b/libs/hwui/pipeline/skia/LayerDrawable.cpp
@@ -50,9 +50,13 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer
GlLayer* glLayer = static_cast<GlLayer*>(layer);
GrGLTextureInfo externalTexture;
externalTexture.fTarget = glLayer->getRenderTarget();
- SkASSERT(GL_RGBA == glLayer->getTexture().internalFormat());
- externalTexture.fFormat = GL_RGBA8;
externalTexture.fID = glLayer->getTextureId();
+ // The format may not be GL_RGBA8, but given the DeferredLayerUpdater and GLConsumer don't
+ // expose that info we use it as our default. Further, given that we only use this texture
+ // as a source this will not impact how Skia uses the texture. The only potential affect
+ // this is anticipated to have is that for some format types if we are not bound as an OES
+ // texture we may get invalid results for SKP capture if we read back the texture.
+ externalTexture.fFormat = GL_RGBA8;
GrBackendTexture backendTexture(layerWidth, layerHeight, GrMipMapped::kNo, externalTexture);
layerImage = SkImage::MakeFromTexture(context, backendTexture, kTopLeft_GrSurfaceOrigin,
kRGBA_8888_SkColorType, kPremul_SkAlphaType, nullptr);
@@ -83,7 +87,7 @@ bool LayerDrawable::DrawLayer(GrContext* context, SkCanvas* canvas, Layer* layer
SkPaint paint;
paint.setAlpha(layer->getAlpha());
paint.setBlendMode(layer->getMode());
- paint.setColorFilter(sk_ref_sp(layer->getColorFilter()));
+ paint.setColorFilter(layer->getColorSpaceWithFilter());
const bool nonIdentityMatrix = !matrix.isIdentity();
if (nonIdentityMatrix) {