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

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
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) { 1054 void LayerImpl::SetTransformOriginForTesting(
1055 if (transform_origin_ == transform_origin) 1055 const gfx::Point3F& transform_origin) {
1056 return; 1056 if (!test_properties_)
1057 transform_origin_ = transform_origin; 1057 test_properties_ = new LayerImplTestProperties();
1058 test_properties_->transform_origin = transform_origin;
1058 } 1059 }
1059 1060
1060 void LayerImpl::SetBackgroundColor(SkColor background_color) { 1061 void LayerImpl::SetBackgroundColor(SkColor background_color) {
1061 if (background_color_ == background_color) 1062 if (background_color_ == background_color)
1062 return; 1063 return;
1063 1064
1064 background_color_ = background_color; 1065 background_color_ = background_color;
1065 NoteLayerPropertyChanged(); 1066 NoteLayerPropertyChanged();
1066 } 1067 }
1067 1068
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 state->SetInteger("gpu_memory_usage", 1388 state->SetInteger("gpu_memory_usage",
1388 base::saturated_cast<int>(GPUMemoryUsageInBytes())); 1389 base::saturated_cast<int>(GPUMemoryUsageInBytes()));
1389 1390
1390 if (mutable_properties_ != MutableProperty::kNone) { 1391 if (mutable_properties_ != MutableProperty::kNone) {
1391 state->SetInteger("element_id", base::saturated_cast<int>(element_id_)); 1392 state->SetInteger("element_id", base::saturated_cast<int>(element_id_));
1392 state->SetInteger("mutable_properties", mutable_properties_); 1393 state->SetInteger("mutable_properties", mutable_properties_);
1393 } 1394 }
1394 1395
1395 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); 1396 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state);
1396 1397
1397 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state);
1398
1399 if (!transform().IsIdentity()) 1398 if (!transform().IsIdentity())
1400 MathUtil::AddToTracedValue("transform", transform(), state); 1399 MathUtil::AddToTracedValue("transform", transform(), state);
1401 1400
1402 state->SetBoolean("should_flatten", should_flatten_transform_); 1401 state->SetBoolean("should_flatten", should_flatten_transform_);
1403 1402
1404 bool clipped; 1403 bool clipped;
1405 gfx::QuadF layer_quad = 1404 gfx::QuadF layer_quad =
1406 MathUtil::MapQuad(ScreenSpaceTransform(), 1405 MathUtil::MapQuad(ScreenSpaceTransform(),
1407 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); 1406 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped);
1408 MathUtil::AddToTracedValue("layer_quad", layer_quad, state); 1407 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) { 1603 .layer_transforms_should_scale_layer_contents) {
1605 return default_scale; 1604 return default_scale;
1606 } 1605 }
1607 1606
1608 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1607 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1609 DrawTransform(), default_scale); 1608 DrawTransform(), default_scale);
1610 return std::max(transform_scales.x(), transform_scales.y()); 1609 return std::max(transform_scales.x(), transform_scales.y());
1611 } 1610 }
1612 1611
1613 } // namespace cc 1612 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698