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/resources/clip_display_item.h" | 5 #include "cc/resources/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" |
11 #include "third_party/skia/include/core/SkCanvas.h" | 11 #include "third_party/skia/include/core/SkCanvas.h" |
12 #include "ui/gfx/skia_util.h" | 12 #include "ui/gfx/skia_util.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 ClipDisplayItem::ClipDisplayItem(gfx::Rect clip_rect, | 16 ClipDisplayItem::ClipDisplayItem() { |
17 const std::vector<SkRRect>& rounded_clip_rects) | |
18 : clip_rect_(clip_rect), rounded_clip_rects_(rounded_clip_rects) { | |
19 } | 17 } |
20 | 18 |
21 ClipDisplayItem::~ClipDisplayItem() { | 19 ClipDisplayItem::~ClipDisplayItem() { |
22 } | 20 } |
23 | 21 |
| 22 void ClipDisplayItem::SetNew(gfx::Rect clip_rect, |
| 23 const std::vector<SkRRect>& rounded_clip_rects) { |
| 24 clip_rect_ = clip_rect; |
| 25 rounded_clip_rects_ = rounded_clip_rects; |
| 26 } |
| 27 |
24 void ClipDisplayItem::Raster(SkCanvas* canvas, | 28 void ClipDisplayItem::Raster(SkCanvas* canvas, |
25 SkDrawPictureCallback* callback) const { | 29 SkDrawPictureCallback* callback) const { |
26 canvas->save(); | 30 canvas->save(); |
27 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), | 31 canvas->clipRect(SkRect::MakeXYWH(clip_rect_.x(), clip_rect_.y(), |
28 clip_rect_.width(), clip_rect_.height())); | 32 clip_rect_.width(), clip_rect_.height())); |
29 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { | 33 for (size_t i = 0; i < rounded_clip_rects_.size(); ++i) { |
30 if (rounded_clip_rects_[i].isRect()) { | 34 if (rounded_clip_rects_[i].isRect()) { |
31 canvas->clipRect(rounded_clip_rects_[i].rect()); | 35 canvas->clipRect(rounded_clip_rects_[i].rect()); |
32 } else { | 36 } else { |
33 bool antialiased = true; | 37 bool antialiased = true; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 size_t EndClipDisplayItem::PictureMemoryUsage() const { | 105 size_t EndClipDisplayItem::PictureMemoryUsage() const { |
102 return 0; | 106 return 0; |
103 } | 107 } |
104 | 108 |
105 void EndClipDisplayItem::AsValueInto( | 109 void EndClipDisplayItem::AsValueInto( |
106 base::trace_event::TracedValue* array) const { | 110 base::trace_event::TracedValue* array) const { |
107 array->AppendString("EndClipDisplayItem"); | 111 array->AppendString("EndClipDisplayItem"); |
108 } | 112 } |
109 | 113 |
110 } // namespace cc | 114 } // namespace cc |
OLD | NEW |