| 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/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 // static | 165 // static |
| 166 bool CompositorImpl::IsInitialized() { | 166 bool CompositorImpl::IsInitialized() { |
| 167 return g_initialized; | 167 return g_initialized; |
| 168 } | 168 } |
| 169 | 169 |
| 170 CompositorImpl::CompositorImpl(CompositorClient* client, | 170 CompositorImpl::CompositorImpl(CompositorClient* client, |
| 171 gfx::NativeWindow root_window) | 171 gfx::NativeWindow root_window) |
| 172 : root_layer_(cc::Layer::Create()), | 172 : root_layer_(cc::Layer::Create()), |
| 173 resource_manager_(&ui_resource_provider_), |
| 173 surface_id_allocator_( | 174 surface_id_allocator_( |
| 174 new cc::SurfaceIdAllocator(++g_surface_id_namespace)), | 175 new cc::SurfaceIdAllocator(++g_surface_id_namespace)), |
| 175 has_transparent_background_(false), | 176 has_transparent_background_(false), |
| 176 device_scale_factor_(1), | 177 device_scale_factor_(1), |
| 177 window_(NULL), | 178 window_(NULL), |
| 178 surface_id_(0), | 179 surface_id_(0), |
| 179 client_(client), | 180 client_(client), |
| 180 root_window_(root_window), | 181 root_window_(root_window), |
| 181 did_post_swapbuffers_(false), | 182 did_post_swapbuffers_(false), |
| 182 ignore_schedule_composite_(false), | 183 ignore_schedule_composite_(false), |
| 183 needs_composite_(false), | 184 needs_composite_(false), |
| 184 needs_animate_(false), | 185 needs_animate_(false), |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 pending_swapbuffers_++; | 323 pending_swapbuffers_++; |
| 323 | 324 |
| 324 // Need to track vsync to avoid compositing more than once per frame. | 325 // Need to track vsync to avoid compositing more than once per frame. |
| 325 root_window_->RequestVSyncUpdate(); | 326 root_window_->RequestVSyncUpdate(); |
| 326 } | 327 } |
| 327 | 328 |
| 328 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { | 329 UIResourceProvider& CompositorImpl::GetUIResourceProvider() { |
| 329 return ui_resource_provider_; | 330 return ui_resource_provider_; |
| 330 } | 331 } |
| 331 | 332 |
| 333 ui::ResourceManager& CompositorImpl::GetResourceManager() { |
| 334 return resource_manager_; |
| 335 } |
| 336 |
| 332 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { | 337 ui::SystemUIResourceManager& CompositorImpl::GetSystemUIResourceManager() { |
| 333 return ui_resource_provider_.GetSystemUIResourceManager(); | 338 return ui_resource_provider_.GetSystemUIResourceManager(); |
| 334 } | 339 } |
| 335 | 340 |
| 336 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { | 341 void CompositorImpl::SetRootLayer(scoped_refptr<cc::Layer> root_layer) { |
| 337 if (subroot_layer_.get()) { | 342 if (subroot_layer_.get()) { |
| 338 subroot_layer_->RemoveFromParent(); | 343 subroot_layer_->RemoveFromParent(); |
| 339 subroot_layer_ = NULL; | 344 subroot_layer_ = NULL; |
| 340 } | 345 } |
| 341 if (root_layer.get()) { | 346 if (root_layer.get()) { |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 } | 687 } |
| 683 | 688 |
| 684 void CompositorImpl::SetNeedsAnimate() { | 689 void CompositorImpl::SetNeedsAnimate() { |
| 685 if (!host_) | 690 if (!host_) |
| 686 return; | 691 return; |
| 687 | 692 |
| 688 host_->SetNeedsAnimate(); | 693 host_->SetNeedsAnimate(); |
| 689 } | 694 } |
| 690 | 695 |
| 691 } // namespace content | 696 } // namespace content |
| OLD | NEW |