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