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 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 bool CompositorImpl::CopyTextureToBitmap(blink::WebGLId texture_id, | 345 bool CompositorImpl::CopyTextureToBitmap(blink::WebGLId texture_id, |
346 const gfx::Rect& sub_rect, | 346 const gfx::Rect& sub_rect, |
347 gfx::JavaBitmap& bitmap) { | 347 gfx::JavaBitmap& bitmap) { |
348 // The sub_rect should match the bitmap size. | 348 // The sub_rect should match the bitmap size. |
349 DCHECK(bitmap.size() == sub_rect.size()); | 349 DCHECK(bitmap.size() == sub_rect.size()); |
350 if (bitmap.size() != sub_rect.size() || texture_id == 0) return false; | 350 if (bitmap.size() != sub_rect.size() || texture_id == 0) return false; |
351 | 351 |
352 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); | 352 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); |
353 helper->ReadbackTextureSync(texture_id, | 353 helper->ReadbackTextureSync(texture_id, |
354 sub_rect, | 354 sub_rect, |
355 static_cast<unsigned char*> (bitmap.pixels()), | 355 static_cast<unsigned char*> (bitmap.pixels())); |
356 SkBitmap::kARGB_8888_Config); | |
357 return true; | 356 return true; |
358 } | 357 } |
359 | 358 |
360 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 359 static scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
361 CreateGpuProcessViewContext( | 360 CreateGpuProcessViewContext( |
362 const blink::WebGraphicsContext3D::Attributes attributes, | 361 const blink::WebGraphicsContext3D::Attributes attributes, |
363 int surface_id) { | 362 int surface_id) { |
364 BrowserGpuChannelHostFactory* factory = | 363 BrowserGpuChannelHostFactory* factory = |
365 BrowserGpuChannelHostFactory::instance(); | 364 BrowserGpuChannelHostFactory::instance(); |
366 CauseForGpuLaunch cause = | 365 CauseForGpuLaunch cause = |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 default: | 494 default: |
496 return GL_UNSIGNED_SHORT_5_6_5; | 495 return GL_UNSIGNED_SHORT_5_6_5; |
497 } | 496 } |
498 } | 497 } |
499 | 498 |
500 void CompositorImpl::DidCommit() { | 499 void CompositorImpl::DidCommit() { |
501 root_window_->OnCompositingDidCommit(); | 500 root_window_->OnCompositingDidCommit(); |
502 } | 501 } |
503 | 502 |
504 } // namespace content | 503 } // namespace content |
OLD | NEW |