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

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 11234008: Enable texture readback support for Android (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 2 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
OLDNEW
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 #include "content/browser/renderer_host/compositor_impl_android.h" 5 #include "content/browser/renderer_host/compositor_impl_android.h"
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "content/browser/gpu/browser_gpu_channel_host_factory.h" 13 #include "content/browser/gpu/browser_gpu_channel_host_factory.h"
14 #include "content/browser/gpu/gpu_surface_tracker.h" 14 #include "content/browser/gpu/gpu_surface_tracker.h"
15 #include "content/browser/renderer_host/image_transport_factory_android.h" 15 #include "content/browser/renderer_host/image_transport_factory_android.h"
16 #include "content/common/gpu/client/gl_helper.h"
16 #include "content/common/gpu/client/gpu_channel_host.h" 17 #include "content/common/gpu/client/gpu_channel_host.h"
17 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" 18 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
18 #include "content/common/gpu/gpu_process_launch_causes.h" 19 #include "content/common/gpu/gpu_process_launch_causes.h"
19 #include "content/public/common/content_switches.h" 20 #include "content/public/common/content_switches.h"
20 #include "third_party/khronos/GLES2/gl2.h" 21 #include "third_party/khronos/GLES2/gl2.h"
21 #include "third_party/khronos/GLES2/gl2ext.h" 22 #include "third_party/khronos/GLES2/gl2ext.h"
22 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h" 23 #include "third_party/WebKit/Source/Platform/chromium/public/Platform.h"
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor t.h" 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorSuppor t.h"
24 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h" 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebCompositorOutput Surface.h"
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h" 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebGraphicsContext3 D.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 227
227 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) { 228 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) {
228 WebKit::WebGraphicsContext3D* context = 229 WebKit::WebGraphicsContext3D* context =
229 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); 230 ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
230 if (context->isContextLost()) 231 if (context->isContextLost())
231 return; 232 return;
232 context->deleteTexture(texture_id); 233 context->deleteTexture(texture_id);
233 DCHECK(context->getError() == GL_NO_ERROR); 234 DCHECK(context->getError() == GL_NO_ERROR);
234 } 235 }
235 236
237 void CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
238 gfx::JavaBitmap& bitmap) {
239 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
240 helper->ReadbackTextureSync(texture_id,
241 bitmap.size(),
242 static_cast<unsigned char*> (bitmap.pixels()));
243 }
244
236 void CompositorImpl::updateAnimations(double frameBeginTime) { 245 void CompositorImpl::updateAnimations(double frameBeginTime) {
237 } 246 }
238 247
239 void CompositorImpl::layout() { 248 void CompositorImpl::layout() {
240 } 249 }
241 250
242 void CompositorImpl::applyScrollAndScale(const WebKit::WebSize& scrollDelta, 251 void CompositorImpl::applyScrollAndScale(const WebKit::WebSize& scrollDelta,
243 float scaleFactor) { 252 float scaleFactor) {
244 } 253 }
245 254
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 case ANDROID_BITMAP_FORMAT_RGBA_8888: 336 case ANDROID_BITMAP_FORMAT_RGBA_8888:
328 return GL_UNSIGNED_BYTE; 337 return GL_UNSIGNED_BYTE;
329 break; 338 break;
330 case ANDROID_BITMAP_FORMAT_RGB_565: 339 case ANDROID_BITMAP_FORMAT_RGB_565:
331 default: 340 default:
332 return GL_UNSIGNED_SHORT_5_6_5; 341 return GL_UNSIGNED_SHORT_5_6_5;
333 } 342 }
334 } 343 }
335 344
336 } // namespace content 345 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698