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

Side by Side Diff: cc/layers/ui_resource_layer.cc

Issue 82553015: Switch the android overscroll glow to use UIResources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor naming changes Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/layers/ui_resource_layer.h" 5 #include "cc/layers/ui_resource_layer.h"
6 6
7 #include "cc/layers/ui_resource_layer_impl.h" 7 #include "cc/layers/ui_resource_layer_impl.h"
8 #include "cc/resources/prioritized_resource.h" 8 #include "cc/resources/prioritized_resource.h"
9 #include "cc/resources/resource_update.h" 9 #include "cc/resources/resource_update.h"
10 #include "cc/resources/resource_update_queue.h" 10 #include "cc/resources/resource_update_queue.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 } // anonymous namespace 50 } // anonymous namespace
51 51
52 UIResourceLayer::UIResourceHolder::~UIResourceHolder() {} 52 UIResourceLayer::UIResourceHolder::~UIResourceHolder() {}
53 53
54 scoped_refptr<UIResourceLayer> UIResourceLayer::Create() { 54 scoped_refptr<UIResourceLayer> UIResourceLayer::Create() {
55 return make_scoped_refptr(new UIResourceLayer()); 55 return make_scoped_refptr(new UIResourceLayer());
56 } 56 }
57 57
58 UIResourceLayer::UIResourceLayer() 58 UIResourceLayer::UIResourceLayer()
59 : Layer(), 59 : ContentsScalingLayer(),
60 uv_top_left_(0.f, 0.f), 60 uv_top_left_(0.f, 0.f),
61 uv_bottom_right_(1.f, 1.f) { 61 uv_bottom_right_(1.f, 1.f) {
62 vertex_opacity_[0] = 1.0f; 62 vertex_opacity_[0] = 1.0f;
63 vertex_opacity_[1] = 1.0f; 63 vertex_opacity_[1] = 1.0f;
64 vertex_opacity_[2] = 1.0f; 64 vertex_opacity_[2] = 1.0f;
65 vertex_opacity_[3] = 1.0f; 65 vertex_opacity_[3] = 1.0f;
66 } 66 }
67 67
68 UIResourceLayer::~UIResourceLayer() {} 68 UIResourceLayer::~UIResourceLayer() {}
69 69
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 gfx::Size image_size = 156 gfx::Size image_size =
157 layer_tree_host()->GetUIResourceSize(ui_resource_holder_->id()); 157 layer_tree_host()->GetUIResourceSize(ui_resource_holder_->id());
158 layer_impl->SetUIResourceId(ui_resource_holder_->id()); 158 layer_impl->SetUIResourceId(ui_resource_holder_->id());
159 layer_impl->SetImageBounds(image_size); 159 layer_impl->SetImageBounds(image_size);
160 layer_impl->SetUV(uv_top_left_, uv_bottom_right_); 160 layer_impl->SetUV(uv_top_left_, uv_bottom_right_);
161 layer_impl->SetVertexOpacity(vertex_opacity_); 161 layer_impl->SetVertexOpacity(vertex_opacity_);
162 } 162 }
163 } 163 }
164 164
165 void UIResourceLayer::CalculateContentsScale(float ideal_contents_scale,
166 float device_scale_factor,
167 float page_scale_factor,
168 bool animating_transform_to_screen,
169 float* contents_scale_x,
170 float* contents_scale_y,
171 gfx::Size* content_bounds) {
172 if (!layer_tree_host() || !ui_resource_holder_ || !ui_resource_holder_->id())
173 return;
174 *contents_scale_x = 1.f;
175 *contents_scale_y = 1.f;
176 gfx::Size image_size =
177 layer_tree_host()->GetUIResourceSize(ui_resource_holder_->id());
178 *content_bounds = image_size;
179 }
180
165 } // namespace cc 181 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698