Index: cc/resources/clip_path_display_item.cc |
diff --git a/cc/resources/clip_path_display_item.cc b/cc/resources/clip_path_display_item.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4012124cd0efdf3533baba5d5380958d267ebe1f |
--- /dev/null |
+++ b/cc/resources/clip_path_display_item.cc |
@@ -0,0 +1,62 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "cc/resources/clip_path_display_item.h" |
+ |
+#include "third_party/skia/include/core/SkCanvas.h" |
+ |
+namespace cc { |
+ |
+ClipPathDisplayItem::ClipPathDisplayItem(const SkPath& clip_path, |
+ SkRegion::Op clip_op, |
+ bool antialias) |
+ : clip_path_(clip_path), clip_op_(clip_op), antialias_(antialias) { |
+} |
+ |
+ClipPathDisplayItem::~ClipPathDisplayItem() { |
+} |
+ |
+void ClipPathDisplayItem::Raster(SkCanvas* canvas, |
+ SkDrawPictureCallback* callback) const { |
+ canvas->save(); |
+ canvas->clipPath(clip_path_, clip_op_, antialias_); |
+} |
+ |
+bool ClipPathDisplayItem::IsSuitableForGpuRasterization() const { |
+ return true; |
+} |
+ |
+int ClipPathDisplayItem::ApproximateOpCount() const { |
+ return 1; |
+} |
+ |
+size_t ClipPathDisplayItem::PictureMemoryUsage() const { |
+ size_t total_size = sizeof(SkPath) + sizeof(SkRegion::Op) + sizeof(bool); |
+ return total_size; |
+} |
+ |
+EndClipPathDisplayItem::EndClipPathDisplayItem() { |
+} |
+ |
+EndClipPathDisplayItem::~EndClipPathDisplayItem() { |
+} |
+ |
+void EndClipPathDisplayItem::Raster(SkCanvas* canvas, |
+ SkDrawPictureCallback* callback) const { |
+ canvas->restore(); |
+} |
+ |
+bool EndClipPathDisplayItem::IsSuitableForGpuRasterization() const { |
+ return true; |
+} |
+ |
+int EndClipPathDisplayItem::ApproximateOpCount() const { |
+ return 0; |
+} |
+ |
+size_t EndClipPathDisplayItem::PictureMemoryUsage() const { |
+ return 0; |
+} |
+ |
+} // namespace cc |