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

Side by Side Diff: cc/playback/clip_display_item.cc

Issue 1484163002: Raster display item lists via a visual rect RTree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sync to head. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "cc/playback/clip_display_item.h" 5 #include "cc/playback/clip_display_item.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 gfx::Rect clip_rect = ProtoToRect(details.clip_rect()); 53 gfx::Rect clip_rect = ProtoToRect(details.clip_rect());
54 std::vector<SkRRect> rounded_clip_rects; 54 std::vector<SkRRect> rounded_clip_rects;
55 rounded_clip_rects.reserve(details.rounded_rects_size()); 55 rounded_clip_rects.reserve(details.rounded_rects_size());
56 for (int i = 0; i < details.rounded_rects_size(); i++) { 56 for (int i = 0; i < details.rounded_rects_size(); i++) {
57 rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i))); 57 rounded_clip_rects.push_back(ProtoToSkRRect(details.rounded_rects(i)));
58 } 58 }
59 SetNew(clip_rect, rounded_clip_rects); 59 SetNew(clip_rect, rounded_clip_rects);
60 } 60 }
61 61
62 void ClipDisplayItem::Raster(SkCanvas* canvas, 62 void ClipDisplayItem::Raster(SkCanvas* canvas,
63 const gfx::Rect& canvas_target_playback_rect,
64 SkPicture::AbortCallback* callback) const { 63 SkPicture::AbortCallback* callback) const {
65 canvas->save(); 64 canvas->save();
66 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), 65 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(),
67 clip_rect_.width(), clip_rect_.height())); 66 clip_rect_.width(), clip_rect_.height()));
68 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { 67 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
69 if (rounded_clip_rects_[i].isRect()) { 68 if (rounded_clip_rects_[i].isRect()) {
70 canvas->clipRect(rounded_clip_rects_[i].rect()); 69 canvas->clipRect(rounded_clip_rects_[i].rect());
71 } else { 70 } else {
72 bool antialiased = true; 71 bool antialiased = true;
73 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, 72 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 113
115 void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { 114 void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
116 proto->set_type(proto::DisplayItem::Type_EndClip); 115 proto->set_type(proto::DisplayItem::Type_EndClip);
117 } 116 }
118 117
119 void EndClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) { 118 void EndClipDisplayItem::FromProtobuf(const proto::DisplayItem& proto) {
120 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); 119 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type());
121 } 120 }
122 121
123 void EndClipDisplayItem::Raster(SkCanvas* canvas, 122 void EndClipDisplayItem::Raster(SkCanvas* canvas,
124 const gfx::Rect& canvas_target_playback_rect,
125 SkPicture::AbortCallback* callback) const { 123 SkPicture::AbortCallback* callback) const {
126 canvas->restore(); 124 canvas->restore();
127 } 125 }
128 126
129 void EndClipDisplayItem::AsValueInto( 127 void EndClipDisplayItem::AsValueInto(
130 const gfx::Rect& visual_rect, 128 const gfx::Rect& visual_rect,
131 base::trace_event::TracedValue* array) const { 129 base::trace_event::TracedValue* array) const {
132 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", 130 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]",
133 visual_rect.ToString().c_str())); 131 visual_rect.ToString().c_str()));
134 } 132 }
135 133
136 } // namespace cc 134 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698