OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 if (mCurrentContentView != null) { | 71 if (mCurrentContentView != null) { |
72 mCurrentContentView.getContentViewCore().onPhysicalBackingSi
zeChanged( | 72 mCurrentContentView.getContentViewCore().onPhysicalBackingSi
zeChanged( |
73 width, height); | 73 width, height); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 @Override | 77 @Override |
78 public void surfaceCreated(SurfaceHolder holder) { | 78 public void surfaceCreated(SurfaceHolder holder) { |
79 assert mNativeContentViewRenderView != 0; | 79 assert mNativeContentViewRenderView != 0; |
80 nativeSurfaceCreated(mNativeContentViewRenderView, holder.getSur
face()); | 80 nativeSurfaceCreated(mNativeContentViewRenderView, holder.getSur
face()); |
| 81 |
| 82 mPendingSwapBuffers = 0; |
| 83 mPendingRenders = 0; |
| 84 |
81 onReadyToRender(); | 85 onReadyToRender(); |
82 } | 86 } |
83 | 87 |
84 @Override | 88 @Override |
85 public void surfaceDestroyed(SurfaceHolder holder) { | 89 public void surfaceDestroyed(SurfaceHolder holder) { |
86 assert mNativeContentViewRenderView != 0; | 90 assert mNativeContentViewRenderView != 0; |
87 nativeSurfaceDestroyed(mNativeContentViewRenderView); | 91 nativeSurfaceDestroyed(mNativeContentViewRenderView); |
88 } | 92 } |
89 }; | 93 }; |
90 mSurfaceView.getHolder().addCallback(mSurfaceCallback); | 94 mSurfaceView.getHolder().addCallback(mSurfaceCallback); |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 contentViewCore.onPhysicalBackingSizeChanged(getWidth(), getHeight()
); | 204 contentViewCore.onPhysicalBackingSizeChanged(getWidth(), getHeight()
); |
201 mVSyncAdapter.setVSyncListener(contentViewCore.getVSyncListener(mVSy
ncAdapter)); | 205 mVSyncAdapter.setVSyncListener(contentViewCore.getVSyncListener(mVSy
ncAdapter)); |
202 } | 206 } |
203 } | 207 } |
204 | 208 |
205 /** | 209 /** |
206 * This method should be subclassed to provide actions to be performed once
the view is ready to | 210 * This method should be subclassed to provide actions to be performed once
the view is ready to |
207 * render. | 211 * render. |
208 */ | 212 */ |
209 protected void onReadyToRender() { | 213 protected void onReadyToRender() { |
210 mPendingSwapBuffers = 0; | |
211 mPendingRenders = 0; | |
212 } | 214 } |
213 | 215 |
214 /** | 216 /** |
215 * This method could be subclassed optionally to provide a custom SurfaceVie
w object to | 217 * This method could be subclassed optionally to provide a custom SurfaceVie
w object to |
216 * this ContentViewRenderView. | 218 * this ContentViewRenderView. |
217 * @param context The context used to create the SurfaceView object. | 219 * @param context The context used to create the SurfaceView object. |
218 * @return The created SurfaceView object. | 220 * @return The created SurfaceView object. |
219 */ | 221 */ |
220 protected SurfaceView createSurfaceView(Context context) { | 222 protected SurfaceView createSurfaceView(Context context) { |
221 return new SurfaceView(context) { | 223 return new SurfaceView(context) { |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 long nativeContentView); | 321 long nativeContentView); |
320 private native void nativeSurfaceCreated(long nativeContentViewRenderView, S
urface surface); | 322 private native void nativeSurfaceCreated(long nativeContentViewRenderView, S
urface surface); |
321 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView)
; | 323 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView)
; |
322 private native void nativeSurfaceSetSize(long nativeContentViewRenderView, | 324 private native void nativeSurfaceSetSize(long nativeContentViewRenderView, |
323 int width, int height); | 325 int width, int height); |
324 private native boolean nativeComposite(long nativeContentViewRenderView); | 326 private native boolean nativeComposite(long nativeContentViewRenderView); |
325 private native boolean nativeCompositeToBitmap(long nativeContentViewRenderV
iew, Bitmap bitmap); | 327 private native boolean nativeCompositeToBitmap(long nativeContentViewRenderV
iew, Bitmap bitmap); |
326 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi
ew, | 328 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi
ew, |
327 boolean enabled); | 329 boolean enabled); |
328 } | 330 } |
OLD | NEW |