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