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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (has_transparent_background) { | 124 if (has_transparent_background) { |
125 attributes.alpha_size = 8; | 125 attributes.alpha_size = 8; |
126 } else if (base::SysInfo::IsLowEndDevice()) { | 126 } else if (base::SysInfo::IsLowEndDevice()) { |
127 // In this case we prefer to use RGB565 format instead of RGBA8888 if | 127 // In this case we prefer to use RGB565 format instead of RGBA8888 if |
128 // possible. | 128 // possible. |
129 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | 129 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in |
130 // order to enable 565, but it should avoid using 565 when -1s are | 130 // order to enable 565, but it should avoid using 565 when -1s are |
131 // specified | 131 // specified |
132 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be | 132 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be |
133 // -1. | 133 // -1. |
| 134 // TODO(liberato): This condition is memorized in ComositorView.java, to |
| 135 // avoid using two surfaces temporarily during alpha <-> no alpha |
| 136 // transitions. If these mismatch, then we risk a power regression if the |
| 137 // SurfaceView is not marked as eOpaque (FORMAT_OPAQUE), and we have an |
| 138 // EGL surface with an alpha channel. SurfaceFlinger needs at least one of |
| 139 // those hints to optimize out alpha blending. |
134 attributes.alpha_size = 0; | 140 attributes.alpha_size = 0; |
135 attributes.red_size = 5; | 141 attributes.red_size = 5; |
136 attributes.green_size = 6; | 142 attributes.green_size = 6; |
137 attributes.blue_size = 5; | 143 attributes.blue_size = 5; |
138 } | 144 } |
139 | 145 |
140 return attributes; | 146 return attributes; |
141 } | 147 } |
142 | 148 |
143 class ExternalBeginFrameSource : public cc::BeginFrameSource, | 149 class ExternalBeginFrameSource : public cc::BeginFrameSource, |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 | 840 |
835 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { | 841 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { |
836 return frame_sink_id_; | 842 return frame_sink_id_; |
837 } | 843 } |
838 | 844 |
839 bool CompositorImpl::HavePendingReadbacks() { | 845 bool CompositorImpl::HavePendingReadbacks() { |
840 return !readback_layer_tree_->children().empty(); | 846 return !readback_layer_tree_->children().empty(); |
841 } | 847 } |
842 | 848 |
843 } // namespace content | 849 } // namespace content |
OLD | NEW |