summaryrefslogtreecommitdiff
path: root/core/java/android/view/TextureView.java
diff options
context:
space:
mode:
Diffstat (limited to 'core/java/android/view/TextureView.java')
-rw-r--r--core/java/android/view/TextureView.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index cdc196e1c371..23bd3ac17954 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -302,11 +302,25 @@ public class TextureView extends View {
*/
@Override
public final void draw(Canvas canvas) {
- // NOTE: Maintain this carefully (see View.java)
+ // NOTE: Maintain this carefully (see View#draw)
mPrivateFlags = (mPrivateFlags & ~PFLAG_DIRTY_MASK) | PFLAG_DRAWN;
- applyUpdate();
- applyTransformMatrix();
+ /* Simplify drawing to guarantee the layer is the only thing drawn - so e.g. no background,
+ scrolling, or fading edges. This guarantees all drawing is in the layer, so drawing
+ properties (alpha, layer paint) affect all of the content of a TextureView. */
+
+ if (canvas.isHardwareAccelerated()) {
+ DisplayListCanvas displayListCanvas = (DisplayListCanvas) canvas;
+
+ HardwareLayer layer = getHardwareLayer();
+ if (layer != null) {
+ applyUpdate();
+ applyTransformMatrix();
+
+ mLayer.setLayerPaint(mLayerPaint); // ensure layer paint is up to date
+ displayListCanvas.drawHardwareLayer(layer);
+ }
+ }
}
/**
@@ -342,12 +356,7 @@ public class TextureView extends View {
invalidate(true);
}
- @Override
HardwareLayer getHardwareLayer() {
- // NOTE: Maintain these two lines very carefully (see View.java)
- mPrivateFlags |= PFLAG_DRAWN | PFLAG_DRAWING_CACHE_VALID;
- mPrivateFlags &= ~PFLAG_DIRTY_MASK;
-
if (mLayer == null) {
if (mAttachInfo == null || mAttachInfo.mHardwareRenderer == null) {
return null;
@@ -385,9 +394,6 @@ public class TextureView extends View {
mSurface.setDefaultBufferSize(getWidth(), getHeight());
}
- applyUpdate();
- applyTransformMatrix();
-
return mLayer;
}