OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "cc/trees/clip_expander.h" |
| 6 #include "cc/trees/effect_node.h" |
| 7 #include "cc/trees/property_tree.h" |
| 8 #include "ui/gfx/transform.h" |
| 9 |
| 10 namespace cc { |
| 11 |
| 12 ClipExpander::ClipExpander(int filter_effect_id) |
| 13 : target_effect_id_(filter_effect_id) {} |
| 14 |
| 15 ClipExpander::ClipExpander(const ClipExpander& other) = default; |
| 16 |
| 17 bool ClipExpander::operator==(const ClipExpander& other) const { |
| 18 return target_effect_id_ == other.target_effect_id_; |
| 19 } |
| 20 |
| 21 gfx::Rect ClipExpander::MapRect(const gfx::Rect& rect, |
| 22 const PropertyTrees* property_trees) const { |
| 23 const EffectNode* effect_node = |
| 24 property_trees->effect_tree.Node(target_effect_id_); |
| 25 gfx::Transform filter_draw_transform; |
| 26 filter_draw_transform.Scale(effect_node->surface_contents_scale.x(), |
| 27 effect_node->surface_contents_scale.y()); |
| 28 return effect_node->filters.MapRect(rect, filter_draw_transform.matrix()); |
| 29 } |
| 30 |
| 31 gfx::Rect ClipExpander::MapRectReverse( |
| 32 const gfx::Rect& rect, |
| 33 const PropertyTrees* property_trees) const { |
| 34 const EffectNode* effect_node = |
| 35 property_trees->effect_tree.Node(target_effect_id_); |
| 36 gfx::Transform filter_draw_transform; |
| 37 filter_draw_transform.Scale(effect_node->surface_contents_scale.x(), |
| 38 effect_node->surface_contents_scale.y()); |
| 39 return effect_node->filters.MapRectReverse(rect, |
| 40 filter_draw_transform.matrix()); |
| 41 } |
| 42 |
| 43 } // namespace cc |
OLD | NEW |