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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 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
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 proto::ClipDisplayItem* details = proto->mutable_clip_item(); 56 proto::ClipDisplayItem* details = proto->mutable_clip_item();
57 RectToProto(clip_rect_, details->mutable_clip_rect()); 57 RectToProto(clip_rect_, details->mutable_clip_rect());
58 DCHECK_EQ(0, details->rounded_rects_size()); 58 DCHECK_EQ(0, details->rounded_rects_size());
59 for (const auto& rrect : rounded_clip_rects_) { 59 for (const auto& rrect : rounded_clip_rects_) {
60 SkRRectToProto(rrect, details->add_rounded_rects()); 60 SkRRectToProto(rrect, details->add_rounded_rects());
61 } 61 }
62 details->set_antialias(antialias_); 62 details->set_antialias(antialias_);
63 } 63 }
64 64
65 void ClipDisplayItem::Raster(SkCanvas* canvas, 65 void ClipDisplayItem::Raster(CdlCanvas* canvas,
66 SkPicture::AbortCallback* callback) const { 66 SkPicture::AbortCallback* callback) const {
67 canvas->save(); 67 canvas->save();
68 canvas->clipRect(gfx::RectToSkRect(clip_rect_), SkRegion::kIntersect_Op, 68 canvas->clipRect(gfx::RectToSkRect(clip_rect_), SkRegion::kIntersect_Op,
69 antialias_); 69 antialias_);
70 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { 70 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) {
71 if (rounded_clip_rects_[i].isRect()) { 71 if (rounded_clip_rects_[i].isRect()) {
72 canvas->clipRect(rounded_clip_rects_[i].rect(), SkRegion::kIntersect_Op, 72 canvas->clipRect(rounded_clip_rects_[i].rect(), SkRegion::kIntersect_Op,
73 antialias_); 73 antialias_);
74 } else { 74 } else {
75 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, 75 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type()); 116 DCHECK_EQ(proto::DisplayItem::Type_EndClip, proto.type());
117 } 117 }
118 118
119 EndClipDisplayItem::~EndClipDisplayItem() { 119 EndClipDisplayItem::~EndClipDisplayItem() {
120 } 120 }
121 121
122 void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const { 122 void EndClipDisplayItem::ToProtobuf(proto::DisplayItem* proto) const {
123 proto->set_type(proto::DisplayItem::Type_EndClip); 123 proto->set_type(proto::DisplayItem::Type_EndClip);
124 } 124 }
125 125
126 void EndClipDisplayItem::Raster(SkCanvas* canvas, 126 void EndClipDisplayItem::Raster(CdlCanvas* canvas,
127 SkPicture::AbortCallback* callback) const { 127 SkPicture::AbortCallback* callback) const {
128 canvas->restore(); 128 canvas->restore();
129 } 129 }
130 130
131 void EndClipDisplayItem::AsValueInto( 131 void EndClipDisplayItem::AsValueInto(
132 const gfx::Rect& visual_rect, 132 const gfx::Rect& visual_rect,
133 base::trace_event::TracedValue* array) const { 133 base::trace_event::TracedValue* array) const {
134 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]", 134 array->AppendString(base::StringPrintf("EndClipDisplayItem visualRect: [%s]",
135 visual_rect.ToString().c_str())); 135 visual_rect.ToString().c_str()));
136 } 136 }
137 137
138 size_t EndClipDisplayItem::ExternalMemoryUsage() const { 138 size_t EndClipDisplayItem::ExternalMemoryUsage() const {
139 return 0; 139 return 0;
140 } 140 }
141 141
142 } // namespace cc 142 } // namespace cc
OLDNEW
« 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