| 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 DCHECK(bitmap.size() == sub_rect.size()); | 351 DCHECK(bitmap.size() == sub_rect.size()); |
| 352 if (bitmap.size() != sub_rect.size() || texture_id == 0) return false; | 352 if (bitmap.size() != sub_rect.size() || texture_id == 0) return false; |
| 353 | 353 |
| 354 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); | 354 GLHelper* helper = ImageTransportFactoryAndroid::GetInstance()->GetGLHelper(); |
| 355 helper->ReadbackTextureSync(texture_id, | 355 helper->ReadbackTextureSync(texture_id, |
| 356 sub_rect, | 356 sub_rect, |
| 357 static_cast<unsigned char*> (bitmap.pixels())); | 357 static_cast<unsigned char*> (bitmap.pixels())); |
| 358 return true; | 358 return true; |
| 359 } | 359 } |
| 360 | 360 |
| 361 scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface() { | 361 scoped_ptr<cc::OutputSurface> CompositorImpl::CreateOutputSurface( |
| 362 bool fallback) { |
| 362 WebKit::WebGraphicsContext3D::Attributes attrs; | 363 WebKit::WebGraphicsContext3D::Attributes attrs; |
| 363 attrs.shareResources = true; | 364 attrs.shareResources = true; |
| 364 attrs.noAutomaticFlushes = true; | 365 attrs.noAutomaticFlushes = true; |
| 365 | 366 |
| 366 if (g_use_direct_gl) { | 367 if (g_use_direct_gl) { |
| 367 scoped_ptr<WebKit::WebGraphicsContext3D> context( | 368 scoped_ptr<WebKit::WebGraphicsContext3D> context( |
| 368 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: | 369 webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl:: |
| 369 CreateViewContext(attrs, window_)); | 370 CreateViewContext(attrs, window_)); |
| 370 if (!window_) { | 371 if (!window_) { |
| 371 return scoped_ptr<cc::OutputSurface>( | 372 return scoped_ptr<cc::OutputSurface>( |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 497 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
| 497 return GL_UNSIGNED_BYTE; | 498 return GL_UNSIGNED_BYTE; |
| 498 break; | 499 break; |
| 499 case ANDROID_BITMAP_FORMAT_RGB_565: | 500 case ANDROID_BITMAP_FORMAT_RGB_565: |
| 500 default: | 501 default: |
| 501 return GL_UNSIGNED_SHORT_5_6_5; | 502 return GL_UNSIGNED_SHORT_5_6_5; |
| 502 } | 503 } |
| 503 } | 504 } |
| 504 | 505 |
| 505 } // namespace content | 506 } // namespace content |
| OLD | NEW |