Index: cc/paint/paint_image.h |
diff --git a/cc/paint/paint_image.h b/cc/paint/paint_image.h |
index a79bcf02ca3e71085c7cfc57084eb186a3d84443..5aec3cfcdf21402c7813de51a8227295c5465ee1 100644 |
--- a/cc/paint/paint_image.h |
+++ b/cc/paint/paint_image.h |
@@ -14,14 +14,24 @@ namespace cc { |
// TODO(vmpstr): Add a persistent id to the paint image. |
class CC_PAINT_EXPORT PaintImage { |
public: |
+ using Id = int; |
+ |
+ // An id that can be used for all non-lazy images. Note that if an image is |
+ // not lazy, it does not mean that this id must be used; one can still use |
+ // GetNextId to generate a stable id for such images. |
+ static const Id kNonLazyStableId = -1; |
+ |
// TODO(vmpstr): Work towards removing "UNKNOWN" value. |
enum class AnimationType { UNKNOWN, ANIMATED, VIDEO, STATIC }; |
// TODO(vmpstr): Work towards removing "UNKNOWN" value. |
enum class CompletionState { UNKNOWN, DONE, PARTIALLY_DONE }; |
+ static Id GetNextId(); |
+ |
PaintImage(); |
- explicit PaintImage(sk_sp<SkImage> sk_image, |
+ explicit PaintImage(Id id, |
+ sk_sp<SkImage> sk_image, |
AnimationType animation_type = AnimationType::STATIC, |
CompletionState completion_state = CompletionState::DONE); |
PaintImage(const PaintImage& other); |
@@ -34,11 +44,13 @@ class CC_PAINT_EXPORT PaintImage { |
bool operator==(const PaintImage& other); |
explicit operator bool() const { return sk_image_; } |
+ Id stable_id() const { return id_; } |
const sk_sp<SkImage>& sk_image() const { return sk_image_; } |
AnimationType animation_type() const { return animation_type_; } |
CompletionState completion_state() const { return completion_state_; } |
private: |
+ Id id_ = kNonLazyStableId; |
sk_sp<SkImage> sk_image_; |
AnimationType animation_type_ = AnimationType::UNKNOWN; |
CompletionState completion_state_ = CompletionState::UNKNOWN; |