Commit 4096750b authored by danakj's avatar danakj Committed by Commit Bot

cc: More documentation of the Layer API

And SetShouldFlattenTransformFromPropertyTree() becomes
SetShouldFlattenScreenSpaceTransformFromPropertyTree() as per the TODO
to rename it more appropritely.

R=enne@chromium.org

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I783e8474f39899de99ca6cf51e102f5ea604b836
Reviewed-on: https://chromium-review.googlesource.com/1101915Reviewed-by: default avatarweiliangc <weiliangc@chromium.org>
Reviewed-by: default avatarDavid Bokan <bokan@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568235}
parent b6df2ac8
...@@ -85,7 +85,7 @@ Layer::Layer() ...@@ -85,7 +85,7 @@ Layer::Layer()
clip_tree_index_(ClipTree::kInvalidNodeId), clip_tree_index_(ClipTree::kInvalidNodeId),
scroll_tree_index_(ScrollTree::kInvalidNodeId), scroll_tree_index_(ScrollTree::kInvalidNodeId),
property_tree_sequence_number_(-1), property_tree_sequence_number_(-1),
should_flatten_transform_from_property_tree_(false), should_flatten_screen_space_transform_from_property_tree_(false),
draws_content_(false), draws_content_(false),
should_check_backface_visibility_(false), should_check_backface_visibility_(false),
cache_render_surface_(false), cache_render_surface_(false),
...@@ -1195,8 +1195,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { ...@@ -1195,8 +1195,8 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
layer->SetTouchActionRegion(inputs_.touch_action_region); layer->SetTouchActionRegion(inputs_.touch_action_region);
layer->SetContentsOpaque(inputs_.contents_opaque); layer->SetContentsOpaque(inputs_.contents_opaque);
layer->SetPosition(inputs_.position); layer->SetPosition(inputs_.position);
layer->SetShouldFlattenTransformFromPropertyTree( layer->SetShouldFlattenScreenSpaceTransformFromPropertyTree(
should_flatten_transform_from_property_tree_); should_flatten_screen_space_transform_from_property_tree_);
layer->SetUseParentBackfaceVisibility(inputs_.use_parent_backface_visibility); layer->SetUseParentBackfaceVisibility(inputs_.use_parent_backface_visibility);
layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_); layer->SetShouldCheckBackfaceVisibility(should_check_backface_visibility_);
...@@ -1317,10 +1317,12 @@ void Layer::SetSubtreePropertyChanged() { ...@@ -1317,10 +1317,12 @@ void Layer::SetSubtreePropertyChanged() {
SetNeedsPushProperties(); SetNeedsPushProperties();
} }
void Layer::SetShouldFlattenTransformFromPropertyTree(bool should_flatten) { void Layer::SetShouldFlattenScreenSpaceTransformFromPropertyTree(
if (should_flatten_transform_from_property_tree_ == should_flatten) bool should_flatten) {
if (should_flatten_screen_space_transform_from_property_tree_ ==
should_flatten)
return; return;
should_flatten_transform_from_property_tree_ = should_flatten; should_flatten_screen_space_transform_from_property_tree_ = should_flatten;
SetNeedsPushProperties(); SetNeedsPushProperties();
} }
......
This diff is collapsed.
...@@ -52,7 +52,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) ...@@ -52,7 +52,7 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id)
main_thread_scrolling_reasons_( main_thread_scrolling_reasons_(
MainThreadScrollingReason::kNotScrollingOnMain), MainThreadScrollingReason::kNotScrollingOnMain),
scrollable_(false), scrollable_(false),
should_flatten_transform_from_property_tree_(false), should_flatten_screen_space_transform_from_property_tree_(false),
layer_property_changed_not_from_property_trees_(false), layer_property_changed_not_from_property_trees_(false),
layer_property_changed_from_property_trees_(false), layer_property_changed_from_property_trees_(false),
may_contain_video_(false), may_contain_video_(false),
...@@ -305,8 +305,8 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) { ...@@ -305,8 +305,8 @@ void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
layer->has_transform_node_ = has_transform_node_; layer->has_transform_node_ = has_transform_node_;
layer->offset_to_transform_parent_ = offset_to_transform_parent_; layer->offset_to_transform_parent_ = offset_to_transform_parent_;
layer->main_thread_scrolling_reasons_ = main_thread_scrolling_reasons_; layer->main_thread_scrolling_reasons_ = main_thread_scrolling_reasons_;
layer->should_flatten_transform_from_property_tree_ = layer->should_flatten_screen_space_transform_from_property_tree_ =
should_flatten_transform_from_property_tree_; should_flatten_screen_space_transform_from_property_tree_;
layer->masks_to_bounds_ = masks_to_bounds_; layer->masks_to_bounds_ = masks_to_bounds_;
layer->contents_opaque_ = contents_opaque_; layer->contents_opaque_ = contents_opaque_;
layer->may_contain_video_ = may_contain_video_; layer->may_contain_video_ = may_contain_video_;
......
...@@ -112,11 +112,12 @@ class CC_EXPORT LayerImpl { ...@@ -112,11 +112,12 @@ class CC_EXPORT LayerImpl {
return offset_to_transform_parent_; return offset_to_transform_parent_;
} }
void SetShouldFlattenTransformFromPropertyTree(bool should_flatten) { void SetShouldFlattenScreenSpaceTransformFromPropertyTree(
should_flatten_transform_from_property_tree_ = should_flatten; bool should_flatten) {
should_flatten_screen_space_transform_from_property_tree_ = should_flatten;
} }
bool should_flatten_transform_from_property_tree() const { bool should_flatten_screen_space_transform_from_property_tree() const {
return should_flatten_transform_from_property_tree_; return should_flatten_screen_space_transform_from_property_tree_;
} }
bool is_clipped() const { return draw_properties_.is_clipped; } bool is_clipped() const { return draw_properties_.is_clipped; }
...@@ -493,7 +494,7 @@ class CC_EXPORT LayerImpl { ...@@ -493,7 +494,7 @@ class CC_EXPORT LayerImpl {
// |scroll_container_bounds|). // |scroll_container_bounds|).
bool scrollable_ : 1; bool scrollable_ : 1;
bool should_flatten_transform_from_property_tree_ : 1; bool should_flatten_screen_space_transform_from_property_tree_ : 1;
// Tracks if drawing-related properties have changed since last redraw. // Tracks if drawing-related properties have changed since last redraw.
// TODO(wutao): We want to distinquish the sources of change so that we can // TODO(wutao): We want to distinquish the sources of change so that we can
......
...@@ -563,7 +563,7 @@ static gfx::Transform ScreenSpaceTransformInternal(LayerType* layer, ...@@ -563,7 +563,7 @@ static gfx::Transform ScreenSpaceTransformInternal(LayerType* layer,
layer->offset_to_transform_parent().y()); layer->offset_to_transform_parent().y());
gfx::Transform ssxform = tree.ToScreen(layer->transform_tree_index()); gfx::Transform ssxform = tree.ToScreen(layer->transform_tree_index());
xform.ConcatTransform(ssxform); xform.ConcatTransform(ssxform);
if (layer->should_flatten_transform_from_property_tree()) if (layer->should_flatten_screen_space_transform_from_property_tree())
xform.FlattenTo2d(); xform.FlattenTo2d();
return xform; return xform;
} }
...@@ -889,7 +889,7 @@ gfx::Transform DrawTransform(const LayerImpl* layer, ...@@ -889,7 +889,7 @@ gfx::Transform DrawTransform(const LayerImpl* layer,
transform_tree.property_trees()->GetToTarget( transform_tree.property_trees()->GetToTarget(
layer->transform_tree_index(), layer->render_target_effect_tree_index(), layer->transform_tree_index(), layer->render_target_effect_tree_index(),
&xform); &xform);
if (layer->should_flatten_transform_from_property_tree()) if (layer->should_flatten_screen_space_transform_from_property_tree())
xform.FlattenTo2d(); xform.FlattenTo2d();
xform.Translate(layer->offset_to_transform_parent().x(), xform.Translate(layer->offset_to_transform_parent().x(),
layer->offset_to_transform_parent().y()); layer->offset_to_transform_parent().y());
......
...@@ -482,7 +482,7 @@ bool PropertyTreeBuilderContext<LayerType>::AddTransformNodeIfNeeded( ...@@ -482,7 +482,7 @@ bool PropertyTreeBuilderContext<LayerType>::AddTransformNodeIfNeeded(
} }
layer->SetOffsetToTransformParent(source_offset + source_to_parent + layer->SetOffsetToTransformParent(source_offset + source_to_parent +
local_offset); local_offset);
layer->SetShouldFlattenTransformFromPropertyTree( layer->SetShouldFlattenScreenSpaceTransformFromPropertyTree(
data_from_ancestor.should_flatten); data_from_ancestor.should_flatten);
layer->SetTransformTreeIndex(parent_index); layer->SetTransformTreeIndex(parent_index);
return false; return false;
...@@ -617,7 +617,7 @@ bool PropertyTreeBuilderContext<LayerType>::AddTransformNodeIfNeeded( ...@@ -617,7 +617,7 @@ bool PropertyTreeBuilderContext<LayerType>::AddTransformNodeIfNeeded(
layer->SetOffsetToTransformParent(gfx::Vector2dF()); layer->SetOffsetToTransformParent(gfx::Vector2dF());
// Flattening (if needed) will be handled by |node|. // Flattening (if needed) will be handled by |node|.
layer->SetShouldFlattenTransformFromPropertyTree(false); layer->SetShouldFlattenScreenSpaceTransformFromPropertyTree(false);
return true; return true;
} }
...@@ -1145,7 +1145,8 @@ void PropertyTreeBuilderContext<LayerType>::AddScrollNodeIfNeeded( ...@@ -1145,7 +1145,8 @@ void PropertyTreeBuilderContext<LayerType>::AddScrollNodeIfNeeded(
node.bounds = layer->bounds(); node.bounds = layer->bounds();
node.container_bounds = layer->scroll_container_bounds(); node.container_bounds = layer->scroll_container_bounds();
node.offset_to_transform_parent = layer->offset_to_transform_parent(); node.offset_to_transform_parent = layer->offset_to_transform_parent();
node.should_flatten = layer->should_flatten_transform_from_property_tree(); node.should_flatten =
layer->should_flatten_screen_space_transform_from_property_tree();
node.user_scrollable_horizontal = UserScrollableHorizontal(layer); node.user_scrollable_horizontal = UserScrollableHorizontal(layer);
node.user_scrollable_vertical = UserScrollableVertical(layer); node.user_scrollable_vertical = UserScrollableVertical(layer);
node.element_id = layer->element_id(); node.element_id = layer->element_id();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment