| 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_RESOURCES_CLIP_DISPLAY_ITEM_H_ | 5 #ifndef CC_RESOURCES_CLIP_DISPLAY_ITEM_H_ |
| 6 #define CC_RESOURCES_CLIP_DISPLAY_ITEM_H_ | 6 #define CC_RESOURCES_CLIP_DISPLAY_ITEM_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
| 12 #include "cc/resources/display_item.h" | 12 #include "cc/resources/display_item.h" |
| 13 #include "third_party/skia/include/core/SkRRect.h" | 13 #include "third_party/skia/include/core/SkRRect.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 | 15 |
| 16 class SkCanvas; | 16 class SkCanvas; |
| 17 class SkDrawPictureCallback; | 17 class SkDrawPictureCallback; |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class CC_EXPORT ClipDisplayItem : public DisplayItem { | 21 class CC_EXPORT ClipDisplayItem : public DisplayItem { |
| 22 public: | 22 public: |
| 23 ClipDisplayItem(); |
| 23 ~ClipDisplayItem() override; | 24 ~ClipDisplayItem() override; |
| 24 | 25 |
| 25 static scoped_ptr<ClipDisplayItem> Create( | 26 void SetNew(gfx::Rect clip_rect, |
| 26 gfx::Rect clip_rect, | 27 const std::vector<SkRRect>& rounded_clip_rects); |
| 27 const std::vector<SkRRect>& rounded_clip_rects) { | |
| 28 return make_scoped_ptr(new ClipDisplayItem(clip_rect, rounded_clip_rects)); | |
| 29 } | |
| 30 | 28 |
| 31 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; | 29 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; |
| 32 | 30 |
| 33 bool IsSuitableForGpuRasterization() const override; | 31 bool IsSuitableForGpuRasterization() const override; |
| 34 int ApproximateOpCount() const override; | 32 int ApproximateOpCount() const override; |
| 35 size_t PictureMemoryUsage() const override; | 33 size_t PictureMemoryUsage() const override; |
| 36 void AsValueInto(base::trace_event::TracedValue* array) const override; | 34 void AsValueInto(base::trace_event::TracedValue* array) const override; |
| 37 | 35 |
| 38 protected: | 36 protected: |
| 39 ClipDisplayItem(gfx::Rect clip_rect, | 37 ClipDisplayItem(gfx::Rect clip_rect, |
| 40 const std::vector<SkRRect>& rounded_clip_rects); | 38 const std::vector<SkRRect>& rounded_clip_rects); |
| 41 | 39 |
| 42 private: | 40 private: |
| 43 gfx::Rect clip_rect_; | 41 gfx::Rect clip_rect_; |
| 44 std::vector<SkRRect> rounded_clip_rects_; | 42 std::vector<SkRRect> rounded_clip_rects_; |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 class CC_EXPORT EndClipDisplayItem : public DisplayItem { | 45 class CC_EXPORT EndClipDisplayItem : public DisplayItem { |
| 48 public: | 46 public: |
| 47 EndClipDisplayItem(); |
| 49 ~EndClipDisplayItem() override; | 48 ~EndClipDisplayItem() override; |
| 50 | 49 |
| 51 static scoped_ptr<EndClipDisplayItem> Create() { | |
| 52 return make_scoped_ptr(new EndClipDisplayItem()); | |
| 53 } | |
| 54 | |
| 55 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; | 50 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; |
| 56 | 51 |
| 57 bool IsSuitableForGpuRasterization() const override; | 52 bool IsSuitableForGpuRasterization() const override; |
| 58 int ApproximateOpCount() const override; | 53 int ApproximateOpCount() const override; |
| 59 size_t PictureMemoryUsage() const override; | 54 size_t PictureMemoryUsage() const override; |
| 60 void AsValueInto(base::trace_event::TracedValue* array) const override; | 55 void AsValueInto(base::trace_event::TracedValue* array) const override; |
| 61 | |
| 62 protected: | |
| 63 EndClipDisplayItem(); | |
| 64 }; | 56 }; |
| 65 | 57 |
| 66 } // namespace cc | 58 } // namespace cc |
| 67 | 59 |
| 68 #endif // CC_RESOURCES_CLIP_DISPLAY_ITEM_H_ | 60 #endif // CC_RESOURCES_CLIP_DISPLAY_ITEM_H_ |
| OLD | NEW |