OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PAINT_PAINT_IMAGE_H_ | 5 #ifndef CC_PAINT_PAINT_IMAGE_H_ |
6 #define CC_PAINT_PAINT_IMAGE_H_ | 6 #define CC_PAINT_PAINT_IMAGE_H_ |
7 | 7 |
| 8 #include "base/logging.h" |
8 #include "cc/paint/paint_export.h" | 9 #include "cc/paint/paint_export.h" |
9 | |
10 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
11 | 11 |
12 namespace cc { | 12 namespace cc { |
13 | 13 |
14 // TODO(vmpstr): Add a persistent id to the paint image. | 14 // TODO(vmpstr): Add a persistent id to the paint image. |
15 class CC_PAINT_EXPORT PaintImage { | 15 class CC_PAINT_EXPORT PaintImage { |
16 public: | 16 public: |
17 // TODO(vmpstr): Work towards removing "UNKNOWN" value. | 17 // TODO(vmpstr): Work towards removing "UNKNOWN" value. |
18 enum class AnimationType { UNKNOWN, ANIMATED, VIDEO, STATIC }; | 18 enum class AnimationType { UNKNOWN, ANIMATED, VIDEO, STATIC }; |
19 | 19 |
20 // TODO(vmpstr): Work towards removing "UNKNOWN" value. | 20 // TODO(vmpstr): Work towards removing "UNKNOWN" value. |
21 enum class CompletionState { UNKNOWN, DONE, PARTIALLY_DONE }; | 21 enum class CompletionState { UNKNOWN, DONE, PARTIALLY_DONE }; |
22 | 22 |
23 PaintImage(sk_sp<const SkImage> sk_image, | 23 PaintImage(); |
24 AnimationType animation_type, | 24 explicit PaintImage(sk_sp<const SkImage> sk_image, |
25 CompletionState completion_state); | 25 AnimationType animation_type = AnimationType::STATIC, |
| 26 CompletionState completion_state = CompletionState::DONE); |
| 27 PaintImage(const PaintImage& other); |
| 28 PaintImage(PaintImage&& other); |
26 ~PaintImage(); | 29 ~PaintImage(); |
27 | 30 |
| 31 PaintImage& operator=(const PaintImage& other); |
| 32 PaintImage& operator=(PaintImage&& other); |
| 33 |
| 34 bool operator==(const PaintImage& other); |
| 35 |
28 const sk_sp<const SkImage>& sk_image() const { return sk_image_; } | 36 const sk_sp<const SkImage>& sk_image() const { return sk_image_; } |
29 AnimationType animation_type() const { return animation_type_; } | 37 AnimationType animation_type() const { return animation_type_; } |
30 CompletionState completion_state() const { return completion_state_; } | 38 CompletionState completion_state() const { return completion_state_; } |
31 | 39 |
32 private: | 40 private: |
33 sk_sp<const SkImage> sk_image_; | 41 sk_sp<const SkImage> sk_image_; |
34 AnimationType animation_type_; | 42 AnimationType animation_type_ = AnimationType::UNKNOWN; |
35 CompletionState completion_state_; | 43 CompletionState completion_state_ = CompletionState::UNKNOWN; |
36 }; | 44 }; |
37 | 45 |
38 } // namespace cc | 46 } // namespace cc |
39 | 47 |
40 #endif // CC_PAINT_PAINT_IMAGE_H_ | 48 #endif // CC_PAINT_PAINT_IMAGE_H_ |
OLD | NEW |