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