Commit e3ed0e0a authored by dtrainor's avatar dtrainor Committed by Commit bot

[Android] Expose method for UI to force composites

Allow the ContentViewRenderView to request composites if UX components require it.

BUG=387177

Review URL: https://codereview.chromium.org/504553002

Cr-Commit-Position: refs/heads/master@{#291982}
parent 22317f42
...@@ -120,6 +120,12 @@ void ContentViewRenderView::SurfaceChanged(JNIEnv* env, jobject obj, ...@@ -120,6 +120,12 @@ void ContentViewRenderView::SurfaceChanged(JNIEnv* env, jobject obj,
void ContentViewRenderView::SetOverlayVideoMode( void ContentViewRenderView::SetOverlayVideoMode(
JNIEnv* env, jobject obj, bool enabled) { JNIEnv* env, jobject obj, bool enabled) {
compositor_->SetHasTransparentBackground(enabled); compositor_->SetHasTransparentBackground(enabled);
SetNeedsComposite(env, obj);
}
void ContentViewRenderView::SetNeedsComposite(JNIEnv* env, jobject obj) {
if (compositor_)
compositor_->SetNeedsComposite();
} }
void ContentViewRenderView::Layout() { void ContentViewRenderView::Layout() {
......
...@@ -41,6 +41,7 @@ class ContentViewRenderView : public CompositorClient { ...@@ -41,6 +41,7 @@ class ContentViewRenderView : public CompositorClient {
jint format, jint width, jint height, jobject surface); jint format, jint width, jint height, jobject surface);
jboolean Composite(JNIEnv* env, jobject obj); jboolean Composite(JNIEnv* env, jobject obj);
void SetOverlayVideoMode(JNIEnv* env, jobject obj, bool enabled); void SetOverlayVideoMode(JNIEnv* env, jobject obj, bool enabled);
void SetNeedsComposite(JNIEnv* env, jobject obj);
// CompositorClient implementation // CompositorClient implementation
virtual void Layout() OVERRIDE; virtual void Layout() OVERRIDE;
......
...@@ -147,6 +147,15 @@ public class ContentViewRenderView extends FrameLayout { ...@@ -147,6 +147,15 @@ public class ContentViewRenderView extends FrameLayout {
} }
} }
/**
* Trigger a redraw of the compositor. This is only needed if the UI changes something that
* does not trigger a redraw itself by updating the layer tree.
*/
public void setNeedsComposite() {
if (mNativeContentViewRenderView == 0) return;
nativeSetNeedsComposite(mNativeContentViewRenderView);
}
/** /**
* This method should be subclassed to provide actions to be performed once the view is ready to * This method should be subclassed to provide actions to be performed once the view is ready to
* render. * render.
...@@ -216,4 +225,5 @@ public class ContentViewRenderView extends FrameLayout { ...@@ -216,4 +225,5 @@ public class ContentViewRenderView extends FrameLayout {
int format, int width, int height, Surface surface); int format, int width, int height, Surface surface);
private native void nativeSetOverlayVideoMode(long nativeContentViewRenderView, private native void nativeSetOverlayVideoMode(long nativeContentViewRenderView,
boolean enabled); boolean enabled);
private native void nativeSetNeedsComposite(long nativeContentViewRenderView);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment