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

Side by Side Diff: chrome/browser/android/compositor/scene_layer/static_tab_scene_layer.cc

Issue 2810813004: Hide fullscreen rotation jank (Closed)
Patch Set: Make OnFullscreenStateChanged a function at the RWVHB level. cr feedback Created 3 years, 6 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 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 25 matching lines...) Expand all
36 return background_color_; 36 return background_color_;
37 } 37 }
38 38
39 void StaticTabSceneLayer::UpdateTabLayer( 39 void StaticTabSceneLayer::UpdateTabLayer(
40 JNIEnv* env, 40 JNIEnv* env,
41 const JavaParamRef<jobject>& jobj, 41 const JavaParamRef<jobject>& jobj,
42 const JavaParamRef<jobject>& jtab_content_manager, 42 const JavaParamRef<jobject>& jtab_content_manager,
43 jint id, 43 jint id,
44 jint toolbar_resource_id, 44 jint toolbar_resource_id,
45 jboolean can_use_live_layer, 45 jboolean can_use_live_layer,
46 jboolean can_use_static_layer,
46 jint default_background_color, 47 jint default_background_color,
47 jfloat x, 48 jfloat x,
48 jfloat y, 49 jfloat y,
49 jfloat static_to_view_blend, 50 jfloat static_to_view_blend,
50 jfloat saturation, 51 jfloat saturation,
51 jfloat brightness) { 52 jfloat brightness) {
52 background_color_ = default_background_color; 53 background_color_ = default_background_color;
53 if (!content_layer_.get()) { 54 if (!content_layer_.get()) {
54 android::TabContentManager* tab_content_manager = 55 android::TabContentManager* tab_content_manager =
55 android::TabContentManager::FromJavaObject(jtab_content_manager); 56 android::TabContentManager::FromJavaObject(jtab_content_manager);
56 content_layer_ = android::ContentLayer::Create(tab_content_manager); 57 content_layer_ = android::ContentLayer::Create(tab_content_manager);
57 layer_->AddChild(content_layer_->layer()); 58 layer_->AddChild(content_layer_->layer());
58 } 59 }
59 60
60 // Only override the alpha of content layers when the static tab is first 61 // Only override the alpha of content layers when the static tab is first
61 // assigned to the layer tree. 62 // assigned to the layer tree.
62 float content_alpha_override = 1.f; 63 float content_alpha_override = 1.f;
63 bool should_override_content_alpha = last_set_tab_id_ != id; 64 bool should_override_content_alpha = last_set_tab_id_ != id;
64 last_set_tab_id_ = id; 65 last_set_tab_id_ = id;
65 66
66 content_layer_->SetProperties( 67 content_layer_->SetProperties(
67 id, can_use_live_layer, static_to_view_blend, 68 id, can_use_live_layer, can_use_static_layer, static_to_view_blend,
68 should_override_content_alpha, content_alpha_override, saturation, 69 should_override_content_alpha, content_alpha_override, saturation, false,
69 false, gfx::Rect()); 70 gfx::Rect());
70 71
71 content_layer_->layer()->SetPosition(gfx::PointF(x, y)); 72 content_layer_->layer()->SetPosition(gfx::PointF(x, y));
72 content_layer_->layer()->SetIsDrawable(true); 73 content_layer_->layer()->SetIsDrawable(true);
73 74
74 // Only applies the brightness filter if the value has changed and is less 75 // Only applies the brightness filter if the value has changed and is less
75 // than 1. 76 // than 1.
76 if (brightness != brightness_) { 77 if (brightness != brightness_) {
77 brightness_ = brightness; 78 brightness_ = brightness;
78 cc::FilterOperations filters; 79 cc::FilterOperations filters;
79 if (brightness_ < 1.f) 80 if (brightness_ < 1.f)
80 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_)); 81 filters.Append(cc::FilterOperation::CreateBrightnessFilter(brightness_));
81 layer_->SetFilters(filters); 82 layer_->SetFilters(filters);
82 } 83 }
83 } 84 }
84 85
85 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) { 86 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jobj) {
86 // This will automatically bind to the Java object and pass ownership there. 87 // This will automatically bind to the Java object and pass ownership there.
87 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj); 88 StaticTabSceneLayer* scene_layer = new StaticTabSceneLayer(env, jobj);
88 return reinterpret_cast<intptr_t>(scene_layer); 89 return reinterpret_cast<intptr_t>(scene_layer);
89 } 90 }
90 91
91 bool RegisterStaticTabSceneLayer(JNIEnv* env) { 92 bool RegisterStaticTabSceneLayer(JNIEnv* env) {
92 return RegisterNativesImpl(env); 93 return RegisterNativesImpl(env);
93 } 94 }
94 95
95 } // namespace android 96 } // namespace android
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698