| 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. |
| 178 attributes.alpha_size = 0; | 184 attributes.alpha_size = 0; |
| 179 attributes.red_size = 5; | 185 attributes.red_size = 5; |
| 180 attributes.green_size = 6; | 186 attributes.green_size = 6; |
| 181 attributes.blue_size = 5; | 187 attributes.blue_size = 5; |
| 182 } | 188 } |
| 183 | 189 |
| 184 return attributes; | 190 return attributes; |
| 185 } | 191 } |
| 186 | 192 |
| 187 void CreateContextProviderAfterGpuChannelEstablished( | 193 void CreateContextProviderAfterGpuChannelEstablished( |
| (...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 } | 860 } |
| 855 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, | 861 GetSurfaceManager()->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| 856 frame_sink_id); | 862 frame_sink_id); |
| 857 } | 863 } |
| 858 | 864 |
| 859 bool CompositorImpl::HavePendingReadbacks() { | 865 bool CompositorImpl::HavePendingReadbacks() { |
| 860 return !readback_layer_tree_->children().empty(); | 866 return !readback_layer_tree_->children().empty(); |
| 861 } | 867 } |
| 862 | 868 |
| 863 } // namespace content | 869 } // namespace content |
| OLD | NEW |