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

Side by Side Diff: cc/trees/clip_expander.cc

Issue 2423483003: cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: It's 2017 -- update copyright for new files Created 3 years, 11 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/trees/clip_expander.h ('k') | cc/trees/clip_node.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « cc/trees/clip_expander.h ('k') | cc/trees/clip_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698