Chromium Code Reviews| 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) == SK_AlphaTRANSPA RENT); | |
|
Khushal
2017/05/31 20:26:51
Can you also remove the hack in CompositorImpl?
steimel
2017/06/06 03:07:54
Done.
| |
| 192 } | 191 } |
| 193 | 192 |
| 194 void CompositorView::SetOverlayVideoMode(JNIEnv* env, | 193 void CompositorView::SetOverlayVideoMode(JNIEnv* env, |
| 195 const JavaParamRef<jobject>& object, | 194 const JavaParamRef<jobject>& object, |
| 196 bool enabled) { | 195 bool enabled) { |
| 197 if (overlay_video_mode_ == enabled) | 196 if (overlay_video_mode_ == enabled) |
| 198 return; | 197 return; |
| 199 overlay_video_mode_ = enabled; | 198 overlay_video_mode_ = enabled; |
| 200 compositor_->SetHasTransparentBackground(enabled); | |
| 201 SetNeedsComposite(env, object); | 199 SetNeedsComposite(env, object); |
| 202 } | 200 } |
| 203 | 201 |
| 204 void CompositorView::SetSceneLayer(JNIEnv* env, | 202 void CompositorView::SetSceneLayer(JNIEnv* env, |
| 205 const JavaParamRef<jobject>& object, | 203 const JavaParamRef<jobject>& object, |
| 206 const JavaParamRef<jobject>& jscene_layer) { | 204 const JavaParamRef<jobject>& jscene_layer) { |
| 207 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); | 205 SceneLayer* scene_layer = SceneLayer::FromJavaObject(env, jscene_layer); |
| 208 | 206 |
| 209 if (scene_layer_ != scene_layer) { | 207 if (scene_layer_ != scene_layer) { |
| 210 // The old tree should be detached only if it is not the cached layer or | 208 // 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 | 268 // The Android TERMINATION_STATUS_OOM_PROTECTED hack causes us to never go |
| 271 // through here but through BrowserChildProcessHostDisconnected() instead. | 269 // through here but through BrowserChildProcessHostDisconnected() instead. |
| 272 } | 270 } |
| 273 | 271 |
| 274 // Register native methods | 272 // Register native methods |
| 275 bool RegisterCompositorView(JNIEnv* env) { | 273 bool RegisterCompositorView(JNIEnv* env) { |
| 276 return RegisterNativesImpl(env); | 274 return RegisterNativesImpl(env); |
| 277 } | 275 } |
| 278 | 276 |
| 279 } // namespace android | 277 } // namespace android |
| OLD | NEW |