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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 if (has_transparent_background) { | 168 if (has_transparent_background) { |
169 attributes.alpha_size = 8; | 169 attributes.alpha_size = 8; |
170 } else if (base::SysInfo::IsLowEndDevice()) { | 170 } else if (base::SysInfo::IsLowEndDevice()) { |
171 // In this case we prefer to use RGB565 format instead of RGBA8888 if | 171 // In this case we prefer to use RGB565 format instead of RGBA8888 if |
172 // possible. | 172 // possible. |
173 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in | 173 // TODO(danakj): GpuCommandBufferStub constructor checks for alpha == 0 in |
174 // order to enable 565, but it should avoid using 565 when -1s are | 174 // order to enable 565, but it should avoid using 565 when -1s are |
175 // specified | 175 // specified |
176 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be | 176 // (IOW check that a <= 0 && rgb > 0 && rgb <= 565) then alpha should be |
177 // -1. | 177 // -1. |
178 // TODO(liberato): This condition is memorized in ComositorView.java, to | |
179 // avoid using two surfaces temporarily during alpha <-> no alpha | |
180 // transitions. If these mismatch, then we risk a power regression if the | |
181 // SurfaceView is not marked as eOpaque (FORMAT_OPAQUE), and we have an | |
182 // EGL surface with an alpha channel. SurfaceFlinger needs at least one of | |
183 // those hints to optimize out alpha blending. | |
184 attributes.alpha_size = 0; | 178 attributes.alpha_size = 0; |
185 attributes.red_size = 5; | 179 attributes.red_size = 5; |
186 attributes.green_size = 6; | 180 attributes.green_size = 6; |
187 attributes.blue_size = 5; | 181 attributes.blue_size = 5; |
188 } | 182 } |
189 | 183 |
190 return attributes; | 184 return attributes; |
191 } | 185 } |
192 | 186 |
193 void CreateContextProviderAfterGpuChannelEstablished( | 187 void CreateContextProviderAfterGpuChannelEstablished( |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 } | 854 } |
861 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, | 855 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, |
862 frame_sink_id); | 856 frame_sink_id); |
863 } | 857 } |
864 | 858 |
865 bool CompositorImpl::HavePendingReadbacks() { | 859 bool CompositorImpl::HavePendingReadbacks() { |
866 return !readback_layer_tree_->children().empty(); | 860 return !readback_layer_tree_->children().empty(); |
867 } | 861 } |
868 | 862 |
869 } // namespace content | 863 } // namespace content |
OLD | NEW |