Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(420)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java

Issue 270933002: Make ContentViewRenderView::CompositeToBitmap not CompositeAndReadback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: contentviewrenderview: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/android/content_view_render_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 protected void onReadyToRender() { 160 protected void onReadyToRender() {
161 } 161 }
162 162
163 /** 163 /**
164 * This method could be subclassed optionally to provide a custom SurfaceVie w object to 164 * This method could be subclassed optionally to provide a custom SurfaceVie w object to
165 * this ContentViewRenderView. 165 * this ContentViewRenderView.
166 * @param context The context used to create the SurfaceView object. 166 * @param context The context used to create the SurfaceView object.
167 * @return The created SurfaceView object. 167 * @return The created SurfaceView object.
168 */ 168 */
169 protected SurfaceView createSurfaceView(Context context) { 169 protected SurfaceView createSurfaceView(Context context) {
170 return new SurfaceView(context) { 170 return new SurfaceView(context);
171 @Override
172 public void onDraw(Canvas canvas) {
173 // We only need to draw to software canvases, which are used for taking screenshots.
174 if (canvas.isHardwareAccelerated()) return;
175 Bitmap bitmap = Bitmap.createBitmap(getWidth(), getHeight(),
176 Bitmap.Config.ARGB_8888);
177 if (nativeCompositeToBitmap(mNativeContentViewRenderView, bitmap )) {
178 canvas.drawBitmap(bitmap, 0, 0, null);
179 }
180 }
181 };
182 } 171 }
183 172
184 /** 173 /**
185 * @return whether the surface view is initialized and ready to render. 174 * @return whether the surface view is initialized and ready to render.
186 */ 175 */
187 public boolean isInitialized() { 176 public boolean isInitialized() {
188 return mSurfaceView.getHolder().getSurface() != null; 177 return mSurfaceView.getHolder().getSurface() != null;
189 } 178 }
190 179
191 /** 180 /**
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 private native void nativeDestroy(long nativeContentViewRenderView); 251 private native void nativeDestroy(long nativeContentViewRenderView);
263 private native void nativeSetCurrentContentViewCore(long nativeContentViewRe nderView, 252 private native void nativeSetCurrentContentViewCore(long nativeContentViewRe nderView,
264 long nativeContentViewCore); 253 long nativeContentViewCore);
265 private native void nativeSetLayerTreeBuildHelper(long nativeContentViewRend erView, 254 private native void nativeSetLayerTreeBuildHelper(long nativeContentViewRend erView,
266 long buildHelperNativePtr); 255 long buildHelperNativePtr);
267 private native void nativeSurfaceCreated(long nativeContentViewRenderView); 256 private native void nativeSurfaceCreated(long nativeContentViewRenderView);
268 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView) ; 257 private native void nativeSurfaceDestroyed(long nativeContentViewRenderView) ;
269 private native void nativeSurfaceChanged(long nativeContentViewRenderView, 258 private native void nativeSurfaceChanged(long nativeContentViewRenderView,
270 int format, int width, int height, Surface surface); 259 int format, int width, int height, Surface surface);
271 private native boolean nativeComposite(long nativeContentViewRenderView); 260 private native boolean nativeComposite(long nativeContentViewRenderView);
272 private native boolean nativeCompositeToBitmap(long nativeContentViewRenderV iew, Bitmap bitmap);
273 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi ew, 261 private native void nativeSetOverlayVideoMode(long nativeContentViewRenderVi ew,
274 boolean enabled); 262 boolean enabled);
275 } 263 }
OLDNEW
« no previous file with comments | « content/browser/android/content_view_render_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698