| Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java
|
| index f7a4cab8364a7bd0e60e41ef0b1a9c00801e6c68..b5c050dd0555decf14ffd67d4a5031bbc8b40bd6 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorView.java
|
| @@ -9,6 +9,7 @@ import android.content.Context;
|
| import android.graphics.Color;
|
| import android.graphics.PixelFormat;
|
| import android.graphics.Rect;
|
| +import android.graphics.SurfaceTexture;
|
| import android.view.MotionEvent;
|
| import android.view.Surface;
|
| import android.view.SurfaceHolder;
|
| @@ -21,7 +22,6 @@ import org.chromium.base.TraceEvent;
|
| import org.chromium.base.VisibleForTesting;
|
| import org.chromium.base.annotations.CalledByNative;
|
| import org.chromium.base.annotations.JNINamespace;
|
| -import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.ChromeSwitches;
|
| import org.chromium.chrome.browser.compositor.layouts.Layout;
|
| import org.chromium.chrome.browser.compositor.layouts.LayoutProvider;
|
| @@ -61,6 +61,8 @@ public class CompositorView
|
|
|
| private int mLastLayerCount;
|
|
|
| + private Surface mSurface = null;
|
| +
|
| // Resource Management
|
| private ResourceManager mResourceManager;
|
|
|
| @@ -206,10 +208,26 @@ public class CompositorView
|
| nativeSetOverlayVideoMode(mNativeCompositorView, enabled);
|
| }
|
|
|
| + /**
|
| + * Replace the Surface that CompositorView has with a new Surface that backed by SurfaceTexture.
|
| + */
|
| + public void replaceCompositorSurface(SurfaceTexture surfaceTexture) {
|
| + final int width = getWidth();
|
| + final int height = getHeight();
|
| + surfaceTexture.setDefaultBufferSize(width, height);
|
| + mSurface = new Surface(surfaceTexture);
|
| + surfaceChanged(getHolder(), mCurrentPixelFormat, width, height);
|
| + }
|
| +
|
| @Override
|
| public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
|
| if (mNativeCompositorView == 0) return;
|
| - nativeSurfaceChanged(mNativeCompositorView, format, width, height, holder.getSurface());
|
| +
|
| + if (mSurface != null) {
|
| + nativeSurfaceChanged(mNativeCompositorView, format, width, height, mSurface);
|
| + } else {
|
| + nativeSurfaceChanged(mNativeCompositorView, format, width, height, holder.getSurface());
|
| + }
|
| mRenderHost.onPhysicalBackingSizeChanged(width, height);
|
| mSurfaceWidth = width;
|
| mSurfaceHeight = height;
|
| @@ -324,7 +342,7 @@ public class CompositorView
|
| }
|
|
|
| // IMPORTANT: Do not do anything that impacts the compositor layer tree before this line.
|
| - // If you do, you could inadvertently trigger follow up renders. For further information
|
| + // If you do, you could inadvertently trigger follow up renders. For further information
|
| // see dtrainor@, tedchoc@, or klobag@.
|
|
|
| // TODO(jscholler): change 1.0f to dpToPx once the native part is fully supporting dp.
|
|
|