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 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 friend class GraphicsContext; | 81 friend class GraphicsContext; |
82 | 82 |
83 public: | 83 public: |
84 virtual ~Image(); | 84 virtual ~Image(); |
85 | 85 |
86 static PassRefPtr<Image> create(ImageObserver* = 0); | 86 static PassRefPtr<Image> create(ImageObserver* = 0); |
87 static PassRefPtr<Image> loadPlatformResource(const char* name); | 87 static PassRefPtr<Image> loadPlatformResource(const char* name); |
88 static bool supportsType(const String&); | 88 static bool supportsType(const String&); |
89 | 89 |
90 virtual bool isBitmapImage() const { return false; } | 90 virtual bool isBitmapImage() const { return false; } |
| 91 virtual bool currentFrameHasAlpha() { return false; } |
91 | 92 |
92 // Derived classes should override this if they can assure that | 93 // Derived classes should override this if they can assure that |
93 // the image contains only resources from its own security origin. | 94 // the image contains only resources from its own security origin. |
94 virtual bool hasSingleSecurityOrigin() const { return false; } | 95 virtual bool hasSingleSecurityOrigin() const { return false; } |
95 | 96 |
96 static Image* nullImage(); | 97 static Image* nullImage(); |
97 bool isNull() const { return size().isEmpty(); } | 98 bool isNull() const { return size().isEmpty(); } |
98 | 99 |
99 // These are only used for SVGImage right now | 100 // These are only used for SVGImage right now |
100 virtual void setContainerSize(const IntSize&) { } | 101 virtual void setContainerSize(const IntSize&) { } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 #endif | 151 #endif |
151 | 152 |
152 #if PLATFORM(GTK) | 153 #if PLATFORM(GTK) |
153 virtual GdkPixbuf* getGdkPixbuf() { return 0; } | 154 virtual GdkPixbuf* getGdkPixbuf() { return 0; } |
154 static PassRefPtr<Image> loadPlatformThemeIcon(const char* name, int size); | 155 static PassRefPtr<Image> loadPlatformThemeIcon(const char* name, int size); |
155 #endif | 156 #endif |
156 | 157 |
157 virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const A
ffineTransform& patternTransform, | 158 virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const A
ffineTransform& patternTransform, |
158 const FloatPoint& phase, ColorSpace styleColorSpace
, CompositeOperator, const FloatRect& destRect); | 159 const FloatPoint& phase, ColorSpace styleColorSpace
, CompositeOperator, const FloatRect& destRect); |
159 | 160 |
| 161 #if !ASSERT_DISABLED |
| 162 virtual bool notSolidColor() { return true; } |
| 163 #endif |
| 164 |
160 protected: | 165 protected: |
161 Image(ImageObserver* = 0); | 166 Image(ImageObserver* = 0); |
162 | 167 |
163 static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, c
onst Color&, ColorSpace styleColorSpace, CompositeOperator); | 168 static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, c
onst Color&, ColorSpace styleColorSpace, CompositeOperator); |
164 | 169 |
165 // The ColorSpace parameter will only be used for untagged images. | 170 // The ColorSpace parameter will only be used for untagged images. |
166 #if PLATFORM(WIN) | 171 #if PLATFORM(WIN) |
167 virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect&
dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator)
{ } | 172 virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect&
dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator)
{ } |
168 #endif | 173 #endif |
169 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec
t& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0; | 174 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec
t& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0; |
170 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOpera
tor); | 175 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOpera
tor); |
171 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOp
erator); | 176 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOp
erator); |
172 | 177 |
173 // Supporting tiled drawing | 178 // Supporting tiled drawing |
174 virtual bool mayFillWithSolidColor() { return false; } | 179 virtual bool mayFillWithSolidColor() { return false; } |
175 virtual Color solidColor() const { return Color(); } | 180 virtual Color solidColor() const { return Color(); } |
176 | 181 |
177 private: | 182 private: |
178 RefPtr<SharedBuffer> m_data; // The encoded raw data for the image. | 183 RefPtr<SharedBuffer> m_data; // The encoded raw data for the image. |
179 ImageObserver* m_imageObserver; | 184 ImageObserver* m_imageObserver; |
180 }; | 185 }; |
181 | 186 |
182 } | 187 } |
183 | 188 |
184 #endif | 189 #endif |
OLD | NEW |