OLD | NEW |
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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event_argument.h" | 10 #include "base/trace_event/trace_event_argument.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 | 26 |
27 size_t memory_usage = sizeof(gfx::Rect); | 27 size_t memory_usage = sizeof(gfx::Rect); |
28 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { | 28 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { |
29 memory_usage += sizeof(rounded_clip_rects_[i]); | 29 memory_usage += sizeof(rounded_clip_rects_[i]); |
30 } | 30 } |
31 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, | 31 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 1 /* op_count */, |
32 memory_usage); | 32 memory_usage); |
33 } | 33 } |
34 | 34 |
35 void ClipDisplayItem::Raster(SkCanvas* canvas, | 35 void ClipDisplayItem::Raster(SkCanvas* canvas, |
36 SkDrawPictureCallback* callback) const { | 36 SkPicture::AbortCallback* callback) const { |
37 canvas->save(); | 37 canvas->save(); |
38 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), | 38 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), |
39 clip_rect_.width(), clip_rect_.height())); | 39 clip_rect_.width(), clip_rect_.height())); |
40 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { | 40 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { |
41 if (rounded_clip_rects_[i].isRect()) { | 41 if (rounded_clip_rects_[i].isRect()) { |
42 canvas->clipRect(rounded_clip_rects_[i].rect()); | 42 canvas->clipRect(rounded_clip_rects_[i].rect()); |
43 } else { | 43 } else { |
44 bool antialiased = true; | 44 bool antialiased = true; |
45 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, | 45 canvas->clipRRect(rounded_clip_rects_[i], SkRegion::kIntersect_Op, |
46 antialiased); | 46 antialiased); |
(...skipping 29 matching lines...) Expand all Loading... |
76 | 76 |
77 EndClipDisplayItem::EndClipDisplayItem() { | 77 EndClipDisplayItem::EndClipDisplayItem() { |
78 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, | 78 DisplayItem::SetNew(true /* suitable_for_gpu_raster */, 0 /* op_count */, |
79 0 /* memory_usage */); | 79 0 /* memory_usage */); |
80 } | 80 } |
81 | 81 |
82 EndClipDisplayItem::~EndClipDisplayItem() { | 82 EndClipDisplayItem::~EndClipDisplayItem() { |
83 } | 83 } |
84 | 84 |
85 void EndClipDisplayItem::Raster(SkCanvas* canvas, | 85 void EndClipDisplayItem::Raster(SkCanvas* canvas, |
86 SkDrawPictureCallback* callback) const { | 86 SkPicture::AbortCallback* callback) const { |
87 canvas->restore(); | 87 canvas->restore(); |
88 } | 88 } |
89 | 89 |
90 void EndClipDisplayItem::AsValueInto( | 90 void EndClipDisplayItem::AsValueInto( |
91 base::trace_event::TracedValue* array) const { | 91 base::trace_event::TracedValue* array) const { |
92 array->AppendString("EndClipDisplayItem"); | 92 array->AppendString("EndClipDisplayItem"); |
93 } | 93 } |
94 | 94 |
95 } // namespace cc | 95 } // namespace cc |
OLD | NEW |