Chromium Code Reviews| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 | 48 |
| 49 bool operator==(const PaintImage& other) const; | 49 bool operator==(const PaintImage& other) const; |
| 50 explicit operator bool() const { return sk_image_; } | 50 explicit operator bool() const { return sk_image_; } |
| 51 | 51 |
| 52 Id stable_id() const { return id_; } | 52 Id stable_id() const { return id_; } |
| 53 const sk_sp<SkImage>& sk_image() const { return sk_image_; } | 53 const sk_sp<SkImage>& sk_image() const { return sk_image_; } |
| 54 AnimationType animation_type() const { return animation_type_; } | 54 AnimationType animation_type() const { return animation_type_; } |
| 55 CompletionState completion_state() const { return completion_state_; } | 55 CompletionState completion_state() const { return completion_state_; } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 // Because PaintImage is stored in PaintOpBuffer it must be able to be moved | |
|
danakj
2017/05/19 20:35:35
I iterated on this comment a couple times to get s
| |
| 59 // in memory. This is satisfied since it has a default move constructor, and | |
| 60 // the same is satisfied by each of its members. But otherwise would need to | |
| 61 // ensure it directly or indirectly owns no pointers back to itself. | |
| 62 // sk_sp<SkImage> satisfies this since the SkImage does not contain a pointer | |
| 63 // to the sk_sp<> itself. The other types are trivial types. | |
| 64 | |
| 58 Id id_ = kUnknownStableId; | 65 Id id_ = kUnknownStableId; |
| 59 sk_sp<SkImage> sk_image_; | 66 sk_sp<SkImage> sk_image_; |
| 60 AnimationType animation_type_ = AnimationType::UNKNOWN; | 67 AnimationType animation_type_ = AnimationType::UNKNOWN; |
| 61 CompletionState completion_state_ = CompletionState::UNKNOWN; | 68 CompletionState completion_state_ = CompletionState::UNKNOWN; |
| 62 }; | 69 }; |
| 63 | 70 |
| 64 } // namespace cc | 71 } // namespace cc |
| 65 | 72 |
| 66 #endif // CC_PAINT_PAINT_IMAGE_H_ | 73 #endif // CC_PAINT_PAINT_IMAGE_H_ |
| OLD | NEW |