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

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

Issue 2441853002: Plumb preferred raster bounds rather than scale (Closed)
Patch Set: none Created 4 years, 2 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 | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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/layer.h" 5 #include "cc/layers/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 scroll_clip_layer_id(INVALID_ID), 60 scroll_clip_layer_id(INVALID_ID),
61 user_scrollable_horizontal(true), 61 user_scrollable_horizontal(true),
62 user_scrollable_vertical(true), 62 user_scrollable_vertical(true),
63 main_thread_scrolling_reasons( 63 main_thread_scrolling_reasons(
64 MainThreadScrollingReason::kNotScrollingOnMain), 64 MainThreadScrollingReason::kNotScrollingOnMain),
65 is_container_for_fixed_position_layers(false), 65 is_container_for_fixed_position_layers(false),
66 mutable_properties(MutableProperty::kNone), 66 mutable_properties(MutableProperty::kNone),
67 scroll_parent(nullptr), 67 scroll_parent(nullptr),
68 clip_parent(nullptr), 68 clip_parent(nullptr),
69 has_will_change_transform_hint(false), 69 has_will_change_transform_hint(false),
70 has_preferred_raster_scale(false), 70 has_preferred_raster_bounds(false),
71 hide_layer_and_subtree(false), 71 hide_layer_and_subtree(false),
72 client(nullptr), 72 client(nullptr) {}
73 preferred_raster_scale(1.0) {}
74 73
75 Layer::Inputs::~Inputs() {} 74 Layer::Inputs::~Inputs() {}
76 75
77 scoped_refptr<Layer> Layer::Create() { 76 scoped_refptr<Layer> Layer::Create() {
78 return make_scoped_refptr(new Layer()); 77 return make_scoped_refptr(new Layer());
79 } 78 }
80 79
81 Layer::Layer() 80 Layer::Layer()
82 : ignore_set_needs_commit_(false), 81 : ignore_set_needs_commit_(false),
83 parent_(nullptr), 82 parent_(nullptr),
(...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id()); 1176 ->scroll_tree.SetScrollOffsetClobberActiveValue(layer->id());
1178 1177
1179 // If the main thread commits multiple times before the impl thread actually 1178 // If the main thread commits multiple times before the impl thread actually
1180 // draws, then damage tracking will become incorrect if we simply clobber the 1179 // draws, then damage tracking will become incorrect if we simply clobber the
1181 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e. 1180 // update_rect here. The LayerImpl's update_rect needs to accumulate (i.e.
1182 // union) any update changes that have occurred on the main thread. 1181 // union) any update changes that have occurred on the main thread.
1183 inputs_.update_rect.Union(layer->update_rect()); 1182 inputs_.update_rect.Union(layer->update_rect());
1184 layer->SetUpdateRect(inputs_.update_rect); 1183 layer->SetUpdateRect(inputs_.update_rect);
1185 1184
1186 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint()); 1185 layer->SetHasWillChangeTransformHint(has_will_change_transform_hint());
1187 if (has_preferred_raster_scale()) 1186 if (has_preferred_raster_bounds())
1188 layer->SetPreferredRasterScale(preferred_raster_scale()); 1187 layer->SetPreferredRasterBounds(preferred_raster_bounds());
1189 else 1188 else
1190 layer->ClearPreferredRasterScale(); 1189 layer->ClearPreferredRasterBounds();
1191 layer->SetNeedsPushProperties(); 1190 layer->SetNeedsPushProperties();
1192 1191
1193 // Reset any state that should be cleared for the next update. 1192 // Reset any state that should be cleared for the next update.
1194 subtree_property_changed_ = false; 1193 subtree_property_changed_ = false;
1195 inputs_.update_rect = gfx::Rect(); 1194 inputs_.update_rect = gfx::Rect();
1196 1195
1197 layer_tree_->RemoveLayerShouldPushProperties(this); 1196 layer_tree_->RemoveLayerShouldPushProperties(this);
1198 } 1197 }
1199 1198
1200 void Layer::TakeCopyRequests( 1199 void Layer::TakeCopyRequests(
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
1759 : false; 1758 : false;
1760 } 1759 }
1761 1760
1762 void Layer::SetHasWillChangeTransformHint(bool has_will_change) { 1761 void Layer::SetHasWillChangeTransformHint(bool has_will_change) {
1763 if (inputs_.has_will_change_transform_hint == has_will_change) 1762 if (inputs_.has_will_change_transform_hint == has_will_change)
1764 return; 1763 return;
1765 inputs_.has_will_change_transform_hint = has_will_change; 1764 inputs_.has_will_change_transform_hint = has_will_change;
1766 SetNeedsCommit(); 1765 SetNeedsCommit();
1767 } 1766 }
1768 1767
1769 void Layer::SetPreferredRasterScale(float preferred_raster_scale) { 1768 void Layer::SetPreferredRasterBounds(const gfx::Size& preferred_raster_bounds) {
1770 if (inputs_.has_preferred_raster_scale && 1769 if (inputs_.has_preferred_raster_bounds &&
1771 inputs_.preferred_raster_scale == preferred_raster_scale) 1770 inputs_.preferred_raster_bounds == preferred_raster_bounds)
1772 return; 1771 return;
1773 1772
1774 inputs_.has_preferred_raster_scale = true; 1773 inputs_.has_preferred_raster_bounds = true;
1775 inputs_.preferred_raster_scale = preferred_raster_scale; 1774 inputs_.preferred_raster_bounds = preferred_raster_bounds;
1776 SetNeedsCommit(); 1775 SetNeedsCommit();
1777 } 1776 }
1778 1777
1779 void Layer::ClearPreferredRasterScale() { 1778 void Layer::ClearPreferredRasterBounds() {
1780 if (!inputs_.has_preferred_raster_scale) 1779 if (!inputs_.has_preferred_raster_bounds)
1781 return; 1780 return;
1782 inputs_.has_preferred_raster_scale = false; 1781 inputs_.has_preferred_raster_bounds = false;
1783 inputs_.preferred_raster_scale = 1.0f; 1782 inputs_.preferred_raster_bounds = gfx::Size();
1784 SetNeedsCommit(); 1783 SetNeedsCommit();
1785 } 1784 }
1786 1785
1787 AnimationHost* Layer::GetAnimationHost() const { 1786 AnimationHost* Layer::GetAnimationHost() const {
1788 return layer_tree_ ? layer_tree_->animation_host() : nullptr; 1787 return layer_tree_ ? layer_tree_->animation_host() : nullptr;
1789 } 1788 }
1790 1789
1791 ElementListType Layer::GetElementTypeForAnimation() const { 1790 ElementListType Layer::GetElementTypeForAnimation() const {
1792 return ElementListType::ACTIVE; 1791 return ElementListType::ACTIVE;
1793 } 1792 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1886 1885
1887 LayerTree* Layer::GetLayerTree() const { 1886 LayerTree* Layer::GetLayerTree() const {
1888 return layer_tree_; 1887 return layer_tree_;
1889 } 1888 }
1890 1889
1891 void Layer::SetLayerIdForTesting(int id) { 1890 void Layer::SetLayerIdForTesting(int id) {
1892 inputs_.layer_id = id; 1891 inputs_.layer_id = id;
1893 } 1892 }
1894 1893
1895 } // namespace cc 1894 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698