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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 138 |
139 // Typically the ImageResource that owns us. | 139 // Typically the ImageResource that owns us. |
140 ImageObserver* imageObserver() const { return m_imageObserver; } | 140 ImageObserver* imageObserver() const { return m_imageObserver; } |
141 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer;
} | 141 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer;
} |
142 | 142 |
143 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; | 143 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; |
144 | 144 |
145 virtual PassRefPtr<SkImage> imageForCurrentFrame() = 0; | 145 virtual PassRefPtr<SkImage> imageForCurrentFrame() = 0; |
146 virtual PassRefPtr<Image> imageForDefaultFrame(); | 146 virtual PassRefPtr<Image> imageForDefaultFrame(); |
147 | 147 |
148 virtual void drawPattern(GraphicsContext*, const FloatRect&, | 148 virtual void drawPattern(GraphicsContext&, const FloatRect&, |
149 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, | 149 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, |
150 const FloatRect&, const FloatSize& repeatSpacing = FloatSize()); | 150 const FloatRect&, const FloatSize& repeatSpacing = FloatSize()); |
151 | 151 |
152 enum ImageClampingMode { | 152 enum ImageClampingMode { |
153 ClampImageToSourceRect, | 153 ClampImageToSourceRect, |
154 DoNotClampImageToSourceRect | 154 DoNotClampImageToSourceRect |
155 }; | 155 }; |
156 | 156 |
157 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const
FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0; | 157 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const
FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0; |
158 | 158 |
159 protected: | 159 protected: |
160 Image(ImageObserver* = 0); | 160 Image(ImageObserver* = 0); |
161 | 161 |
162 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, | 162 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, |
163 SkXfermode::Mode, const FloatSize& repeatSpacing); | 163 SkXfermode::Mode, const FloatSize& repeatSpacing); |
164 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe
rmode::Mode); | 164 void drawTiled(GraphicsContext&, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe
rmode::Mode); |
165 | 165 |
166 private: | 166 private: |
167 RefPtr<SharedBuffer> m_encodedImageData; | 167 RefPtr<SharedBuffer> m_encodedImageData; |
168 ImageObserver* m_imageObserver; | 168 ImageObserver* m_imageObserver; |
169 }; | 169 }; |
170 | 170 |
171 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 171 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
172 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) | 172 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
175 | 175 |
176 #endif | 176 #endif |
OLD | NEW |