| 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 "base/logging.h" |
| 9 #include "cc/paint/paint_export.h" | 9 #include "cc/paint/paint_export.h" |
| 10 #include "third_party/skia/include/core/SkImage.h" | 10 #include "third_party/skia/include/core/SkImage.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // - id: stable id for this image; can be generated using GetNextId(). | 38 // - id: stable id for this image; can be generated using GetNextId(). |
| 39 // - sk_image: the underlying skia image that this represents. | 39 // - sk_image: the underlying skia image that this represents. |
| 40 // - animation_type: the animation type of this paint image. | 40 // - animation_type: the animation type of this paint image. |
| 41 // - completion_state: indicates whether the image is completed loading. | 41 // - completion_state: indicates whether the image is completed loading. |
| 42 // - frame_count: the known number of frames in this image. E.g. number of GIF | 42 // - frame_count: the known number of frames in this image. E.g. number of GIF |
| 43 // frames in an animated GIF. | 43 // frames in an animated GIF. |
| 44 explicit PaintImage(Id id, | 44 explicit PaintImage(Id id, |
| 45 sk_sp<SkImage> sk_image, | 45 sk_sp<SkImage> sk_image, |
| 46 AnimationType animation_type = AnimationType::STATIC, | 46 AnimationType animation_type = AnimationType::STATIC, |
| 47 CompletionState completion_state = CompletionState::DONE, | 47 CompletionState completion_state = CompletionState::DONE, |
| 48 size_t frame_count = 0); | 48 size_t frame_count = 0, |
| 49 bool is_multipart = false); |
| 49 PaintImage(const PaintImage& other); | 50 PaintImage(const PaintImage& other); |
| 50 PaintImage(PaintImage&& other); | 51 PaintImage(PaintImage&& other); |
| 51 ~PaintImage(); | 52 ~PaintImage(); |
| 52 | 53 |
| 53 PaintImage& operator=(const PaintImage& other); | 54 PaintImage& operator=(const PaintImage& other); |
| 54 PaintImage& operator=(PaintImage&& other); | 55 PaintImage& operator=(PaintImage&& other); |
| 55 | 56 |
| 56 bool operator==(const PaintImage& other) const; | 57 bool operator==(const PaintImage& other) const; |
| 57 explicit operator bool() const { return sk_image_; } | 58 explicit operator bool() const { return sk_image_; } |
| 58 | 59 |
| 59 Id stable_id() const { return id_; } | 60 Id stable_id() const { return id_; } |
| 60 const sk_sp<SkImage>& sk_image() const { return sk_image_; } | 61 const sk_sp<SkImage>& sk_image() const { return sk_image_; } |
| 61 AnimationType animation_type() const { return animation_type_; } | 62 AnimationType animation_type() const { return animation_type_; } |
| 62 CompletionState completion_state() const { return completion_state_; } | 63 CompletionState completion_state() const { return completion_state_; } |
| 63 size_t frame_count() const { return frame_count_; } | 64 size_t frame_count() const { return frame_count_; } |
| 65 bool is_multipart() const { return is_multipart_; } |
| 64 | 66 |
| 65 private: | 67 private: |
| 66 Id id_ = kUnknownStableId; | 68 Id id_ = kUnknownStableId; |
| 67 sk_sp<SkImage> sk_image_; | 69 sk_sp<SkImage> sk_image_; |
| 68 AnimationType animation_type_ = AnimationType::UNKNOWN; | 70 AnimationType animation_type_ = AnimationType::UNKNOWN; |
| 69 CompletionState completion_state_ = CompletionState::UNKNOWN; | 71 CompletionState completion_state_ = CompletionState::UNKNOWN; |
| 70 // The number of frames known to exist in this image (eg number of GIF frames | 72 // The number of frames known to exist in this image (eg number of GIF frames |
| 71 // loaded). 0 indicates either unknown or only a single frame, both of which | 73 // loaded). 0 indicates either unknown or only a single frame, both of which |
| 72 // should be treated similarly. | 74 // should be treated similarly. |
| 73 size_t frame_count_ = 0; | 75 size_t frame_count_ = 0; |
| 76 |
| 77 // Whether the data fetched for this image is a part of a multpart response. |
| 78 bool is_multipart_ = false; |
| 74 }; | 79 }; |
| 75 | 80 |
| 76 } // namespace cc | 81 } // namespace cc |
| 77 | 82 |
| 78 #endif // CC_PAINT_PAINT_IMAGE_H_ | 83 #endif // CC_PAINT_PAINT_IMAGE_H_ |
| OLD | NEW |