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 <stdint.h> | 9 #include <stdint.h> |
| 10 #include <unordered_set> | 10 #include <unordered_set> |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 host_->SetViewportSize(size); | 580 host_->SetViewportSize(size); |
| 581 if (display_) | 581 if (display_) |
| 582 display_->Resize(size); | 582 display_->Resize(size); |
| 583 root_window_->GetLayer()->SetBounds(size); | 583 root_window_->GetLayer()->SetBounds(size); |
| 584 } | 584 } |
| 585 | 585 |
| 586 void CompositorImpl::SetHasTransparentBackground(bool transparent) { | 586 void CompositorImpl::SetHasTransparentBackground(bool transparent) { |
| 587 has_transparent_background_ = transparent; | 587 has_transparent_background_ = transparent; |
| 588 if (host_) { | 588 if (host_) { |
| 589 host_->set_has_transparent_background(transparent); | 589 host_->set_has_transparent_background(transparent); |
| 590 | 590 SetBackgroundColor(transparent ? SK_ColorBLACK : SK_ColorWHITE); |
|
Khushal
2017/06/07 05:36:01
Could you leave a TODO here to set the color based
steimel
2017/06/13 23:15:44
Done.
| |
| 591 // Give a delay in setting the background color to avoid the color for | |
| 592 // the normal mode (white) affecting the UI transition. | |
| 593 base::ThreadTaskRunnerHandle::Get().get()->PostDelayedTask( | |
| 594 FROM_HERE, | |
| 595 base::Bind(&CompositorImpl::SetBackgroundColor, | |
| 596 weak_factory_.GetWeakPtr(), | |
| 597 transparent ? SK_ColorBLACK : SK_ColorWHITE), | |
| 598 base::TimeDelta::FromMilliseconds(500)); | |
| 599 } | 591 } |
| 600 } | 592 } |
| 601 | 593 |
| 602 void CompositorImpl::SetBackgroundColor(int color) { | 594 void CompositorImpl::SetBackgroundColor(int color) { |
| 603 host_->set_background_color(color); | 595 host_->set_background_color(color); |
| 604 } | 596 } |
| 605 | 597 |
| 606 void CompositorImpl::SetNeedsComposite() { | 598 void CompositorImpl::SetNeedsComposite() { |
| 607 if (!host_->IsVisible()) | 599 if (!host_->IsVisible()) |
| 608 return; | 600 return; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 881 } | 873 } |
| 882 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, | 874 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| 883 frame_sink_id); | 875 frame_sink_id); |
| 884 } | 876 } |
| 885 | 877 |
| 886 bool CompositorImpl::HavePendingReadbacks() { | 878 bool CompositorImpl::HavePendingReadbacks() { |
| 887 return !readback_layer_tree_->children().empty(); | 879 return !readback_layer_tree_->children().empty(); |
| 888 } | 880 } |
| 889 | 881 |
| 890 } // namespace content | 882 } // namespace content |
| OLD | NEW |