OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved. |
4 * Copyright (C) 2008-2009 Torch Mobile, Inc. | 4 * Copyright (C) 2008-2009 Torch Mobile, Inc. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 bool maybeAnimated() override; | 74 bool maybeAnimated() override; |
75 | 75 |
76 void setAnimationPolicy(ImageAnimationPolicy policy) override { m_animationP
olicy = policy; } | 76 void setAnimationPolicy(ImageAnimationPolicy policy) override { m_animationP
olicy = policy; } |
77 ImageAnimationPolicy animationPolicy() override { return m_animationPolicy;
} | 77 ImageAnimationPolicy animationPolicy() override { return m_animationPolicy;
} |
78 void advanceTime(double deltaTimeInSeconds) override; | 78 void advanceTime(double deltaTimeInSeconds) override; |
79 | 79 |
80 PassRefPtr<SkImage> imageForCurrentFrame() override; | 80 PassRefPtr<SkImage> imageForCurrentFrame() override; |
81 PassRefPtr<Image> imageForDefaultFrame() override; | 81 PassRefPtr<Image> imageForDefaultFrame() override; |
82 | 82 |
83 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
; | 83 bool currentFrameKnownToBeOpaque(MetadataMode = UseCurrentMetadata) override
; |
84 bool currentFrameIsComplete() override; | 84 bool currentFrameIsFullyReceived() override; |
85 bool currentFrameIsLazyDecoded() override; | 85 bool currentFrameIsLazyDecoded() override; |
86 | 86 |
87 ImageOrientation currentFrameOrientation(); | 87 ImageOrientation currentFrameOrientation(); |
88 | 88 |
89 // Construct a BitmapImage with the given orientation. | 89 // Construct a BitmapImage with the given orientation. |
90 static PassRefPtr<BitmapImage> createWithOrientationForTesting(const SkBitma
p&, ImageOrientation); | 90 static PassRefPtr<BitmapImage> createWithOrientationForTesting(const SkBitma
p&, ImageOrientation); |
91 // Advance the image animation by one frame. | 91 // Advance the image animation by one frame. |
92 void advanceAnimationForTesting() override { internalAdvanceAnimation(false)
; } | 92 void advanceAnimationForTesting() override { internalAdvanceAnimation(false)
; } |
93 | 93 |
94 private: | 94 private: |
95 enum RepetitionCountStatus { | 95 enum RepetitionCountStatus { |
96 Unknown, // We haven't checked the source's repetition count. | 96 Unknown, // We haven't checked the source's repetition count. |
97 Uncertain, // We have a repetition count, but it might be wrong (some GIF
s have a count after the image data, and will report "loop once" until all data
has been decoded). | 97 Uncertain, // We have a repetition count, but it might be wrong (some GIF
s have a count after the image data, and will report "loop once" until all data
has been decoded). |
98 Certain // The repetition count is known to be correct. | 98 Certain // The repetition count is known to be correct. |
99 }; | 99 }; |
100 | 100 |
101 BitmapImage(const SkBitmap &, ImageObserver* = 0); | 101 BitmapImage(const SkBitmap &, ImageObserver* = 0); |
102 BitmapImage(ImageObserver* = 0); | 102 BitmapImage(ImageObserver* = 0); |
103 | 103 |
104 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe
ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; | 104 void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const FloatRe
ct& srcRect, RespectImageOrientationEnum, ImageClampingMode) override; |
105 | 105 |
106 size_t currentFrame() const { return m_currentFrame; } | 106 size_t currentFrame() const { return m_currentFrame; } |
107 size_t frameCount(); | 107 size_t frameCount(); |
108 | 108 |
109 PassRefPtr<SkImage> frameAtIndex(size_t); | 109 PassRefPtr<SkImage> frameAtIndex(size_t); |
110 | 110 |
111 bool frameIsCompleteAtIndex(size_t); | 111 bool frameIsFullyReceivedAtIndex(size_t); |
112 float frameDurationAtIndex(size_t); | 112 float frameDurationAtIndex(size_t); |
113 bool frameHasAlphaAtIndex(size_t); | 113 bool frameHasAlphaAtIndex(size_t); |
114 ImageOrientation frameOrientationAtIndex(size_t); | 114 ImageOrientation frameOrientationAtIndex(size_t); |
115 | 115 |
116 PassRefPtr<SkImage> decodeAndCacheFrame(size_t index); | 116 PassRefPtr<SkImage> decodeAndCacheFrame(size_t index); |
117 void updateSize() const; | 117 void updateSize() const; |
118 | 118 |
119 // Returns the total number of bytes allocated for all framebuffers, i.e. | 119 // Returns the total number of bytes allocated for all framebuffers, i.e. |
120 // the sum of m_source.frameBytesAtIndex(...) for all frames. | 120 // the sum of m_source.frameBytesAtIndex(...) for all frames. |
121 size_t totalFrameBytes(); | 121 size_t totalFrameBytes(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable
has the final overall image size yet. | 180 mutable bool m_haveSize : 1; // Whether or not our |m_size| member variable
has the final overall image size yet. |
181 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. | 181 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. |
182 mutable bool m_haveFrameCount : 1; | 182 mutable bool m_haveFrameCount : 1; |
183 }; | 183 }; |
184 | 184 |
185 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); | 185 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); |
186 | 186 |
187 } // namespace blink | 187 } // namespace blink |
188 | 188 |
189 #endif | 189 #endif |
OLD | NEW |