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

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: Rebased 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 229
229 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) { 230 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) {
230 WebKit::WebGraphicsContext3D* context = 231 WebKit::WebGraphicsContext3D* context =
231 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); 232 ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
232 if (context->isContextLost()) 233 if (context->isContextLost())
233 return; 234 return;
234 context->deleteTexture(texture_id); 235 context->deleteTexture(texture_id);
235 DCHECK(context->getError() == GL_NO_ERROR); 236 DCHECK(context->getError() == GL_NO_ERROR);
236 } 237 }
237 238
239 void CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
240 gfx::JavaBitmap& bitmap) {
241 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
242 helper->ReadbackTextureSync(texture_id,
243 bitmap.size(),
244 static_cast<unsigned char*> (bitmap.pixels()));
245 }
246
238 void CompositorImpl::updateAnimations(double frameBeginTime) { 247 void CompositorImpl::updateAnimations(double frameBeginTime) {
239 } 248 }
240 249
241 void CompositorImpl::layout() { 250 void CompositorImpl::layout() {
242 } 251 }
243 252
244 void CompositorImpl::applyScrollAndScale(const WebKit::WebSize& scrollDelta, 253 void CompositorImpl::applyScrollAndScale(const WebKit::WebSize& scrollDelta,
245 float scaleFactor) { 254 float scaleFactor) {
246 } 255 }
247 256
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 case ANDROID_BITMAP_FORMAT_RGBA_8888: 340 case ANDROID_BITMAP_FORMAT_RGBA_8888:
332 return GL_UNSIGNED_BYTE; 341 return GL_UNSIGNED_BYTE;
333 break; 342 break;
334 case ANDROID_BITMAP_FORMAT_RGB_565: 343 case ANDROID_BITMAP_FORMAT_RGB_565:
335 default: 344 default:
336 return GL_UNSIGNED_SHORT_5_6_5; 345 return GL_UNSIGNED_SHORT_5_6_5;
337 } 346 }
338 } 347 }
339 348
340 } // namespace content 349 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698