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

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

Issue 2158853004: Do not include toolbar shadow for UIResourceLayer snapshot (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update comment Created 4 years, 5 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
« no previous file with comments | « chrome/browser/android/compositor/scene_layer/toolbar_scene_layer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/toolbar_scene_layer.h" 5 #include "chrome/browser/android/compositor/scene_layer/toolbar_scene_layer.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "cc/layers/solid_color_layer.h" 9 #include "cc/layers/solid_color_layer.h"
10 #include "chrome/browser/android/compositor/layer/toolbar_layer.h" 10 #include "chrome/browser/android/compositor/layer/toolbar_layer.h"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 ToolbarSceneLayer::~ToolbarSceneLayer() { 29 ToolbarSceneLayer::~ToolbarSceneLayer() {
30 } 30 }
31 31
32 void ToolbarSceneLayer::UpdateToolbarLayer( 32 void ToolbarSceneLayer::UpdateToolbarLayer(
33 JNIEnv* env, 33 JNIEnv* env,
34 const JavaParamRef<jobject>& object, 34 const JavaParamRef<jobject>& object,
35 const JavaParamRef<jobject>& jresource_manager, 35 const JavaParamRef<jobject>& jresource_manager,
36 jint toolbar_resource_id, 36 jint toolbar_resource_id,
37 jint toolbar_shadow_resource_id,
37 jint toolbar_background_color, 38 jint toolbar_background_color,
38 jint url_bar_resource_id, 39 jint url_bar_resource_id,
39 jfloat url_bar_alpha, 40 jfloat url_bar_alpha,
40 jfloat top_offset, 41 jfloat top_offset,
41 bool visible, 42 bool visible,
42 bool show_shadow) { 43 bool show_shadow) {
43 // If the toolbar layer has not been created yet, create it. 44 // If the toolbar layer has not been created yet, create it.
44 if (!toolbar_layer_) { 45 if (!toolbar_layer_) {
45 ui::ResourceManager* resource_manager = 46 ui::ResourceManager* resource_manager =
46 ui::ResourceManagerImpl::FromJavaObject(jresource_manager); 47 ui::ResourceManagerImpl::FromJavaObject(jresource_manager);
47 toolbar_layer_ = ToolbarLayer::Create(resource_manager); 48 toolbar_layer_ = ToolbarLayer::Create(resource_manager);
48 toolbar_layer_->layer()->SetHideLayerAndSubtree(true); 49 toolbar_layer_->layer()->SetHideLayerAndSubtree(true);
49 layer_->AddChild(toolbar_layer_->layer()); 50 layer_->AddChild(toolbar_layer_->layer());
50 } 51 }
51 52
52 toolbar_layer_->layer()->SetHideLayerAndSubtree(!visible); 53 toolbar_layer_->layer()->SetHideLayerAndSubtree(!visible);
53 if (visible) { 54 if (visible) {
54 toolbar_layer_->layer()->SetPosition(gfx::PointF(0, top_offset)); 55 toolbar_layer_->layer()->SetPosition(gfx::PointF(0, top_offset));
55 // If we're at rest, hide the shadow. The Android view should be drawing. 56 toolbar_layer_->PushResource(toolbar_resource_id,
56 bool clip_shadow = top_offset >= 0.f && !show_shadow; 57 toolbar_shadow_resource_id,
57 toolbar_layer_->PushResource(toolbar_resource_id, toolbar_background_color, 58 toolbar_background_color,
58 false, SK_ColorWHITE, url_bar_resource_id, 59 false, SK_ColorWHITE, url_bar_resource_id,
59 url_bar_alpha, false, clip_shadow); 60 url_bar_alpha, false, show_shadow);
60 } 61 }
61 } 62 }
62 63
63 void ToolbarSceneLayer::UpdateProgressBar(JNIEnv* env, 64 void ToolbarSceneLayer::UpdateProgressBar(JNIEnv* env,
64 const JavaParamRef<jobject>& object, 65 const JavaParamRef<jobject>& object,
65 jint progress_bar_x, 66 jint progress_bar_x,
66 jint progress_bar_y, 67 jint progress_bar_y,
67 jint progress_bar_width, 68 jint progress_bar_width,
68 jint progress_bar_height, 69 jint progress_bar_height,
69 jint progress_bar_color, 70 jint progress_bar_color,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 new ToolbarSceneLayer(env, jobj); 120 new ToolbarSceneLayer(env, jobj);
120 return reinterpret_cast<intptr_t>(toolbar_scene_layer); 121 return reinterpret_cast<intptr_t>(toolbar_scene_layer);
121 } 122 }
122 123
123 bool RegisterToolbarSceneLayer(JNIEnv* env) { 124 bool RegisterToolbarSceneLayer(JNIEnv* env) {
124 return RegisterNativesImpl(env); 125 return RegisterNativesImpl(env);
125 } 126 }
126 127
127 } // namespace android 128 } // namespace android
128 } // namespace chrome 129 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/android/compositor/scene_layer/toolbar_scene_layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698