| 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_TRANSFORM_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ |
| 6 #define CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 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 "ui/gfx/transform.h" | 13 #include "ui/gfx/transform.h" |
| 14 | 14 |
| 15 class SkCanvas; | 15 class SkCanvas; |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 class ImageSerializationProcessor; | 18 class ImageSerializationProcessor; |
| 19 | 19 |
| 20 class CC_EXPORT TransformDisplayItem : public DisplayItem { | 20 class CC_EXPORT TransformDisplayItem : public DisplayItem { |
| 21 public: | 21 public: |
| 22 explicit TransformDisplayItem(const gfx::Transform& transform); | 22 explicit TransformDisplayItem(const gfx::Transform& transform); |
| 23 explicit TransformDisplayItem(const proto::DisplayItem& proto); | 23 explicit TransformDisplayItem(const proto::DisplayItem& proto); |
| 24 ~TransformDisplayItem() override; | 24 ~TransformDisplayItem() override; |
| 25 | 25 |
| 26 void ToProtobuf(proto::DisplayItem* proto, | 26 void ToProtobuf(proto::DisplayItem* proto, |
| 27 ImageSerializationProcessor* image_serialization_processor) | 27 ImageSerializationProcessor* image_serialization_processor) |
| 28 const override; | 28 const override; |
| 29 void Raster(SkCanvas* canvas, | 29 void Raster(SkCanvas* canvas, |
| 30 const gfx::Rect& canvas_target_playback_rect, | |
| 31 SkPicture::AbortCallback* callback) const override; | 30 SkPicture::AbortCallback* callback) const override; |
| 32 void AsValueInto(const gfx::Rect& visual_rect, | 31 void AsValueInto(const gfx::Rect& visual_rect, |
| 33 base::trace_event::TracedValue* array) const override; | 32 base::trace_event::TracedValue* array) const override; |
| 34 size_t ExternalMemoryUsage() const override; | 33 size_t ExternalMemoryUsage() const override; |
| 35 | 34 |
| 36 int ApproximateOpCount() const { return 1; } | 35 int ApproximateOpCount() const { return 1; } |
| 37 bool IsSuitableForGpuRasterization() const { return true; } | 36 bool IsSuitableForGpuRasterization() const { return true; } |
| 38 | 37 |
| 39 private: | 38 private: |
| 40 void SetNew(const gfx::Transform& transform); | 39 void SetNew(const gfx::Transform& transform); |
| 41 | 40 |
| 42 gfx::Transform transform_; | 41 gfx::Transform transform_; |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 class CC_EXPORT EndTransformDisplayItem : public DisplayItem { | 44 class CC_EXPORT EndTransformDisplayItem : public DisplayItem { |
| 46 public: | 45 public: |
| 47 EndTransformDisplayItem(); | 46 EndTransformDisplayItem(); |
| 48 explicit EndTransformDisplayItem(const proto::DisplayItem& proto); | 47 explicit EndTransformDisplayItem(const proto::DisplayItem& proto); |
| 49 ~EndTransformDisplayItem() override; | 48 ~EndTransformDisplayItem() override; |
| 50 | 49 |
| 51 static scoped_ptr<EndTransformDisplayItem> Create() { | 50 static scoped_ptr<EndTransformDisplayItem> Create() { |
| 52 return make_scoped_ptr(new EndTransformDisplayItem()); | 51 return make_scoped_ptr(new EndTransformDisplayItem()); |
| 53 } | 52 } |
| 54 | 53 |
| 55 void ToProtobuf(proto::DisplayItem* proto, | 54 void ToProtobuf(proto::DisplayItem* proto, |
| 56 ImageSerializationProcessor* image_serialization_processor) | 55 ImageSerializationProcessor* image_serialization_processor) |
| 57 const override; | 56 const override; |
| 58 void Raster(SkCanvas* canvas, | 57 void Raster(SkCanvas* canvas, |
| 59 const gfx::Rect& canvas_target_playback_rect, | |
| 60 SkPicture::AbortCallback* callback) const override; | 58 SkPicture::AbortCallback* callback) const override; |
| 61 void AsValueInto(const gfx::Rect& visual_rect, | 59 void AsValueInto(const gfx::Rect& visual_rect, |
| 62 base::trace_event::TracedValue* array) const override; | 60 base::trace_event::TracedValue* array) const override; |
| 63 size_t ExternalMemoryUsage() const override; | 61 size_t ExternalMemoryUsage() const override; |
| 64 | 62 |
| 65 int ApproximateOpCount() const { return 0; } | 63 int ApproximateOpCount() const { return 0; } |
| 66 bool IsSuitableForGpuRasterization() const { return true; } | 64 bool IsSuitableForGpuRasterization() const { return true; } |
| 67 }; | 65 }; |
| 68 | 66 |
| 69 } // namespace cc | 67 } // namespace cc |
| 70 | 68 |
| 71 #endif // CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ | 69 #endif // CC_PLAYBACK_TRANSFORM_DISPLAY_ITEM_H_ |
| OLD | NEW |