OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/compositor/compositor_view.h" | 5 #include "chrome/browser/android/compositor/compositor_view.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 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 gfx::Size size(width, height); | 178 gfx::Size size(width, height); |
179 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); | 179 web_contents->GetNativeView()->OnPhysicalBackingSizeChanged(size); |
180 } | 180 } |
181 | 181 |
182 void CompositorView::SetLayoutBounds(JNIEnv* env, | 182 void CompositorView::SetLayoutBounds(JNIEnv* env, |
183 const JavaParamRef<jobject>& object) { | 183 const JavaParamRef<jobject>& object) { |
184 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); | 184 root_layer_->SetBounds(gfx::Size(content_width_, content_height_)); |
185 } | 185 } |
186 | 186 |
187 void CompositorView::SetBackground(bool visible, SkColor color) { | 187 void CompositorView::SetBackground(bool visible, SkColor color) { |
188 if (overlay_video_mode_) | |
189 visible = false; | |
190 root_layer_->SetBackgroundColor(color); | 188 root_layer_->SetBackgroundColor(color); |
191 root_layer_->SetIsDrawable(visible); | 189 root_layer_->SetIsDrawable(visible); |
| 190 compositor_->SetHasTransparentBackground(SkColorGetA(color) == |
| 191 SK_AlphaTRANSPARENT); |
192 } | 192 } |
193 | 193 |
194 void CompositorView::SetOverlayVideoMode(JNIEnv* env, | 194 void CompositorView::SetOverlayVideoMode(JNIEnv* env, |
195 const JavaParamRef<jobject>& object, | 195 const JavaParamRef<jobject>& object, |
196 bool enabled) { | 196 bool enabled) { |
197 if (overlay_video_mode_ == enabled) | 197 if (overlay_video_mode_ == enabled) |
198 return; | 198 return; |
199 overlay_video_mode_ = enabled; | 199 overlay_video_mode_ = enabled; |
200 compositor_->SetHasTransparentBackground(enabled); | |
201 SetNeedsComposite(env, object); | 200 SetNeedsComposite(env, object); |
202 } | 201 } |
203 | 202 |
204 void CompositorView::SetSceneLayer(JNIEnv* env, | 203 void CompositorView::SetSceneLayer(JNIEnv* env, |
205 const JavaParamRef<jobject>& object, | 204 const JavaParamRef<jobject>& object, |
206 const JavaParamRef<jobject>& jscene_layer) { | 205 const JavaParamRef<jobject>& jscene_layer) { |
207 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); | 206 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); |
208 | 207 |
209 if (scene_layer_ != scene_layer) { | 208 if (scene_layer_ != scene_layer) { |
210 // The old tree should be detached only if it is not the cached layer or | 209 // The old tree should be detached only if it is not the cached layer or |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go | 269 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go |
271 // through here but through BrowserChildProcessHostDisconnected() instead. | 270 // through here but through BrowserChildProcessHostDisconnected() instead. |
272 } | 271 } |
273 | 272 |
274 // Register native methods | 273 // Register native methods |
275 bool RegisterCompositorView(JNIEnv* env) { | 274 bool RegisterCompositorView(JNIEnv* env) { |
276 return RegisterNativesImpl(env); | 275 return RegisterNativesImpl(env); |
277 } | 276 } |
278 | 277 |
279 } // namespace android | 278 } // namespace android |
OLD | NEW |