OLD | NEW |
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 #ifndef CC_LAYERS_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 } | 469 } |
470 void reset_needs_push_properties_for_testing() { | 470 void reset_needs_push_properties_for_testing() { |
471 needs_push_properties_ = false; | 471 needs_push_properties_ = false; |
472 } | 472 } |
473 | 473 |
474 virtual void RunMicroBenchmark(MicroBenchmark* benchmark); | 474 virtual void RunMicroBenchmark(MicroBenchmark* benchmark); |
475 | 475 |
476 void Set3dSortingContextId(int id); | 476 void Set3dSortingContextId(int id); |
477 int sorting_context_id() const { return sorting_context_id_; } | 477 int sorting_context_id() const { return sorting_context_id_; } |
478 | 478 |
479 void set_transform_tree_index(int index) { transform_tree_index_ = index; } | 479 void set_transform_tree_index(int index) { |
480 void set_clip_tree_index(int index) { clip_tree_index_ = index; } | 480 if (transform_tree_index_ == index) |
481 void set_opacity_tree_index(int index) { opacity_tree_index_ = index; } | 481 return; |
| 482 transform_tree_index_ = index; |
| 483 SetNeedsPushProperties(); |
| 484 } |
| 485 void set_clip_tree_index(int index) { |
| 486 if (clip_tree_index_ == index) |
| 487 return; |
| 488 clip_tree_index_ = index; |
| 489 SetNeedsPushProperties(); |
| 490 } |
| 491 void set_opacity_tree_index(int index) { |
| 492 if (opacity_tree_index_ == index) |
| 493 return; |
| 494 opacity_tree_index_ = index; |
| 495 SetNeedsPushProperties(); |
| 496 } |
482 int clip_tree_index() const { return clip_tree_index_; } | 497 int clip_tree_index() const { return clip_tree_index_; } |
483 int transform_tree_index() const { return transform_tree_index_; } | 498 int transform_tree_index() const { return transform_tree_index_; } |
484 int opacity_tree_index() const { return opacity_tree_index_; } | 499 int opacity_tree_index() const { return opacity_tree_index_; } |
485 | 500 |
486 void set_offset_to_transform_parent(gfx::Vector2dF offset) { | 501 void set_offset_to_transform_parent(gfx::Vector2dF offset) { |
| 502 if (offset_to_transform_parent_ == offset) |
| 503 return; |
487 offset_to_transform_parent_ = offset; | 504 offset_to_transform_parent_ = offset; |
| 505 SetNeedsPushProperties(); |
488 } | 506 } |
489 gfx::Vector2dF offset_to_transform_parent() const { | 507 gfx::Vector2dF offset_to_transform_parent() const { |
490 return offset_to_transform_parent_; | 508 return offset_to_transform_parent_; |
491 } | 509 } |
492 | 510 |
493 // TODO(vollick): Once we transition to transform and clip trees, rename these | 511 // TODO(vollick): Once we transition to transform and clip trees, rename these |
494 // functions and related values. The "from property trees" functions below | 512 // functions and related values. The "from property trees" functions below |
495 // use the transform and clip trees. Eventually, we will use these functions | 513 // use the transform and clip trees. Eventually, we will use these functions |
496 // to compute the official values, but these functions are retained for | 514 // to compute the official values, but these functions are retained for |
497 // testing purposes until we've migrated. | 515 // testing purposes until we've migrated. |
498 | 516 |
499 const gfx::Rect& visible_rect_from_property_trees() const { | 517 const gfx::Rect& visible_rect_from_property_trees() const { |
500 return visible_rect_from_property_trees_; | 518 return visible_rect_from_property_trees_; |
501 } | 519 } |
502 void set_visible_rect_from_property_trees(const gfx::Rect& rect) { | 520 void set_visible_rect_from_property_trees(const gfx::Rect& rect) { |
| 521 // No push properties here, as this acts like a draw property. |
503 visible_rect_from_property_trees_ = rect; | 522 visible_rect_from_property_trees_ = rect; |
504 } | 523 } |
505 | 524 |
506 gfx::Transform screen_space_transform_from_property_trees( | |
507 const TransformTree& tree) const; | |
508 gfx::Transform draw_transform_from_property_trees( | |
509 const TransformTree& tree) const; | |
510 float DrawOpacityFromPropertyTrees(const OpacityTree& tree) const; | |
511 | |
512 void set_should_flatten_transform_from_property_tree(bool should_flatten) { | 525 void set_should_flatten_transform_from_property_tree(bool should_flatten) { |
| 526 if (should_flatten_transform_from_property_tree_ == should_flatten) |
| 527 return; |
513 should_flatten_transform_from_property_tree_ = should_flatten; | 528 should_flatten_transform_from_property_tree_ = should_flatten; |
| 529 SetNeedsPushProperties(); |
| 530 } |
| 531 bool should_flatten_transform_from_property_tree() const { |
| 532 return should_flatten_transform_from_property_tree_; |
514 } | 533 } |
515 | 534 |
516 // TODO(vollick): These values are temporary and will be removed as soon as | 535 // TODO(vollick): These values are temporary and will be removed as soon as |
517 // render surface determinations are moved out of CDP. They only exist because | 536 // render surface determinations are moved out of CDP. They only exist because |
518 // certain logic depends on whether or not a layer would render to a separate | 537 // certain logic depends on whether or not a layer would render to a separate |
519 // surface, but CDP destroys surfaces and targets it doesn't need, so without | 538 // surface, but CDP destroys surfaces and targets it doesn't need, so without |
520 // this boolean, this is impossible to determine after the fact without | 539 // this boolean, this is impossible to determine after the fact without |
521 // wastefully recomputing it. This is public for the time being so that it can | 540 // wastefully recomputing it. This is public for the time being so that it can |
522 // be accessed from CDP. | 541 // be accessed from CDP. |
523 bool has_render_surface() const { | 542 bool has_render_surface() const { |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 749 |
731 std::vector<FrameTimingRequest> frame_timing_requests_; | 750 std::vector<FrameTimingRequest> frame_timing_requests_; |
732 bool frame_timing_requests_dirty_; | 751 bool frame_timing_requests_dirty_; |
733 | 752 |
734 DISALLOW_COPY_AND_ASSIGN(Layer); | 753 DISALLOW_COPY_AND_ASSIGN(Layer); |
735 }; | 754 }; |
736 | 755 |
737 } // namespace cc | 756 } // namespace cc |
738 | 757 |
739 #endif // CC_LAYERS_LAYER_H_ | 758 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |