Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1595)

Side by Side Diff: content/browser/renderer_host/compositor_impl_android.cc

Issue 2201483002: Improve transition between opaque and translucent compositor views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unit tests Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 739
734 cc::FrameSinkId CompositorImpl::GetFrameSinkId() { 740 cc::FrameSinkId CompositorImpl::GetFrameSinkId() {
735 return frame_sink_id_; 741 return frame_sink_id_;
736 } 742 }
737 743
738 bool CompositorImpl::HavePendingReadbacks() { 744 bool CompositorImpl::HavePendingReadbacks() {
739 return !readback_layer_tree_->children().empty(); 745 return !readback_layer_tree_->children().empty();
740 } 746 }
741 747
742 } // namespace content 748 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698