| 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 <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 cc::LayerTreeHost::InitParams params; | 496 cc::LayerTreeHost::InitParams params; |
| 497 params.client = this; | 497 params.client = this; |
| 498 params.shared_bitmap_manager = HostSharedBitmapManager::current(); | 498 params.shared_bitmap_manager = HostSharedBitmapManager::current(); |
| 499 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); | 499 params.gpu_memory_buffer_manager = BrowserGpuMemoryBufferManager::current(); |
| 500 params.task_graph_runner = g_task_graph_runner.Pointer(); | 500 params.task_graph_runner = g_task_graph_runner.Pointer(); |
| 501 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); | 501 params.main_task_runner = base::ThreadTaskRunnerHandle::Get(); |
| 502 params.settings = &settings; | 502 params.settings = &settings; |
| 503 params.animation_host = cc::AnimationHost::CreateMainInstance(); | 503 params.animation_host = cc::AnimationHost::CreateMainInstance(); |
| 504 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); | 504 host_ = cc::LayerTreeHost::CreateSingleThreaded(this, ¶ms); |
| 505 DCHECK(!host_->visible()); | 505 DCHECK(!host_->visible()); |
| 506 host_->GetLayerTree()->SetRootLayer(root_window_->GetLayer()); | 506 host_->SetRootLayer(root_window_->GetLayer()); |
| 507 host_->set_surface_client_id(surface_id_allocator_->client_id()); | 507 host_->set_surface_client_id(surface_id_allocator_->client_id()); |
| 508 host_->GetLayerTree()->SetViewportSize(size_); | 508 host_->SetViewportSize(size_); |
| 509 host_->GetLayerTree()->set_has_transparent_background( | 509 host_->set_has_transparent_background(has_transparent_background_); |
| 510 has_transparent_background_); | 510 host_->SetDeviceScaleFactor(device_scale_factor_); |
| 511 host_->GetLayerTree()->SetDeviceScaleFactor(device_scale_factor_); | |
| 512 | 511 |
| 513 if (needs_animate_) | 512 if (needs_animate_) |
| 514 host_->SetNeedsAnimate(); | 513 host_->SetNeedsAnimate(); |
| 515 } | 514 } |
| 516 | 515 |
| 517 void CompositorImpl::SetVisible(bool visible) { | 516 void CompositorImpl::SetVisible(bool visible) { |
| 518 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); | 517 TRACE_EVENT1("cc", "CompositorImpl::SetVisible", "visible", visible); |
| 519 if (!visible) { | 518 if (!visible) { |
| 520 DCHECK(host_->visible()); | 519 DCHECK(host_->visible()); |
| 521 | 520 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 533 } else { | 532 } else { |
| 534 host_->SetVisible(true); | 533 host_->SetVisible(true); |
| 535 if (output_surface_request_pending_) | 534 if (output_surface_request_pending_) |
| 536 HandlePendingOutputSurfaceRequest(); | 535 HandlePendingOutputSurfaceRequest(); |
| 537 } | 536 } |
| 538 } | 537 } |
| 539 | 538 |
| 540 void CompositorImpl::setDeviceScaleFactor(float factor) { | 539 void CompositorImpl::setDeviceScaleFactor(float factor) { |
| 541 device_scale_factor_ = factor; | 540 device_scale_factor_ = factor; |
| 542 if (host_) | 541 if (host_) |
| 543 host_->GetLayerTree()->SetDeviceScaleFactor(factor); | 542 host_->SetDeviceScaleFactor(factor); |
| 544 } | 543 } |
| 545 | 544 |
| 546 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { | 545 void CompositorImpl::SetWindowBounds(const gfx::Size& size) { |
| 547 if (size_ == size) | 546 if (size_ == size) |
| 548 return; | 547 return; |
| 549 | 548 |
| 550 size_ = size; | 549 size_ = size; |
| 551 if (host_) | 550 if (host_) |
| 552 host_->GetLayerTree()->SetViewportSize(size); | 551 host_->SetViewportSize(size); |
| 553 if (display_) | 552 if (display_) |
| 554 display_->Resize(size); | 553 display_->Resize(size); |
| 555 root_window_->GetLayer()->SetBounds(size); | 554 root_window_->GetLayer()->SetBounds(size); |
| 556 } | 555 } |
| 557 | 556 |
| 558 void CompositorImpl::SetHasTransparentBackground(bool flag) { | 557 void CompositorImpl::SetHasTransparentBackground(bool flag) { |
| 559 has_transparent_background_ = flag; | 558 has_transparent_background_ = flag; |
| 560 if (host_) | 559 if (host_) |
| 561 host_->GetLayerTree()->set_has_transparent_background(flag); | 560 host_->set_has_transparent_background(flag); |
| 562 } | 561 } |
| 563 | 562 |
| 564 void CompositorImpl::SetNeedsComposite() { | 563 void CompositorImpl::SetNeedsComposite() { |
| 565 if (!host_->visible()) | 564 if (!host_->visible()) |
| 566 return; | 565 return; |
| 567 TRACE_EVENT0("compositor", "Compositor::SetNeedsComposite"); | 566 TRACE_EVENT0("compositor", "Compositor::SetNeedsComposite"); |
| 568 host_->SetNeedsAnimate(); | 567 host_->SetNeedsAnimate(); |
| 569 } | 568 } |
| 570 | 569 |
| 571 void CompositorImpl::UpdateLayerTreeHost() { | 570 void CompositorImpl::UpdateLayerTreeHost() { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 793 |
| 795 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); | 794 TRACE_EVENT0("compositor", "Compositor::SetNeedsAnimate"); |
| 796 host_->SetNeedsAnimate(); | 795 host_->SetNeedsAnimate(); |
| 797 } | 796 } |
| 798 | 797 |
| 799 bool CompositorImpl::HavePendingReadbacks() { | 798 bool CompositorImpl::HavePendingReadbacks() { |
| 800 return !readback_layer_tree_->children().empty(); | 799 return !readback_layer_tree_->children().empty(); |
| 801 } | 800 } |
| 802 | 801 |
| 803 } // namespace content | 802 } // namespace content |
| OLD | NEW |