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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 class SkBitmap; | 43 class SkBitmap; |
44 class SkImage; | 44 class SkImage; |
45 | 45 |
46 namespace blink { | 46 namespace blink { |
47 | 47 |
48 class FloatPoint; | 48 class FloatPoint; |
49 class FloatRect; | 49 class FloatRect; |
50 class FloatSize; | 50 class FloatSize; |
51 class GraphicsContext; | 51 class GraphicsContext; |
| 52 class Image; |
| 53 class KURL; |
52 class Length; | 54 class Length; |
53 class SharedBuffer; | 55 class SharedBuffer; |
54 class Image; | |
55 | 56 |
56 // This class gets notified when an image creates or destroys decoded frames and
when it advances animation frames. | 57 // This class gets notified when an image creates or destroys decoded frames and
when it advances animation frames. |
57 class ImageObserver; | 58 class ImageObserver; |
58 | 59 |
59 class PLATFORM_EXPORT Image : public RefCounted<Image> { | 60 class PLATFORM_EXPORT Image : public RefCounted<Image> { |
60 friend class GeneratedImage; | 61 friend class GeneratedImage; |
61 friend class CrossfadeGeneratedImage; | 62 friend class CrossfadeGeneratedImage; |
62 friend class GradientGeneratedImage; | 63 friend class GradientGeneratedImage; |
63 friend class GraphicsContext; | 64 friend class GraphicsContext; |
64 | 65 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer;
} | 127 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer;
} |
127 | 128 |
128 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; | 129 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; |
129 | 130 |
130 bool deprecatedBitmapForCurrentFrame(SkBitmap*) WARN_UNUSED_RETURN; | 131 bool deprecatedBitmapForCurrentFrame(SkBitmap*) WARN_UNUSED_RETURN; |
131 | 132 |
132 virtual PassRefPtr<SkImage> imageForCurrentFrame() = 0; | 133 virtual PassRefPtr<SkImage> imageForCurrentFrame() = 0; |
133 virtual PassRefPtr<Image> imageForDefaultFrame(); | 134 virtual PassRefPtr<Image> imageForDefaultFrame(); |
134 | 135 |
135 virtual void drawPattern(GraphicsContext*, const FloatRect&, | 136 virtual void drawPattern(GraphicsContext*, const FloatRect&, |
136 const FloatSize&, const FloatPoint& phase, SkXfermode::Mode, | 137 const FloatSize&, const FloatPoint& phase, const KURL&, |
137 const FloatRect&, const IntSize& repeatSpacing = IntSize()); | 138 SkXfermode::Mode, const FloatRect&, const IntSize& repeatSpacing = IntSi
ze()); |
138 | 139 |
139 enum ImageClampingMode { | 140 enum ImageClampingMode { |
140 ClampImageToSourceRect, | 141 ClampImageToSourceRect, |
141 DoNotClampImageToSourceRect | 142 DoNotClampImageToSourceRect |
142 }; | 143 }; |
143 | 144 |
144 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const
FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode) = 0; | 145 virtual void draw(SkCanvas*, const SkPaint&, const FloatRect& dstRect, const
FloatRect& srcRect, RespectImageOrientationEnum, ImageClampingMode, const KURL&
) = 0; |
145 | 146 |
146 protected: | 147 protected: |
147 Image(ImageObserver* = 0); | 148 Image(ImageObserver* = 0); |
148 | 149 |
149 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, | 150 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, |
150 SkXfermode::Mode, const IntSize& repeatSpacing); | 151 const KURL&, SkXfermode::Mode, const IntSize& repeatSpacing); |
151 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, SkXfe
rmode::Mode); | 152 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, |
| 153 const KURL&, TileRule hRule, TileRule vRule, SkXfermode::Mode); |
152 | 154 |
153 private: | 155 private: |
154 RefPtr<SharedBuffer> m_encodedImageData; | 156 RefPtr<SharedBuffer> m_encodedImageData; |
155 ImageObserver* m_imageObserver; | 157 ImageObserver* m_imageObserver; |
156 }; | 158 }; |
157 | 159 |
158 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 160 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
159 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) | 161 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) |
160 | 162 |
161 } // namespace blink | 163 } // namespace blink |
162 | 164 |
163 #endif | 165 #endif |
OLD | NEW |