| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "cc/resources/clip_path_display_item.h" | |
| 6 | |
| 7 #include "base/strings/stringprintf.h" | |
| 8 #include "base/trace_event/trace_event_argument.h" | |
| 9 #include "third_party/skia/include/core/SkCanvas.h" | |
| 10 | |
| 11 namespace cc { | |
| 12 | |
| 13 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, | |
| 14 SkRegion::Op clip_op, | |
| 15 bool antialias) | |
| 16 : clip_path_(clip_path), clip_op_(clip_op), antialias_(antialias) { | |
| 17 } | |
| 18 | |
| 19 ClipPathDisplayItem::~ClipPathDisplayItem() { | |
| 20 } | |
| 21 | |
| 22 void ClipPathDisplayItem::Raster(SkCanvas* canvas, | |
| 23 SkDrawPictureCallback* callback) const { | |
| 24 canvas->save(); | |
| 25 canvas->clipPath(clip_path_, clip_op_, antialias_); | |
| 26 } | |
| 27 | |
| 28 bool ClipPathDisplayItem::IsSuitableForGpuRasterization() const { | |
| 29 return true; | |
| 30 } | |
| 31 | |
| 32 int ClipPathDisplayItem::ApproximateOpCount() const { | |
| 33 return 1; | |
| 34 } | |
| 35 | |
| 36 size_t ClipPathDisplayItem::PictureMemoryUsage() const { | |
| 37 size_t total_size = sizeof(SkPath) + sizeof(SkRegion::Op) + sizeof(bool); | |
| 38 return total_size; | |
| 39 } | |
| 40 | |
| 41 void ClipPathDisplayItem::AsValueInto( | |
| 42 base::trace_event::TracedValue* array) const { | |
| 43 array->AppendString(base::StringPrintf("ClipPathDisplayItem length: %d", | |
| 44 clip_path_.countPoints())); | |
| 45 } | |
| 46 | |
| 47 EndClipPathDisplayItem::EndClipPathDisplayItem() { | |
| 48 } | |
| 49 | |
| 50 EndClipPathDisplayItem::~EndClipPathDisplayItem() { | |
| 51 } | |
| 52 | |
| 53 void EndClipPathDisplayItem::Raster(SkCanvas* canvas, | |
| 54 SkDrawPictureCallback* callback) const { | |
| 55 canvas->restore(); | |
| 56 } | |
| 57 | |
| 58 bool EndClipPathDisplayItem::IsSuitableForGpuRasterization() const { | |
| 59 return true; | |
| 60 } | |
| 61 | |
| 62 int EndClipPathDisplayItem::ApproximateOpCount() const { | |
| 63 return 0; | |
| 64 } | |
| 65 | |
| 66 size_t EndClipPathDisplayItem::PictureMemoryUsage() const { | |
| 67 return 0; | |
| 68 } | |
| 69 | |
| 70 void EndClipPathDisplayItem::AsValueInto( | |
| 71 base::trace_event::TracedValue* array) const { | |
| 72 array->AppendString("EndClipPathDisplayItem"); | |
| 73 } | |
| 74 | |
| 75 } // namespace cc | |
| OLD | NEW |