OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_path_display_item.h" | 5 #include "cc/paint/clip_path_display_item.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
12 #include "third_party/skia/include/core/SkCanvas.h" | 12 #include "third_party/skia/include/core/SkCanvas.h" |
13 | 13 |
14 namespace cc { | 14 namespace cc { |
15 | 15 |
16 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, | 16 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, |
17 bool antialias) | 17 bool antialias) |
18 : DisplayItem(CLIP_PATH) { | 18 : DisplayItem(CLIP_PATH) { |
19 SetNew(clip_path, antialias); | 19 SetNew(clip_path, antialias); |
20 } | 20 } |
21 | 21 |
22 ClipPathDisplayItem::~ClipPathDisplayItem() { | 22 ClipPathDisplayItem::~ClipPathDisplayItem() {} |
23 } | |
24 | 23 |
25 void ClipPathDisplayItem::SetNew(const SkPath& clip_path, | 24 void ClipPathDisplayItem::SetNew(const SkPath& clip_path, bool antialias) { |
26 bool antialias) { | |
27 clip_path_ = clip_path; | 25 clip_path_ = clip_path; |
28 antialias_ = antialias; | 26 antialias_ = antialias; |
29 } | 27 } |
30 | 28 |
31 void ClipPathDisplayItem::Raster(SkCanvas* canvas, | 29 void ClipPathDisplayItem::Raster(SkCanvas* canvas, |
32 SkPicture::AbortCallback* callback) const { | 30 SkPicture::AbortCallback* callback) const { |
33 canvas->save(); | 31 canvas->save(); |
34 canvas->clipPath(clip_path_, antialias_); | 32 canvas->clipPath(clip_path_, antialias_); |
35 } | 33 } |
36 | 34 |
37 EndClipPathDisplayItem::EndClipPathDisplayItem() : DisplayItem(END_CLIP_PATH) {} | 35 EndClipPathDisplayItem::EndClipPathDisplayItem() : DisplayItem(END_CLIP_PATH) {} |
38 | 36 |
39 EndClipPathDisplayItem::~EndClipPathDisplayItem() { | 37 EndClipPathDisplayItem::~EndClipPathDisplayItem() {} |
40 } | |
41 | 38 |
42 void EndClipPathDisplayItem::Raster( | 39 void EndClipPathDisplayItem::Raster(SkCanvas* canvas, |
43 SkCanvas* canvas, | 40 SkPicture::AbortCallback* callback) const { |
44 SkPicture::AbortCallback* callback) const { | |
45 canvas->restore(); | 41 canvas->restore(); |
46 } | 42 } |
47 | 43 |
48 } // namespace cc | 44 } // namespace cc |
OLD | NEW |