OLD | NEW |
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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void CompositorImpl::CopyTextureToBitmap(WebKit::WebGLId texture_id, |
| 263 const gfx::Rect& sub_rect, |
263 gfx::JavaBitmap& bitmap) { | 264 gfx::JavaBitmap& bitmap) { |
| 265 // The sub_rect should match the bitmap size. |
| 266 DCHECK(bitmap.size() == sub_rect.size()); |
264 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); | 267 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); |
265 helper->ReadbackTextureSync(texture_id, | 268 helper->ReadbackTextureSync(texture_id, |
266 bitmap.size(), | 269 sub_rect, |
267 static_cast<unsigned char*> (bitmap.pixels())); | 270 static_cast<unsigned char*> (bitmap.pixels())); |
268 } | 271 } |
269 | 272 |
270 void CompositorImpl::animate(double monotonicFrameBeginTime) { | 273 void CompositorImpl::animate(double monotonicFrameBeginTime) { |
271 } | 274 } |
272 | 275 |
273 void CompositorImpl::layout() { | 276 void CompositorImpl::layout() { |
274 } | 277 } |
275 | 278 |
276 void CompositorImpl::applyScrollAndScale(gfx::Vector2d scrollDelta, | 279 void CompositorImpl::applyScrollAndScale(gfx::Vector2d scrollDelta, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 400 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
398 return GL_UNSIGNED_BYTE; | 401 return GL_UNSIGNED_BYTE; |
399 break; | 402 break; |
400 case ANDROID_BITMAP_FORMAT_RGB_565: | 403 case ANDROID_BITMAP_FORMAT_RGB_565: |
401 default: | 404 default: |
402 return GL_UNSIGNED_SHORT_5_6_5; | 405 return GL_UNSIGNED_SHORT_5_6_5; |
403 } | 406 } |
404 } | 407 } |
405 | 408 |
406 } // namespace content | 409 } // namespace content |
OLD | NEW |