Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: Source/platform/graphics/BitmapImage.h

Issue 352873002: [wip] image color correction (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #ifndef BitmapImage_h 28 #ifndef BitmapImage_h
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/ColorSpaceProfile.h"
33 #include "platform/graphics/FrameData.h" 34 #include "platform/graphics/FrameData.h"
35 #include "platform/graphics/GraphicsScreen.h"
34 #include "platform/graphics/Image.h" 36 #include "platform/graphics/Image.h"
35 #include "platform/graphics/ImageOrientation.h" 37 #include "platform/graphics/ImageOrientation.h"
36 #include "platform/graphics/ImageSource.h" 38 #include "platform/graphics/ImageSource.h"
37 #include "wtf/Forward.h"
38 39
39 namespace WebCore { 40 namespace WebCore {
40 41
41 class NativeImageSkia; 42 class NativeImageSkia;
42 template <typename T> class Timer; 43 template <typename T> class Timer;
43 44
44 class PLATFORM_EXPORT BitmapImage : public Image { 45 class PLATFORM_EXPORT BitmapImage : public Image {
45 friend class GeneratedImage; 46 friend class GeneratedImage;
46 friend class CrossfadeGeneratedImage; 47 friend class CrossfadeGeneratedImage;
47 friend class GradientGeneratedImage; 48 friend class GradientGeneratedImage;
(...skipping 12 matching lines...) Expand all
60 virtual bool isBitmapImage() const OVERRIDE; 61 virtual bool isBitmapImage() const OVERRIDE;
61 62
62 virtual bool currentFrameHasSingleSecurityOrigin() const OVERRIDE { return t rue; }; 63 virtual bool currentFrameHasSingleSecurityOrigin() const OVERRIDE { return t rue; };
63 64
64 virtual IntSize size() const OVERRIDE; 65 virtual IntSize size() const OVERRIDE;
65 IntSize sizeRespectingOrientation() const; 66 IntSize sizeRespectingOrientation() const;
66 IntSize currentFrameSize() const; 67 IntSize currentFrameSize() const;
67 virtual bool getHotSpot(IntPoint&) const OVERRIDE; 68 virtual bool getHotSpot(IntPoint&) const OVERRIDE;
68 69
69 virtual bool dataChanged(bool allDataReceived) OVERRIDE; 70 virtual bool dataChanged(bool allDataReceived) OVERRIDE;
70 bool isAllDataReceived() const; 71 bool isAllDataReceived() const { return m_allDataReceived; }
71 bool hasColorProfile() const; 72 bool hasColorProfile() const { return m_source.hasColorProfile(); }
73 PassRefPtr<ColorSpaceProfile> colorProfile() const { return m_source.colorPr ofile(); }
72 virtual String filenameExtension() const OVERRIDE; 74 virtual String filenameExtension() const OVERRIDE;
73 75
74 // It may look unusual that there is no start animation call as public API. This is because 76 // It may look unusual that there is no start animation call as public API. This is because
75 // we start and stop animating lazily. Animation begins whenever someone dr aws the image. It will 77 // we start and stop animating lazily. Animation begins whenever someone dr aws the image. It will
76 // automatically pause once all observers no longer want to render the image anywhere. 78 // automatically pause once all observers no longer want to render the image anywhere.
77 virtual void stopAnimation() OVERRIDE; 79 virtual void stopAnimation() OVERRIDE;
78 virtual void resetAnimation() OVERRIDE; 80 virtual void resetAnimation() OVERRIDE;
79 virtual bool maybeAnimated() OVERRIDE; 81 virtual bool maybeAnimated() OVERRIDE;
80 82
81 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE; 83 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() OVERRIDE;
82 virtual bool currentFrameKnownToBeOpaque() OVERRIDE; 84 virtual bool currentFrameKnownToBeOpaque() OVERRIDE;
83 85
84 ImageOrientation currentFrameOrientation(); 86 ImageOrientation currentFrameOrientation();
85 87
86 #if ASSERT_ENABLED 88 #if ASSERT_ENABLED
87 virtual bool notSolidColor() OVERRIDE; 89 virtual bool notSolidColor() OVERRIDE;
88 #endif 90 #endif
89 91
90 private: 92 private:
91 friend class BitmapImageTest; 93 friend class BitmapImageTest;
94 friend class ImageResource;
92 95
96 void resetDecoder();
93 void updateSize() const; 97 void updateSize() const;
94 98
95 protected: 99 protected:
96 enum RepetitionCountStatus { 100 enum RepetitionCountStatus {
97 Unknown, // We haven't checked the source's repetition count. 101 Unknown, // We haven't checked the source's repetition count.
98 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). 102 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).
99 Certain // The repetition count is known to be correct. 103 Certain // The repetition count is known to be correct.
100 }; 104 };
101 105
102 BitmapImage(PassRefPtr<NativeImageSkia>, ImageObserver* = 0); 106 BitmapImage(PassRefPtr<NativeImageSkia>, ImageObserver* = 0);
103 BitmapImage(ImageObserver* = 0); 107 BitmapImage(ImageObserver* = 0);
104 108
105 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, CompositeOperator, blink::WebBlendMode) OVERRIDE; 109 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, CompositeOperator, blink::WebBlendMode) OVERRIDE;
106 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, CompositeOperator, blink::WebBlendMode, RespectImageOrientationEnum) OVERRIDE; 110 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec t& srcRect, CompositeOperator, blink::WebBlendMode, RespectImageOrientationEnum) OVERRIDE;
111 virtual void drawPattern(GraphicsContext*, const FloatRect&, const FloatSize &, const FloatPoint& phase, CompositeOperator, const FloatRect&, blink::WebBlend Mode = blink::WebBlendModeNormal, const IntSize& repeatSpacing = IntSize()) OVER RIDE;
107 112
108 size_t currentFrame() const { return m_currentFrame; } 113 size_t currentFrame() const { return m_currentFrame; }
109 size_t frameCount(); 114 size_t frameCount();
110 PassRefPtr<NativeImageSkia> frameAtIndex(size_t); 115 PassRefPtr<NativeImageSkia> frameAtIndex(size_t);
111 bool frameIsCompleteAtIndex(size_t); 116 bool frameIsCompleteAtIndex(size_t);
112 float frameDurationAtIndex(size_t); 117 float frameDurationAtIndex(size_t);
113 bool frameHasAlphaAtIndex(size_t); 118 bool frameHasAlphaAtIndex(size_t);
114 ImageOrientation frameOrientationAtIndex(size_t); 119 ImageOrientation frameOrientationAtIndex(size_t);
115 120
116 // Decodes and caches a frame. Never accessed except internally. 121 // Decodes and caches a frame. Never accessed except internally.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi rst image frame yet from ImageIO. 191 bool m_sizeAvailable : 1; // Whether or not we can obtain the size of the fi rst image frame yet from ImageIO.
187 mutable bool m_hasUniformFrameSize : 1; 192 mutable bool m_hasUniformFrameSize : 1;
188 mutable bool m_haveFrameCount : 1; 193 mutable bool m_haveFrameCount : 1;
189 }; 194 };
190 195
191 DEFINE_IMAGE_TYPE_CASTS(BitmapImage); 196 DEFINE_IMAGE_TYPE_CASTS(BitmapImage);
192 197
193 } 198 }
194 199
195 #endif 200 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698