| 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/scene_layer/static_tab_scene_layer.h
" | 5 #include "chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.h
" |
| 6 | 6 |
| 7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
| 8 #include "chrome/browser/android/compositor/layer/content_layer.h" | 8 #include "chrome/browser/android/compositor/layer/content_layer.h" |
| 9 #include "chrome/browser/android/compositor/layer_title_cache.h" | 9 #include "chrome/browser/android/compositor/layer_title_cache.h" |
| 10 #include "chrome/browser/android/compositor/tab_content_manager.h" | 10 #include "chrome/browser/android/compositor/tab_content_manager.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Only override the alpha of content layers when the static tab is first | 68 // Only override the alpha of content layers when the static tab is first |
| 69 // assigned to the layer tree. | 69 // assigned to the layer tree. |
| 70 float content_alpha_override = 1.f; | 70 float content_alpha_override = 1.f; |
| 71 bool should_override_content_alpha = last_set_tab_id_ != id; | 71 bool should_override_content_alpha = last_set_tab_id_ != id; |
| 72 last_set_tab_id_ = id; | 72 last_set_tab_id_ = id; |
| 73 | 73 |
| 74 // Set up the content layer and move it to the proper position. | 74 // Set up the content layer and move it to the proper position. |
| 75 content_layer_->layer()->SetBounds(gfx::Size(width, height)); | 75 content_layer_->layer()->SetBounds(gfx::Size(width, height)); |
| 76 content_layer_->layer()->SetPosition(gfx::Point(x, y)); | 76 content_layer_->layer()->SetPosition(gfx::PointF(x, y)); |
| 77 content_layer_->SetProperties( | 77 content_layer_->SetProperties( |
| 78 id, can_use_live_layer, can_use_ntp_fallback, static_to_view_blend, | 78 id, can_use_live_layer, can_use_ntp_fallback, static_to_view_blend, |
| 79 should_override_content_alpha, content_alpha_override, saturation, | 79 should_override_content_alpha, content_alpha_override, saturation, |
| 80 gfx::Rect(content_viewport_size), content_viewport_size); | 80 gfx::Rect(content_viewport_size), content_viewport_size); |
| 81 | 81 |
| 82 gfx::Size content_bounds(0, 0); | 82 gfx::Size content_bounds(0, 0); |
| 83 content_bounds = content_layer_->layer()->bounds(); | 83 content_bounds = content_layer_->layer()->bounds(); |
| 84 | 84 |
| 85 gfx::Size actual_content_size(content_layer_->GetContentSize()); | 85 gfx::Size actual_content_size(content_layer_->GetContentSize()); |
| 86 | 86 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 99 (content_has_consistent_width && content_layer_->ShowingLiveLayer())) { | 99 (content_has_consistent_width && content_layer_->ShowingLiveLayer())) { |
| 100 y += content_offset_y; | 100 y += content_offset_y; |
| 101 } else { | 101 } else { |
| 102 // If our orientations are off and we have a static texture, or if we have | 102 // If our orientations are off and we have a static texture, or if we have |
| 103 // a live layer of an unexpected width, move the texture in by the | 103 // a live layer of an unexpected width, move the texture in by the |
| 104 // appropriate amount. | 104 // appropriate amount. |
| 105 x += content_viewport_offset.x(); | 105 x += content_viewport_offset.x(); |
| 106 y += content_viewport_offset.y(); | 106 y += content_viewport_offset.y(); |
| 107 } | 107 } |
| 108 | 108 |
| 109 content_layer_->layer()->SetPosition(gfx::Point(x, y)); | 109 content_layer_->layer()->SetPosition(gfx::PointF(x, y)); |
| 110 content_layer_->layer()->SetIsDrawable(true); | 110 content_layer_->layer()->SetIsDrawable(true); |
| 111 | 111 |
| 112 layer_->AddChild(content_layer_->layer()); | 112 layer_->AddChild(content_layer_->layer()); |
| 113 | 113 |
| 114 // Only applies the brightness filter if the value has changed and is less | 114 // Only applies the brightness filter if the value has changed and is less |
| 115 // than 1. | 115 // than 1. |
| 116 if (brightness != brightness_) { | 116 if (brightness != brightness_) { |
| 117 brightness_ = brightness; | 117 brightness_ = brightness; |
| 118 cc::FilterOperations filters; | 118 cc::FilterOperations filters; |
| 119 if (brightness_ < 1.f) | 119 if (brightness_ < 1.f) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 141 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); | 141 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); |
| 142 return reinterpret_cast<intptr_t>(scene_layer); | 142 return reinterpret_cast<intptr_t>(scene_layer); |
| 143 } | 143 } |
| 144 | 144 |
| 145 bool RegisterStaticTabSceneLayer(JNIEnv* env) { | 145 bool RegisterStaticTabSceneLayer(JNIEnv* env) { |
| 146 return RegisterNativesImpl(env); | 146 return RegisterNativesImpl(env); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace android | 149 } // namespace android |
| 150 } // namespace chrome | 150 } // namespace chrome |
| OLD | NEW |