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 <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/playback/display_item.h" | 12 #include "cc/playback/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 | 17 |
18 namespace cc { | 18 namespace cc { |
19 | 19 |
20 class CC_EXPORT ClipDisplayItem : public DisplayItem { | 20 class CC_EXPORT ClipDisplayItem : public DisplayItem { |
21 public: | 21 public: |
22 ClipDisplayItem(); | 22 ClipDisplayItem(gfx::Rect clip_rect, |
23 const std::vector<SkRRect>& rounded_clip_rects); | |
24 explicit ClipDisplayItem(const proto::DisplayItem& proto); | |
23 ~ClipDisplayItem() override; | 25 ~ClipDisplayItem() override; |
24 | 26 |
25 void SetNew(gfx::Rect clip_rect, | |
26 const std::vector<SkRRect>& rounded_clip_rects); | |
27 | |
28 void ToProtobuf(proto::DisplayItem* proto) const override; | 27 void ToProtobuf(proto::DisplayItem* proto) const override; |
29 void FromProtobuf(const proto::DisplayItem& proto) override; | 28 void FromProtobuf(const proto::DisplayItem& proto) override; |
danakj
2015/12/08 19:18:14
should these From methods be private then?
enne (OOO)
2015/12/08 19:47:27
ToProtoBuf should be public.
FromProtoBuf is now p
| |
30 void Raster(SkCanvas* canvas, | 29 void Raster(SkCanvas* canvas, |
31 const gfx::Rect& canvas_target_playback_rect, | 30 const gfx::Rect& canvas_target_playback_rect, |
32 SkPicture::AbortCallback* callback) const override; | 31 SkPicture::AbortCallback* callback) const override; |
33 void AsValueInto(const gfx::Rect& visual_rect, | 32 void AsValueInto(const gfx::Rect& visual_rect, |
34 base::trace_event::TracedValue* array) const override; | 33 base::trace_event::TracedValue* array) const override; |
34 size_t ExternalMemoryUsage() const override; | |
35 | |
36 int ApproximateOpCount() const { return 1; } | |
37 bool IsSuitableForGpuRasterization() const { return true; } | |
35 | 38 |
36 private: | 39 private: |
40 void SetNew(gfx::Rect clip_rect, | |
41 const std::vector<SkRRect>& rounded_clip_rects); | |
42 | |
37 gfx::Rect clip_rect_; | 43 gfx::Rect clip_rect_; |
38 std::vector<SkRRect> rounded_clip_rects_; | 44 std::vector<SkRRect> rounded_clip_rects_; |
39 }; | 45 }; |
40 | 46 |
41 class CC_EXPORT EndClipDisplayItem : public DisplayItem { | 47 class CC_EXPORT EndClipDisplayItem : public DisplayItem { |
42 public: | 48 public: |
43 EndClipDisplayItem(); | 49 EndClipDisplayItem(); |
50 explicit EndClipDisplayItem(const proto::DisplayItem& proto); | |
44 ~EndClipDisplayItem() override; | 51 ~EndClipDisplayItem() override; |
45 | 52 |
46 void ToProtobuf(proto::DisplayItem* proto) const override; | 53 void ToProtobuf(proto::DisplayItem* proto) const override; |
47 void FromProtobuf(const proto::DisplayItem& proto) override; | 54 void FromProtobuf(const proto::DisplayItem& proto) override; |
48 void Raster(SkCanvas* canvas, | 55 void Raster(SkCanvas* canvas, |
49 const gfx::Rect& canvas_target_playback_rect, | 56 const gfx::Rect& canvas_target_playback_rect, |
50 SkPicture::AbortCallback* callback) const override; | 57 SkPicture::AbortCallback* callback) const override; |
51 void AsValueInto(const gfx::Rect& visual_rect, | 58 void AsValueInto(const gfx::Rect& visual_rect, |
52 base::trace_event::TracedValue* array) const override; | 59 base::trace_event::TracedValue* array) const override; |
60 size_t ExternalMemoryUsage() const override; | |
61 | |
62 int ApproximateOpCount() const { return 0; } | |
63 bool IsSuitableForGpuRasterization() const { return true; } | |
53 }; | 64 }; |
54 | 65 |
55 } // namespace cc | 66 } // namespace cc |
56 | 67 |
57 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ | 68 #endif // CC_PLAYBACK_CLIP_DISPLAY_ITEM_H_ |
OLD | NEW |