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