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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 content_layer_ = android::ContentLayer::Create(tab_content_manager); | 56 content_layer_ = android::ContentLayer::Create(tab_content_manager); |
57 layer_->AddChild(content_layer_->layer()); | 57 layer_->AddChild(content_layer_->layer()); |
58 } | 58 } |
59 | 59 |
60 // Only override the alpha of content layers when the static tab is first | 60 // Only override the alpha of content layers when the static tab is first |
61 // assigned to the layer tree. | 61 // assigned to the layer tree. |
62 float content_alpha_override = 1.f; | 62 float content_alpha_override = 1.f; |
63 bool should_override_content_alpha = last_set_tab_id_ != id; | 63 bool should_override_content_alpha = last_set_tab_id_ != id; |
64 last_set_tab_id_ = id; | 64 last_set_tab_id_ = id; |
65 | 65 |
66 content_layer_->SetProperties( | 66 content_layer_->SetProperties(id, can_use_live_layer, static_to_view_blend, |
67 id, can_use_live_layer, static_to_view_blend, | 67 should_override_content_alpha, |
68 should_override_content_alpha, content_alpha_override, saturation, | 68 content_alpha_override, saturation, false, |
69 false, gfx::Rect()); | 69 gfx::Rect()); |
70 | 70 |
71 content_layer_->layer()->SetPosition(gfx::PointF(x, y)); | 71 content_layer_->layer()->SetPosition(gfx::PointF(x, y)); |
72 content_layer_->layer()->SetIsDrawable(true); | 72 content_layer_->layer()->SetIsDrawable(true); |
73 | 73 |
74 // Only applies the brightness filter if the value has changed and is less | 74 // Only applies the brightness filter if the value has changed and is less |
75 // than 1. | 75 // than 1. |
76 if (brightness != brightness_) { | 76 if (brightness != brightness_) { |
77 brightness_ = brightness; | 77 brightness_ = brightness; |
78 cc::FilterOperations filters; | 78 cc::FilterOperations filters; |
79 if (brightness_ < 1.f) | 79 if (brightness_ < 1.f) |
80 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_)); | 80 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_)); |
81 layer_->SetFilters(filters); | 81 layer_->SetFilters(filters); |
82 } | 82 } |
83 } | 83 } |
84 | 84 |
85 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { | 85 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { |
86 // This will automatically bind to the Java object and pass ownership there. | 86 // This will automatically bind to the Java object and pass ownership there. |
87 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); | 87 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); |
88 return reinterpret_cast<intptr_t>(scene_layer); | 88 return reinterpret_cast<intptr_t>(scene_layer); |
89 } | 89 } |
90 | 90 |
91 bool RegisterStaticTabSceneLayer(JNIEnv* env) { | 91 bool RegisterStaticTabSceneLayer(JNIEnv* env) { |
92 return RegisterNativesImpl(env); | 92 return RegisterNativesImpl(env); |
93 } | 93 } |
94 | 94 |
95 } // namespace android | 95 } // namespace android |
OLD | NEW |