| 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 #ifndef CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
| 6 #define CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "cc/base/cc_export.h" | 13 #include "cc/base/cc_export.h" |
| 14 #include "cc/playback/display_item.h" | 14 #include "cc/playback/display_item.h" |
| 15 #include "third_party/skia/include/core/SkClipOp.h" | |
| 16 #include "third_party/skia/include/core/SkPath.h" | 15 #include "third_party/skia/include/core/SkPath.h" |
| 17 | 16 |
| 18 class SkCanvas; | 17 class SkCanvas; |
| 19 | 18 |
| 20 namespace cc { | 19 namespace cc { |
| 21 | 20 |
| 22 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { | 21 class CC_EXPORT ClipPathDisplayItem : public DisplayItem { |
| 23 public: | 22 public: |
| 24 ClipPathDisplayItem(const SkPath& path, SkClipOp clip_op, bool antialias); | 23 ClipPathDisplayItem(const SkPath& path, bool antialias); |
| 25 explicit ClipPathDisplayItem(const proto::DisplayItem& proto); | 24 explicit ClipPathDisplayItem(const proto::DisplayItem& proto); |
| 26 ~ClipPathDisplayItem() override; | 25 ~ClipPathDisplayItem() override; |
| 27 | 26 |
| 28 void ToProtobuf(proto::DisplayItem* proto) const override; | 27 void ToProtobuf(proto::DisplayItem* proto) const override; |
| 29 void Raster(SkCanvas* canvas, | 28 void Raster(SkCanvas* canvas, |
| 30 SkPicture::AbortCallback* callback) const override; | 29 SkPicture::AbortCallback* callback) const override; |
| 31 void AsValueInto(const gfx::Rect& visual_rect, | 30 void AsValueInto(const gfx::Rect& visual_rect, |
| 32 base::trace_event::TracedValue* array) const override; | 31 base::trace_event::TracedValue* array) const override; |
| 33 | 32 |
| 34 size_t ExternalMemoryUsage() const { | 33 size_t ExternalMemoryUsage() const { |
| 35 // The size of SkPath's external storage is not currently accounted for (and | 34 // The size of SkPath's external storage is not currently accounted for (and |
| 36 // may well be shared anyway). | 35 // may well be shared anyway). |
| 37 return 0; | 36 return 0; |
| 38 } | 37 } |
| 39 int ApproximateOpCount() const { return 1; } | 38 int ApproximateOpCount() const { return 1; } |
| 40 | 39 |
| 41 private: | 40 private: |
| 42 void SetNew(const SkPath& path, SkClipOp clip_op, bool antialias); | 41 void SetNew(const SkPath& path, bool antialias); |
| 43 | 42 |
| 44 SkPath clip_path_; | 43 SkPath clip_path_; |
| 45 SkClipOp clip_op_; | |
| 46 bool antialias_; | 44 bool antialias_; |
| 47 }; | 45 }; |
| 48 | 46 |
| 49 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { | 47 class CC_EXPORT EndClipPathDisplayItem : public DisplayItem { |
| 50 public: | 48 public: |
| 51 EndClipPathDisplayItem(); | 49 EndClipPathDisplayItem(); |
| 52 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); | 50 explicit EndClipPathDisplayItem(const proto::DisplayItem& proto); |
| 53 ~EndClipPathDisplayItem() override; | 51 ~EndClipPathDisplayItem() override; |
| 54 | 52 |
| 55 static std::unique_ptr<EndClipPathDisplayItem> Create() { | 53 static std::unique_ptr<EndClipPathDisplayItem> Create() { |
| 56 return base::MakeUnique<EndClipPathDisplayItem>(); | 54 return base::MakeUnique<EndClipPathDisplayItem>(); |
| 57 } | 55 } |
| 58 | 56 |
| 59 void ToProtobuf(proto::DisplayItem* proto) const override; | 57 void ToProtobuf(proto::DisplayItem* proto) const override; |
| 60 void Raster(SkCanvas* canvas, | 58 void Raster(SkCanvas* canvas, |
| 61 SkPicture::AbortCallback* callback) const override; | 59 SkPicture::AbortCallback* callback) const override; |
| 62 void AsValueInto(const gfx::Rect& visual_rect, | 60 void AsValueInto(const gfx::Rect& visual_rect, |
| 63 base::trace_event::TracedValue* array) const override; | 61 base::trace_event::TracedValue* array) const override; |
| 64 | 62 |
| 65 int ApproximateOpCount() const { return 0; } | 63 int ApproximateOpCount() const { return 0; } |
| 66 }; | 64 }; |
| 67 | 65 |
| 68 } // namespace cc | 66 } // namespace cc |
| 69 | 67 |
| 70 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ | 68 #endif // CC_PLAYBACK_CLIP_PATH_DISPLAY_ITEM_H_ |
| OLD | NEW |