Chromium Code Reviews| 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 28 matching lines...) Expand all Loading... | |
| 39 namespace gfx { | 39 namespace gfx { |
| 40 class JavaBitmap; | 40 class JavaBitmap; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 // Used for drawing directly to the screen. Bypasses resizing and swaps. | 45 // Used for drawing directly to the screen. Bypasses resizing and swaps. |
| 46 class DirectOutputSurface : public cc::OutputSurface { | 46 class DirectOutputSurface : public cc::OutputSurface { |
| 47 public: | 47 public: |
| 48 DirectOutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d) | 48 DirectOutputSurface(scoped_ptr<WebKit::WebGraphicsContext3D> context3d) |
| 49 : cc::OutputSurface(context3d.Pass()) {} | 49 : cc::OutputSurface(context3d.Pass()) { |
| 50 capabilities_.has_parent_compositor = false; | |
|
no sievers
2013/06/13 01:17:47
This is for the soon-to-be-deprecated WebView w/br
| |
| 51 } | |
| 50 | 52 |
| 51 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE { | 53 virtual void Reshape(gfx::Size size, float scale_factor) OVERRIDE { |
| 52 surface_size_ = size; | 54 surface_size_ = size; |
| 53 } | 55 } |
| 54 virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE { | 56 virtual void SwapBuffers(cc::CompositorFrame*) OVERRIDE { |
| 55 context3d()->shallowFlushCHROMIUM(); | 57 context3d()->shallowFlushCHROMIUM(); |
| 56 } | 58 } |
| 57 }; | 59 }; |
| 58 | 60 |
| 59 static bool g_initialized = false; | 61 static bool g_initialized = false; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 362 url, | 364 url, |
| 363 factory, | 365 factory, |
| 364 weak_factory_.GetWeakPtr())); | 366 weak_factory_.GetWeakPtr())); |
| 365 if (!context->InitializeWithDefaultBufferSizes( | 367 if (!context->InitializeWithDefaultBufferSizes( |
| 366 attrs, | 368 attrs, |
| 367 false, | 369 false, |
| 368 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) { | 370 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) { |
| 369 LOG(ERROR) << "Failed to create 3D context for compositor."; | 371 LOG(ERROR) << "Failed to create 3D context for compositor."; |
| 370 return scoped_ptr<cc::OutputSurface>(); | 372 return scoped_ptr<cc::OutputSurface>(); |
| 371 } | 373 } |
| 372 return make_scoped_ptr(new cc::OutputSurface( | 374 return make_scoped_ptr(new cc::OutputSurface( |
|
no sievers
2013/06/13 01:17:47
...while this is created for Chrome, ContentShell
brianderson
2013/06/14 20:12:02
Ok, will change this.
| |
| 373 context.PassAs<WebKit::WebGraphicsContext3D>())); | 375 context.PassAs<WebKit::WebGraphicsContext3D>())); |
| 374 } | 376 } |
| 375 } | 377 } |
| 376 | 378 |
| 377 void CompositorImpl::DidCompleteSwapBuffers() { | 379 void CompositorImpl::DidCompleteSwapBuffers() { |
| 378 client_->OnSwapBuffersCompleted(); | 380 client_->OnSwapBuffersCompleted(); |
| 379 } | 381 } |
| 380 | 382 |
| 381 void CompositorImpl::ScheduleComposite() { | 383 void CompositorImpl::ScheduleComposite() { |
| 382 client_->ScheduleComposite(); | 384 client_->ScheduleComposite(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 460 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 462 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
| 461 return GL_UNSIGNED_BYTE; | 463 return GL_UNSIGNED_BYTE; |
| 462 break; | 464 break; |
| 463 case ANDROID_BITMAP_FORMAT_RGB_565: | 465 case ANDROID_BITMAP_FORMAT_RGB_565: |
| 464 default: | 466 default: |
| 465 return GL_UNSIGNED_SHORT_5_6_5; | 467 return GL_UNSIGNED_SHORT_5_6_5; |
| 466 } | 468 } |
| 467 } | 469 } |
| 468 | 470 |
| 469 } // namespace content | 471 } // namespace content |
| OLD | NEW |