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

Unified Diff: cc/playback/clip_display_item.cc

Issue 1494223003: cc: Shrink size of display item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix some compilation issues in ui oops Created 5 years 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
« no previous file with comments | « cc/playback/clip_display_item.h ('k') | cc/playback/clip_path_display_item.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/playback/clip_display_item.cc
diff --git a/cc/playback/clip_display_item.cc b/cc/playback/clip_display_item.cc
index d89566c1e0d685a327e4a4e97bc05c791f38f2e2..96a2df8edb91f27c38be35292c8550b045e674ec 100644
--- a/cc/playback/clip_display_item.cc
+++ b/cc/playback/clip_display_item.cc
@@ -17,24 +17,33 @@
namespace cc {
-ClipDisplayItem::ClipDisplayItem() {
+ClipDisplayItem::ClipDisplayItem(
+ const gfx::Rect& clip_rect,
+ const std::vector<SkRRect>& rounded_clip_rects) {
+ SetNew(clip_rect, rounded_clip_rects);
}
-ClipDisplayItem::~ClipDisplayItem() {
+ClipDisplayItem::ClipDisplayItem(const proto::DisplayItem& proto) {
+ DCHECK_EQ(proto::DisplayItem::Type_Clip, proto.type());
+
+ const proto::ClipDisplayItem& details = proto.clip_item();
+ gfx::Rect clip_rect = ProtoToRect(details.clip_rect());
+ std::vector<SkRRect> rounded_clip_rects;
+ rounded_clip_rects.reserve(details.rounded_rects_size());
+ for (int i = 0; i < details.rounded_rects_size(); i++) {
+ rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i)));
+ }
+ SetNew(clip_rect, rounded_clip_rects);
}
-void ClipDisplayItem::SetNew(gfx::Rect clip_rect,
+void ClipDisplayItem::SetNew(const gfx::Rect& clip_rect,
const std::vector<SkRRect>& rounded_clip_rects) {
clip_rect_ = clip_rect;
rounded_clip_rects_ = rounded_clip_rects;
-
- size_t external_memory_usage =
- rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]);
-
- DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */,
- external_memory_usage);
}
+ClipDisplayItem::~ClipDisplayItem() {}
+
void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
proto->set_type(proto::DisplayItem::Type_Clip);
@@ -46,19 +55,6 @@ void ClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
}
}
-void ClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
- DCHECK_EQ(proto::DisplayItem::Type_Clip, proto.type());
-
- const proto::ClipDisplayItem& details = proto.clip_item();
- gfx::Rect clip_rect = ProtoToRect(details.clip_rect());
- std::vector<SkRRect> rounded_clip_rects;
- rounded_clip_rects.reserve(details.rounded_rects_size());
- for (int i = 0; i < details.rounded_rects_size(); i++) {
- rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i)));
- }
- SetNew(clip_rect, rounded_clip_rects);
-}
-
void ClipDisplayItem::Raster(SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,
SkPicture::AbortCallback* callback) const {
@@ -104,9 +100,14 @@ void ClipDisplayItem::AsValueInto(const gfx::Rect& visual_rect,
array->AppendString(value);
}
-EndClipDisplayItem::EndClipDisplayItem() {
- DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */,
- 0 /* external_memory_usage */);
+size_t ClipDisplayItem::ExternalMemoryUsage() const {
+ return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]);
+}
+
+EndClipDisplayItem::EndClipDisplayItem() {}
+
+EndClipDisplayItem::EndClipDisplayItem(const proto::DisplayItem& proto) {
+ DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type());
}
EndClipDisplayItem::~EndClipDisplayItem() {
@@ -116,10 +117,6 @@ void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
proto->set_type(proto::DisplayItem::Type_EndClip);
}
-void EndClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
- DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type());
-}
-
void EndClipDisplayItem::Raster(SkCanvas* canvas,
const gfx::Rect& canvas_target_playback_rect,
SkPicture::AbortCallback* callback) const {
@@ -133,4 +130,8 @@ void EndClipDisplayItem::AsValueInto(
visual_rect.ToString().c_str()));
}
+size_t EndClipDisplayItem::ExternalMemoryUsage() const {
+ return 0;
+}
+
} // namespace cc
« no previous file with comments | « cc/playback/clip_display_item.h ('k') | cc/playback/clip_path_display_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698