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

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

Issue 11558039: Subrect snapshot support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed indents Created 8 years 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"
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) { 252 void CompositorImpl::DeleteTexture(WebKit::WebGLId texture_id) {
253 WebKit::WebGraphicsContext3D* context = 253 WebKit::WebGraphicsContext3D* context =
254 ImageTransportFactoryAndroid::GetInstance()->GetContext3D(); 254 ImageTransportFactoryAndroid::GetInstance()->GetContext3D();
255 if (context->isContextLost() || !context->makeContextCurrent()) 255 if (context->isContextLost() || !context->makeContextCurrent())
256 return; 256 return;
257 context->deleteTexture(texture_id); 257 context->deleteTexture(texture_id);
258 context->shallowFlushCHROMIUM(); 258 context->shallowFlushCHROMIUM();
259 DCHECK(context->getError() == GL_NO_ERROR); 259 DCHECK(context->getError() == GL_NO_ERROR);
260 } 260 }
261 261
262 void CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id, 262 bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
263 gfx::JavaBitmap& bitmap) { 263 gfx::JavaBitmap& bitmap) {
264 return CopyTextureToBitmap(texture_id, gfx::Rect(bitmap.size()), bitmap);
265 }
266
267 bool CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id,
268 const gfx::Rect& sub_rect,
269 gfx::JavaBitmap& bitmap) {
270 // The sub_rect should match the bitmap size.
271 DCHECK(bitmap.size() == sub_rect.size());
272 if (bitmap.size() != sub_rect.size() || texture_id == 0) return false;
no sievers 2012/12/18 19:33:19 line break before return I guess the dcheck() can
273
264 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); 274 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper();
265 helper->ReadbackTextureSync(texture_id, 275 helper->ReadbackTextureSync(texture_id,
266 bitmap.size(), 276 sub_rect,
267 static_cast<unsigned char*> (bitmap.pixels())); 277 static_cast<unsigned char*> (bitmap.pixels()));
278 return true;
268 } 279 }
269 280
270 void CompositorImpl::animate(double monotonicFrameBeginTime) { 281 void CompositorImpl::animate(double monotonicFrameBeginTime) {
271 } 282 }
272 283
273 void CompositorImpl::layout() { 284 void CompositorImpl::layout() {
274 } 285 }
275 286
276 void CompositorImpl::applyScrollAndScale(gfx::Vector2d scrollDelta, 287 void CompositorImpl::applyScrollAndScale(gfx::Vector2d scrollDelta,
277 float pageScale) { 288 float pageScale) {
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 case ANDROID_BITMAP_FORMAT_RGBA_8888: 408 case ANDROID_BITMAP_FORMAT_RGBA_8888:
398 return GL_UNSIGNED_BYTE; 409 return GL_UNSIGNED_BYTE;
399 break; 410 break;
400 case ANDROID_BITMAP_FORMAT_RGB_565: 411 case ANDROID_BITMAP_FORMAT_RGB_565:
401 default: 412 default:
402 return GL_UNSIGNED_SHORT_5_6_5; 413 return GL_UNSIGNED_SHORT_5_6_5;
403 } 414 }
404 } 415 }
405 416
406 } // namespace content 417 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698