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

Unified Diff: cc/trees/clip_node.cc

Issue 2423483003: cc: Make visible rect computation aware of pixel-moving filters (Closed)
Patch Set: Rebase Created 4 years, 1 month 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/clip_node.cc
diff --git a/cc/trees/clip_node.cc b/cc/trees/clip_node.cc
index b49263d5a332086920137f9c24b180067dea5dbf..953df97bf0ec59e600913a06a0f9884e8a9777ae 100644
--- a/cc/trees/clip_node.cc
+++ b/cc/trees/clip_node.cc
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event_argument.h"
#include "cc/base/math_util.h"
#include "cc/proto/cc_conversions.h"
#include "cc/proto/gfx_conversions.h"
#include "cc/proto/property_tree.pb.h"
#include "cc/trees/clip_node.h"
+#include "cc/trees/property_tree.h"
namespace cc {
@@ -25,9 +27,68 @@ ClipNode::ClipNode()
layers_are_clipped_when_surfaces_disabled(false),
resets_clip(false) {}
-ClipNode::ClipNode(const ClipNode& other) = default;
+ClipNode::ClipNode(const ClipNode& other)
+ : id(other.id),
+ parent_id(other.parent_id),
+ owner_id(other.owner_id),
+ clip_type(other.clip_type),
+ clip(other.clip),
+ combined_clip_in_target_space(other.combined_clip_in_target_space),
+ clip_in_target_space(other.clip_in_target_space),
+ transform_id(other.transform_id),
+ target_transform_id(other.target_transform_id),
+ target_effect_id(other.target_effect_id),
+ layer_clipping_uses_only_local_clip(
+ other.layer_clipping_uses_only_local_clip),
+ target_is_clipped(other.target_is_clipped),
+ layers_are_clipped(other.layers_are_clipped),
+ layers_are_clipped_when_surfaces_disabled(
+ other.layers_are_clipped_when_surfaces_disabled),
+ resets_clip(other.resets_clip) {
+ if (other.clip_expander) {
+ DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP);
+ clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander);
+ }
+}
+
+ClipNode& ClipNode::operator=(const ClipNode& other) {
+ id = other.id;
+ parent_id = other.parent_id;
+ owner_id = other.owner_id;
+ clip_type = other.clip_type;
+ clip = other.clip;
+ combined_clip_in_target_space = other.combined_clip_in_target_space;
+ clip_in_target_space = other.clip_in_target_space;
+ transform_id = other.transform_id;
+ target_transform_id = other.target_transform_id;
+ target_effect_id = other.target_effect_id;
+ layer_clipping_uses_only_local_clip =
+ other.layer_clipping_uses_only_local_clip;
+ target_is_clipped = other.target_is_clipped;
+ layers_are_clipped = other.layers_are_clipped;
+ layers_are_clipped_when_surfaces_disabled =
+ other.layers_are_clipped_when_surfaces_disabled;
+ resets_clip = other.resets_clip;
+
+ if (other.clip_expander) {
+ DCHECK_EQ(clip_type, ClipType::EXPANDS_CLIP);
+ clip_expander = base::MakeUnique<ClipExpander>(*other.clip_expander);
+ } else {
+ clip_expander.reset();
+ }
+
+ return *this;
+}
+
+ClipNode::~ClipNode() {}
bool ClipNode::operator==(const ClipNode& other) const {
+ if (clip_expander && other.clip_expander &&
+ *clip_expander != *other.clip_expander)
+ return false;
+ if ((clip_expander && !other.clip_expander) ||
+ (!clip_expander && other.clip_expander))
+ return false;
return id == other.id && parent_id == other.parent_id &&
owner_id == other.owner_id && clip_type == other.clip_type &&
clip == other.clip &&
@@ -54,6 +115,10 @@ void ClipNode::ToProtobuf(proto::TreeNode* proto) const {
proto::ClipNodeData* data = proto->mutable_clip_node_data();
data->set_clip_type(ClipNodeTypeToProto(clip_type));
+ if (clip_type == ClipType::EXPANDS_CLIP)
+ data->set_clip_expander_effect_id(clip_expander->target_effect_id());
+ else
+ data->set_clip_expander_effect_id(EffectTree::kInvalidNodeId);
RectFToProto(clip, data->mutable_clip());
RectFToProto(combined_clip_in_target_space,
@@ -81,6 +146,12 @@ void ClipNode::FromProtobuf(const proto::TreeNode& proto) {
const proto::ClipNodeData& data = proto.clip_node_data();
clip_type = ClipNodeTypeFromProto(data.clip_type());
+ if (clip_type == ClipNode::ClipType::EXPANDS_CLIP) {
+ clip_expander = base::MakeUnique<ClipExpander>(
+ ClipExpander::ExpanderType::FILTER, data.clip_expander_effect_id());
+ } else {
+ clip_expander.reset();
+ }
clip = ProtoToRectF(data.clip());
combined_clip_in_target_space =
ProtoToRectF(data.combined_clip_in_target_space());

Powered by Google App Engine
This is Rietveld 408576698