| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 #ifndef CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | |
| 6 #define CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 #include <vector> | |
| 12 | |
| 13 #include "cc/base/cc_export.h" | |
| 14 #include "cc/playback/display_item.h" | |
| 15 #include "third_party/skia/include/core/SkRRect.h" | |
| 16 #include "ui/gfx/geometry/rect.h" | |
| 17 | |
| 18 class SkCanvas; | |
| 19 | |
| 20 namespace cc { | |
| 21 | |
| 22 class CC_EXPORT ClipDisplayItem : public DisplayItem { | |
| 23 public: | |
| 24 ClipDisplayItem(const gfx::Rect& clip_rect, | |
| 25 const std::vector<SkRRect>& rounded_clip_rects, | |
| 26 bool antialias); | |
| 27 ~ClipDisplayItem() override; | |
| 28 | |
| 29 void Raster(SkCanvas* canvas, | |
| 30 SkPicture::AbortCallback* callback) const override; | |
| 31 | |
| 32 size_t ExternalMemoryUsage() const { | |
| 33 return rounded_clip_rects_.capacity() * sizeof(rounded_clip_rects_[0]); | |
| 34 } | |
| 35 int ApproximateOpCount() const { return 1; } | |
| 36 | |
| 37 const gfx::Rect& clip_rect() const { return clip_rect_; } | |
| 38 const std::vector<SkRRect>& rounded_clip_rects() const { | |
| 39 return rounded_clip_rects_; | |
| 40 } | |
| 41 | |
| 42 private: | |
| 43 void SetNew(const gfx::Rect& clip_rect, | |
| 44 const std::vector<SkRRect>& rounded_clip_rects, | |
| 45 bool antialias); | |
| 46 | |
| 47 gfx::Rect clip_rect_; | |
| 48 std::vector<SkRRect> rounded_clip_rects_; | |
| 49 bool antialias_; | |
| 50 }; | |
| 51 | |
| 52 class CC_EXPORT EndClipDisplayItem : public DisplayItem { | |
| 53 public: | |
| 54 EndClipDisplayItem(); | |
| 55 ~EndClipDisplayItem() override; | |
| 56 | |
| 57 void Raster(SkCanvas* canvas, | |
| 58 SkPicture::AbortCallback* callback) const override; | |
| 59 | |
| 60 int ApproximateOpCount() const { return 0; } | |
| 61 }; | |
| 62 | |
| 63 } // namespace cc | |
| 64 | |
| 65 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | |
| OLD | NEW |