| 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 18 matching lines...) Expand all Loading... |
| 29 #define BitmapImage_h | 29 #define BitmapImage_h |
| 30 | 30 |
| 31 #include "platform/geometry/IntSize.h" | 31 #include "platform/geometry/IntSize.h" |
| 32 #include "platform/graphics/Color.h" | 32 #include "platform/graphics/Color.h" |
| 33 #include "platform/graphics/FrameData.h" | 33 #include "platform/graphics/FrameData.h" |
| 34 #include "platform/graphics/Image.h" | 34 #include "platform/graphics/Image.h" |
| 35 #include "platform/graphics/ImageAnimationPolicy.h" | 35 #include "platform/graphics/ImageAnimationPolicy.h" |
| 36 #include "platform/graphics/ImageOrientation.h" | 36 #include "platform/graphics/ImageOrientation.h" |
| 37 #include "platform/graphics/ImageSource.h" | 37 #include "platform/graphics/ImageSource.h" |
| 38 #include "platform/image-decoders/ImageAnimation.h" | 38 #include "platform/image-decoders/ImageAnimation.h" |
| 39 #include "public/platform/WebMemoryDumpProvider.h" |
| 39 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
| 40 #include "wtf/OwnPtr.h" | 41 #include "wtf/OwnPtr.h" |
| 41 | 42 |
| 42 namespace blink { | 43 namespace blink { |
| 43 | 44 |
| 44 template <typename T> class Timer; | 45 template <typename T> class Timer; |
| 45 | 46 |
| 46 class PLATFORM_EXPORT BitmapImage final : public Image { | 47 class PLATFORM_EXPORT BitmapImage final : public Image, public WebMemoryDumpProv
ider { |
| 47 friend class GeneratedImage; | 48 friend class GeneratedImage; |
| 48 friend class CrossfadeGeneratedImage; | 49 friend class CrossfadeGeneratedImage; |
| 49 friend class GradientGeneratedImage; | 50 friend class GradientGeneratedImage; |
| 50 friend class GraphicsContext; | 51 friend class GraphicsContext; |
| 51 public: | 52 public: |
| 52 static PassRefPtr<BitmapImage> create(ImageObserver* observer = 0) | 53 static PassRefPtr<BitmapImage> create(ImageObserver* observer = 0) |
| 53 { | 54 { |
| 54 return adoptRef(new BitmapImage(observer)); | 55 return adoptRef(new BitmapImage(observer)); |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void advanceAnimationForTesting() override { internalAdvanceAnimation(false)
; } | 89 void advanceAnimationForTesting() override { internalAdvanceAnimation(false)
; } |
| 89 | 90 |
| 90 PassRefPtr<SkImage> imageForCurrentFrame() override; | 91 PassRefPtr<SkImage> imageForCurrentFrame() override; |
| 91 PassRefPtr<Image> imageForDefaultFrame() override; | 92 PassRefPtr<Image> imageForDefaultFrame() override; |
| 92 bool currentFrameKnownToBeOpaque() override; | 93 bool currentFrameKnownToBeOpaque() override; |
| 93 bool currentFrameIsComplete() override; | 94 bool currentFrameIsComplete() override; |
| 94 bool currentFrameIsLazyDecoded() override; | 95 bool currentFrameIsLazyDecoded() override; |
| 95 | 96 |
| 96 ImageOrientation currentFrameOrientation(); | 97 ImageOrientation currentFrameOrientation(); |
| 97 | 98 |
| 99 // Overridden from WebMemoryDumpProvider. |
| 100 bool onMemoryDump(WebMemoryDumpLevelOfDetail, WebProcessMemoryDump*) overrid
e; |
| 101 |
| 98 private: | 102 private: |
| 99 friend class BitmapImageTest; | 103 friend class BitmapImageTest; |
| 100 | 104 |
| 101 void updateSize() const; | 105 void updateSize() const; |
| 102 | 106 |
| 103 private: | 107 private: |
| 104 enum RepetitionCountStatus { | 108 enum RepetitionCountStatus { |
| 105 Unknown, // We haven't checked the source's repetition count. | 109 Unknown, // We haven't checked the source's repetition count. |
| 106 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). | 110 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). |
| 107 Certain // The repetition count is known to be correct. | 111 Certain // The repetition count is known to be correct. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. | 195 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi
rst image frame yet from ImageIO. |
| 192 mutable bool m_hasUniformFrameSize : 1; | 196 mutable bool m_hasUniformFrameSize : 1; |
| 193 mutable bool m_haveFrameCount : 1; | 197 mutable bool m_haveFrameCount : 1; |
| 194 }; | 198 }; |
| 195 | 199 |
| 196 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); | 200 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); |
| 197 | 201 |
| 198 } // namespace blink | 202 } // namespace blink |
| 199 | 203 |
| 200 #endif | 204 #endif |
| OLD | NEW |