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 "third_party/skia/include/core/SkCanvas.h" |
| 8 |
| 9 namespace cc { |
| 10 |
| 11 ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, |
| 12 SkRegion::Op clip_op, |
| 13 bool antialias) |
| 14 : clip_path_(clip_path), clip_op_(clip_op), antialias_(antialias) { |
| 15 } |
| 16 |
| 17 ClipPathDisplayItem::~ClipPathDisplayItem() { |
| 18 } |
| 19 |
| 20 void ClipPathDisplayItem::Raster(SkCanvas* canvas, |
| 21 SkDrawPictureCallback* callback) const { |
| 22 canvas->save(); |
| 23 canvas->clipPath(clip_path_, clip_op_, antialias_); |
| 24 } |
| 25 |
| 26 bool ClipPathDisplayItem::IsSuitableForGpuRasterization() const { |
| 27 return true; |
| 28 } |
| 29 |
| 30 int ClipPathDisplayItem::ApproximateOpCount() const { |
| 31 return 1; |
| 32 } |
| 33 |
| 34 size_t ClipPathDisplayItem::PictureMemoryUsage() const { |
| 35 size_t total_size = sizeof(SkPath) + sizeof(SkRegion::Op) + sizeof(bool); |
| 36 return total_size; |
| 37 } |
| 38 |
| 39 EndClipPathDisplayItem::EndClipPathDisplayItem() { |
| 40 } |
| 41 |
| 42 EndClipPathDisplayItem::~EndClipPathDisplayItem() { |
| 43 } |
| 44 |
| 45 void EndClipPathDisplayItem::Raster(SkCanvas* canvas, |
| 46 SkDrawPictureCallback* callback) const { |
| 47 canvas->restore(); |
| 48 } |
| 49 |
| 50 bool EndClipPathDisplayItem::IsSuitableForGpuRasterization() const { |
| 51 return true; |
| 52 } |
| 53 |
| 54 int EndClipPathDisplayItem::ApproximateOpCount() const { |
| 55 return 0; |
| 56 } |
| 57 |
| 58 size_t EndClipPathDisplayItem::PictureMemoryUsage() const { |
| 59 return 0; |
| 60 } |
| 61 |
| 62 } // namespace cc |
OLD | NEW |