Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.graphics.Canvas; | 9 import android.graphics.Canvas; |
| 10 import android.graphics.Color; | 10 import android.graphics.Color; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 * Constructs a new ContentViewRenderView that should be can to a view hiera rchy. | 53 * Constructs a new ContentViewRenderView that should be can to a view hiera rchy. |
| 54 * Native code should add/remove the layers to be rendered through the Conte ntViewLayerRenderer. | 54 * Native code should add/remove the layers to be rendered through the Conte ntViewLayerRenderer. |
| 55 * @param context The context used to create this. | 55 * @param context The context used to create this. |
| 56 */ | 56 */ |
| 57 public ContentViewRenderView(Context context, WindowAndroid rootWindow) { | 57 public ContentViewRenderView(Context context, WindowAndroid rootWindow) { |
| 58 super(context); | 58 super(context); |
| 59 assert rootWindow != null; | 59 assert rootWindow != null; |
| 60 mNativeContentViewRenderView = nativeInit(rootWindow.getNativePointer()) ; | 60 mNativeContentViewRenderView = nativeInit(rootWindow.getNativePointer()) ; |
| 61 assert mNativeContentViewRenderView != 0; | 61 assert mNativeContentViewRenderView != 0; |
| 62 | 62 |
| 63 setBackgroundColor(Color.WHITE); | 63 setBackgroundColor(Color.WHITE); |
|
no sievers
2013/11/27 21:22:21
I think this can go.
powei
2013/12/02 20:03:38
Done.
| |
| 64 | 64 |
| 65 mSurfaceView = createSurfaceView(getContext()); | 65 mSurfaceView = createSurfaceView(getContext()); |
| 66 mSurfaceView.setBackgroundColor(Color.WHITE); | |
| 66 mSurfaceCallback = new SurfaceHolder.Callback() { | 67 mSurfaceCallback = new SurfaceHolder.Callback() { |
| 67 @Override | 68 @Override |
| 68 public void surfaceChanged(SurfaceHolder holder, int format, int wid th, int height) { | 69 public void surfaceChanged(SurfaceHolder holder, int format, int wid th, int height) { |
| 69 assert mNativeContentViewRenderView != 0; | 70 assert mNativeContentViewRenderView != 0; |
| 70 nativeSurfaceSetSize(mNativeContentViewRenderView, width, height ); | 71 nativeSurfaceSetSize(mNativeContentViewRenderView, width, height ); |
| 71 if (mCurrentContentView != null) { | 72 if (mCurrentContentView != null) { |
| 72 mCurrentContentView.getContentViewCore().onPhysicalBackingSi zeChanged( | 73 mCurrentContentView.getContentViewCore().onPhysicalBackingSi zeChanged( |
| 73 width, height); | 74 width, height); |
| 74 } | 75 } |
| 75 } | 76 } |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 277 } | 278 } |
| 278 | 279 |
| 279 boolean didDraw = nativeComposite(mNativeContentViewRenderView); | 280 boolean didDraw = nativeComposite(mNativeContentViewRenderView); |
| 280 if (didDraw) { | 281 if (didDraw) { |
| 281 mPendingSwapBuffers++; | 282 mPendingSwapBuffers++; |
| 282 if (getBackground() != null) { | 283 if (getBackground() != null) { |
| 283 post(new Runnable() { | 284 post(new Runnable() { |
| 284 @Override | 285 @Override |
| 285 public void run() { | 286 public void run() { |
| 286 setBackgroundResource(0); | 287 setBackgroundResource(0); |
| 288 mSurfaceView.setBackground(null); | |
|
no sievers
2013/11/27 21:22:21
This is only available in JB and up.
Does mSurfac
powei
2013/12/02 20:03:38
Done.
| |
| 287 } | 289 } |
| 288 }); | 290 }); |
| 289 } | 291 } |
| 290 } | 292 } |
| 291 } | 293 } |
| 292 | 294 |
| 293 private native long nativeInit(long rootWindowNativePointer); | 295 private native long nativeInit(long rootWindowNativePointer); |
| 294 private native void nativeDestroy(long nativeContentViewRenderView); | 296 private native void nativeDestroy(long nativeContentViewRenderView); |
| 295 private native void nativeSetCurrentContentView(long nativeContentViewRender View, | 297 private native void nativeSetCurrentContentView(long nativeContentViewRender View, |
| 296 long nativeContentView); | 298 long nativeContentView); |
| 297 private native void nativeSurfaceCreated(long nativeContentViewRenderView, S urface surface); | 299 private native void nativeSurfaceCreated(long nativeContentViewRenderView, S urface surface); |
| 298 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView) ; | 300 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView) ; |
| 299 private native void nativeSurfaceSetSize(long nativeContentViewRenderView, | 301 private native void nativeSurfaceSetSize(long nativeContentViewRenderView, |
| 300 int width, int height); | 302 int width, int height); |
| 301 private native boolean nativeComposite(long nativeContentViewRenderView); | 303 private native boolean nativeComposite(long nativeContentViewRenderView); |
| 302 private native boolean nativeCompositeToBitmap(long nativeContentViewRenderV iew, Bitmap bitmap); | 304 private native boolean nativeCompositeToBitmap(long nativeContentViewRenderV iew, Bitmap bitmap); |
| 303 } | 305 } |
| OLD | NEW |