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; | |
| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 358 url, | 360 url, |
| 359 factory, | 361 factory, |
| 360 weak_factory_.GetWeakPtr())); | 362 weak_factory_.GetWeakPtr())); |
| 361 if (!context->InitializeWithDefaultBufferSizes( | 363 if (!context->InitializeWithDefaultBufferSizes( |
| 362 attrs, | 364 attrs, |
| 363 false, | 365 false, |
| 364 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) { | 366 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)) { |
| 365 LOG(ERROR) << "Failed to create 3D context for compositor."; | 367 LOG(ERROR) << "Failed to create 3D context for compositor."; |
| 366 return scoped_ptr<cc::OutputSurface>(); | 368 return scoped_ptr<cc::OutputSurface>(); |
| 367 } | 369 } |
| 368 return make_scoped_ptr(new cc::OutputSurface( | 370 cc::OutputSurface* output_surface = new cc::OutputSurface( |
|
no sievers
2013/06/14 21:15:32
nit:
scoped_ptr<OutputSurface> output_surface(new
| |
| 369 context.PassAs<WebKit::WebGraphicsContext3D>())); | 371 context.PassAs<WebKit::WebGraphicsContext3D>()); |
| 372 output_surface->capabilities().has_parent_compositor = false; | |
| 373 return make_scoped_ptr(output_surface); | |
| 370 } | 374 } |
| 371 } | 375 } |
| 372 | 376 |
| 373 void CompositorImpl::DidCompleteSwapBuffers() { | 377 void CompositorImpl::DidCompleteSwapBuffers() { |
| 374 client_->OnSwapBuffersCompleted(); | 378 client_->OnSwapBuffersCompleted(); |
| 375 } | 379 } |
| 376 | 380 |
| 377 void CompositorImpl::ScheduleComposite() { | 381 void CompositorImpl::ScheduleComposite() { |
| 378 client_->ScheduleComposite(); | 382 client_->ScheduleComposite(); |
| 379 } | 383 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 456 case ANDROID_BITMAP_FORMAT_RGBA_8888: | 460 case ANDROID_BITMAP_FORMAT_RGBA_8888: |
| 457 return GL_UNSIGNED_BYTE; | 461 return GL_UNSIGNED_BYTE; |
| 458 break; | 462 break; |
| 459 case ANDROID_BITMAP_FORMAT_RGB_565: | 463 case ANDROID_BITMAP_FORMAT_RGB_565: |
| 460 default: | 464 default: |
| 461 return GL_UNSIGNED_SHORT_5_6_5; | 465 return GL_UNSIGNED_SHORT_5_6_5; |
| 462 } | 466 } |
| 463 } | 467 } |
| 464 | 468 |
| 465 } // namespace content | 469 } // namespace content |
| OLD | NEW |