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

Unified Diff: cc/trees/property_tree.h

Issue 2105673003: cc: Compute animation scale on demand (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: cc/trees/property_tree.h
diff --git a/cc/trees/property_tree.h b/cc/trees/property_tree.h
index 71eae3c352fdd03653bae5bfbcecab0fd80c2635..fa4dd3f5e839a9722cec7a1cb9f3f5b7804c05b0 100644
--- a/cc/trees/property_tree.h
+++ b/cc/trees/property_tree.h
@@ -155,24 +155,6 @@ struct CC_EXPORT TransformNodeData {
// TODO(vollick): will be moved when accelerated effects are implemented.
float post_local_scale_factor;
- // The maximum scale that that node's |local| transform will have during
jaydasika 2016/06/28 23:08:40 Can we retain the comments ? (move them inside Ani
sunxd 2016/06/30 15:29:44 Done.
- // current animations, considering only scales at keyframes not including the
- // starting keyframe of each animation.
- float local_maximum_animation_target_scale;
-
- // The maximum scale that this node's |local| transform will have during
- // current animatons, considering only the starting scale of each animation.
- float local_starting_animation_scale;
-
- // The maximum scale that this node's |to_target| transform will have during
- // current animations, considering only scales at keyframes not incuding the
- // starting keyframe of each animation.
- float combined_maximum_animation_target_scale;
-
- // The maximum scale that this node's |to_target| transform will have during
- // current animations, considering only the starting scale of each animation.
- float combined_starting_animation_scale;
-
gfx::Vector2dF sublayer_scale;
// TODO(vollick): will be moved when accelerated effects are implemented.
@@ -204,6 +186,7 @@ struct CC_EXPORT TransformNodeData {
void AsValueInto(base::trace_event::TracedValue* value) const;
};
+// TODO(sunxd): move this into PropertyTrees::cached_data_
struct CC_EXPORT TransformCachedNodeData {
TransformCachedNodeData();
TransformCachedNodeData(const TransformCachedNodeData& other);
@@ -425,6 +408,8 @@ class CC_EXPORT TransformTree final : public PropertyTree<TransformNode> {
void clear();
+ void set_needs_update(bool needs_update);
+
// Computes the change of basis transform from node |source_id| to |dest_id|.
// The function returns false iff the inverse of a singular transform was
// used (and the result should, therefore, not be trusted). Transforms may
@@ -726,6 +711,38 @@ class CC_EXPORT ScrollTree final : public PropertyTree<ScrollNode> {
LayerTreeImpl* layer_tree_impl);
};
+struct AnimationScaleData {
+ int update_number;
+ float local_maximum_animation_target_scale;
+ float local_starting_animation_scale;
+ float combined_maximum_animation_target_scale;
+ float combined_starting_animation_scale;
+
+ AnimationScaleData() {
+ update_number = -1;
+ local_maximum_animation_target_scale = 0.f;
+ local_starting_animation_scale = 0.f;
+ combined_maximum_animation_target_scale = 0.f;
+ combined_starting_animation_scale = 0.f;
+ }
+};
+
+struct CombinedAnimationScale {
+ float maximum_animation_scale;
+ float starting_animation_scale;
+
+ CombinedAnimationScale(float maximum, float starting)
+ : maximum_animation_scale(maximum), starting_animation_scale(starting) {}
+};
+
+struct PropertyTreesCachedData {
+ int property_tree_update_number;
+ std::vector<AnimationScaleData> animation_scales;
+
+ PropertyTreesCachedData();
+ ~PropertyTreesCachedData();
+};
+
class CC_EXPORT PropertyTrees final {
public:
PropertyTrees();
@@ -765,6 +782,7 @@ class CC_EXPORT PropertyTrees final {
int sequence_number;
bool is_main_thread;
bool is_active;
+ int property_tree_update_number;
jaydasika 2016/06/28 23:08:40 This is unused.
sunxd 2016/06/30 15:29:44 Done.
void SetInnerViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta);
void SetOuterViewportContainerBoundsDelta(gfx::Vector2dF bounds_delta);
@@ -790,10 +808,20 @@ class CC_EXPORT PropertyTrees final {
std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const;
+ CombinedAnimationScale GetAnimationScales(int transform_node_id,
+ LayerTreeImpl* layer_tree_impl);
+ void SetAnimationScalesForTesting(int transform_id,
+ float maximum_animation_scale,
+ float starting_animation_scale);
+ void ResetCachedData();
+ void UpdateCachedNumber();
+
private:
gfx::Vector2dF inner_viewport_container_bounds_delta_;
gfx::Vector2dF outer_viewport_container_bounds_delta_;
gfx::Vector2dF inner_viewport_scroll_bounds_delta_;
+
+ PropertyTreesCachedData cached_data_;
};
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698