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

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

Issue 1908593002: cc : Stop pushing transform origin from Layer and LayerImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_impl.h ('k') | cc/layers/layer_impl_test_properties.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_impl.h" 5 #include "cc/layers/layer_impl.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id) 46 LayerImpl::LayerImpl(LayerTreeImpl* tree_impl, int id)
47 : parent_(nullptr), 47 : parent_(nullptr),
48 scroll_parent_(nullptr), 48 scroll_parent_(nullptr),
49 clip_parent_(nullptr), 49 clip_parent_(nullptr),
50 mask_layer_id_(-1), 50 mask_layer_id_(-1),
51 mask_layer_(nullptr), 51 mask_layer_(nullptr),
52 replica_layer_id_(-1), 52 replica_layer_id_(-1),
53 replica_layer_(nullptr), 53 replica_layer_(nullptr),
54 layer_id_(id), 54 layer_id_(id),
55 layer_tree_impl_(tree_impl), 55 layer_tree_impl_(tree_impl),
56 test_properties_(nullptr),
56 scroll_clip_layer_id_(Layer::INVALID_ID), 57 scroll_clip_layer_id_(Layer::INVALID_ID),
57 main_thread_scrolling_reasons_( 58 main_thread_scrolling_reasons_(
58 MainThreadScrollingReason::kNotScrollingOnMain), 59 MainThreadScrollingReason::kNotScrollingOnMain),
59 user_scrollable_horizontal_(true), 60 user_scrollable_horizontal_(true),
60 user_scrollable_vertical_(true), 61 user_scrollable_vertical_(true),
61 double_sided_(true), 62 double_sided_(true),
62 should_flatten_transform_(true), 63 should_flatten_transform_(true),
63 should_flatten_transform_from_property_tree_(false), 64 should_flatten_transform_from_property_tree_(false),
64 layer_property_changed_(false), 65 layer_property_changed_(false),
65 masks_to_bounds_(false), 66 masks_to_bounds_(false),
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) { 479 if (layer_tree_impl()->ScrollOffsetIsAnimatingOnImplOnly(this)) {
479 const bool needs_completion = true; 480 const bool needs_completion = true;
480 layer_tree_impl()->ScrollAnimationAbort(needs_completion); 481 layer_tree_impl()->ScrollAnimationAbort(needs_completion);
481 } 482 }
482 } 483 }
483 484
484 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons; 485 main_thread_scrolling_reasons_ = main_thread_scrolling_reasons;
485 } 486 }
486 487
487 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { 488 void LayerImpl::PushPropertiesTo(LayerImpl* layer) {
488 layer->SetTransformOrigin(transform_origin_);
489 layer->SetBackgroundColor(background_color_); 489 layer->SetBackgroundColor(background_color_);
490 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_); 490 layer->SetSafeOpaqueBackgroundColor(safe_opaque_background_color_);
491 layer->SetBounds(bounds_); 491 layer->SetBounds(bounds_);
492 layer->SetDoubleSided(double_sided_); 492 layer->SetDoubleSided(double_sided_);
493 layer->SetDrawsContent(DrawsContent()); 493 layer->SetDrawsContent(DrawsContent());
494 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); 494 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_);
495 // If whether layer has render surface changes, we need to update draw 495 // If whether layer has render surface changes, we need to update draw
496 // properties. 496 // properties.
497 // TODO(weiliangc): Should be safely removed after impl side is able to 497 // TODO(weiliangc): Should be safely removed after impl side is able to
498 // update render surfaces without rebuilding property trees. 498 // update render surfaces without rebuilding property trees.
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1044 NoteLayerPropertyChanged(); 1044 NoteLayerPropertyChanged();
1045 } 1045 }
1046 1046
1047 void LayerImpl::SetHideLayerAndSubtree(bool hide) { 1047 void LayerImpl::SetHideLayerAndSubtree(bool hide) {
1048 if (hide_layer_and_subtree_ == hide) 1048 if (hide_layer_and_subtree_ == hide)
1049 return; 1049 return;
1050 1050
1051 hide_layer_and_subtree_ = hide; 1051 hide_layer_and_subtree_ = hide;
1052 } 1052 }
1053 1053
1054 void LayerImpl::SetTransformOrigin(const gfx::Point3F& transform_origin) {
1055 if (transform_origin_ == transform_origin)
1056 return;
1057 transform_origin_ = transform_origin;
1058 }
1059
1060 void LayerImpl::SetBackgroundColor(SkColor background_color) { 1054 void LayerImpl::SetBackgroundColor(SkColor background_color) {
1061 if (background_color_ == background_color) 1055 if (background_color_ == background_color)
1062 return; 1056 return;
1063 1057
1064 background_color_ = background_color; 1058 background_color_ = background_color;
1065 NoteLayerPropertyChanged(); 1059 NoteLayerPropertyChanged();
1066 } 1060 }
1067 1061
1068 void LayerImpl::SetSafeOpaqueBackgroundColor(SkColor background_color) { 1062 void LayerImpl::SetSafeOpaqueBackgroundColor(SkColor background_color) {
1069 if (background_color == safe_opaque_background_color_) 1063 if (background_color == safe_opaque_background_color_)
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 state->SetInteger("gpu_memory_usage", 1381 state->SetInteger("gpu_memory_usage",
1388 base::saturated_cast<int>(GPUMemoryUsageInBytes())); 1382 base::saturated_cast<int>(GPUMemoryUsageInBytes()));
1389 1383
1390 if (mutable_properties_ != MutableProperty::kNone) { 1384 if (mutable_properties_ != MutableProperty::kNone) {
1391 state->SetInteger("element_id", base::saturated_cast<int>(element_id_)); 1385 state->SetInteger("element_id", base::saturated_cast<int>(element_id_));
1392 state->SetInteger("mutable_properties", mutable_properties_); 1386 state->SetInteger("mutable_properties", mutable_properties_);
1393 } 1387 }
1394 1388
1395 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); 1389 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state);
1396 1390
1397 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state);
1398
1399 if (!transform().IsIdentity()) 1391 if (!transform().IsIdentity())
1400 MathUtil::AddToTracedValue("transform", transform(), state); 1392 MathUtil::AddToTracedValue("transform", transform(), state);
1401 1393
1402 state->SetBoolean("should_flatten", should_flatten_transform_); 1394 state->SetBoolean("should_flatten", should_flatten_transform_);
1403 1395
1404 bool clipped; 1396 bool clipped;
1405 gfx::QuadF layer_quad = 1397 gfx::QuadF layer_quad =
1406 MathUtil::MapQuad(ScreenSpaceTransform(), 1398 MathUtil::MapQuad(ScreenSpaceTransform(),
1407 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); 1399 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped);
1408 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); 1400 MathUtil::AddToTracedValue("layer_quad", layer_quad, state);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 .layer_transforms_should_scale_layer_contents) { 1596 .layer_transforms_should_scale_layer_contents) {
1605 return default_scale; 1597 return default_scale;
1606 } 1598 }
1607 1599
1608 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1600 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1609 DrawTransform(), default_scale); 1601 DrawTransform(), default_scale);
1610 return std::max(transform_scales.x(), transform_scales.y()); 1602 return std::max(transform_scales.x(), transform_scales.y());
1611 } 1603 }
1612 1604
1613 } // namespace cc 1605 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_test_properties.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698