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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer;
} | 112 void setImageObserver(ImageObserver* observer) { m_imageObserver = observer;
} |
113 | 113 |
114 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; | 114 enum TileRule { StretchTile, RoundTile, SpaceTile, RepeatTile }; |
115 | 115 |
116 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() { return nu
llptr; } | 116 virtual PassRefPtr<NativeImageSkia> nativeImageForCurrentFrame() { return nu
llptr; } |
117 | 117 |
118 virtual PassRefPtr<Image> imageForDefaultFrame(); | 118 virtual PassRefPtr<Image> imageForDefaultFrame(); |
119 | 119 |
120 virtual void drawPattern(GraphicsContext*, const FloatRect&, | 120 virtual void drawPattern(GraphicsContext*, const FloatRect&, |
121 const FloatSize&, const FloatPoint& phase, CompositeOperator, | 121 const FloatSize&, const FloatPoint& phase, CompositeOperator, |
122 const FloatRect&, blink::WebBlendMode = blink::WebBlendModeNormal, const
IntSize& repeatSpacing = IntSize()); | 122 const FloatRect&, WebBlendMode = WebBlendModeNormal, const IntSize& repe
atSpacing = IntSize()); |
123 | 123 |
124 #if ENABLE(ASSERT) | 124 #if ENABLE(ASSERT) |
125 virtual bool notSolidColor() { return true; } | 125 virtual bool notSolidColor() { return true; } |
126 #endif | 126 #endif |
127 | 127 |
128 protected: | 128 protected: |
129 Image(ImageObserver* = 0); | 129 Image(ImageObserver* = 0); |
130 | 130 |
131 static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, c
onst Color&, CompositeOperator); | 131 static void fillWithSolidColor(GraphicsContext*, const FloatRect& dstRect, c
onst Color&, CompositeOperator); |
132 static FloatRect adjustForNegativeSize(const FloatRect&); // A helper method
for translating negative width and height values. | 132 static FloatRect adjustForNegativeSize(const FloatRect&); // A helper method
for translating negative width and height values. |
133 | 133 |
134 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec
t& srcRect, CompositeOperator, blink::WebBlendMode) = 0; | 134 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec
t& srcRect, CompositeOperator, WebBlendMode) = 0; |
135 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec
t& srcRect, CompositeOperator, blink::WebBlendMode, RespectImageOrientationEnum)
; | 135 virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRec
t& srcRect, CompositeOperator, WebBlendMode, RespectImageOrientationEnum); |
136 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, | 136 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint&
srcPoint, const FloatSize& tileSize, |
137 CompositeOperator, blink::WebBlendMode, const IntSize& repeatSpacing); | 137 CompositeOperator, WebBlendMode, const IntSize& repeatSpacing); |
138 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, Compo
siteOperator); | 138 void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect&
srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, Compo
siteOperator); |
139 | 139 |
140 // Supporting tiled drawing | 140 // Supporting tiled drawing |
141 virtual bool mayFillWithSolidColor() { return false; } | 141 virtual bool mayFillWithSolidColor() { return false; } |
142 virtual Color solidColor() const { return Color(); } | 142 virtual Color solidColor() const { return Color(); } |
143 | 143 |
144 private: | 144 private: |
145 RefPtr<SharedBuffer> m_encodedImageData; | 145 RefPtr<SharedBuffer> m_encodedImageData; |
146 ImageObserver* m_imageObserver; | 146 ImageObserver* m_imageObserver; |
147 }; | 147 }; |
148 | 148 |
149 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ | 149 #define DEFINE_IMAGE_TYPE_CASTS(typeName) \ |
150 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) | 150 DEFINE_TYPE_CASTS(typeName, Image, image, image->is##typeName(), image.is##t
ypeName()) |
151 | 151 |
152 } | 152 } // namespace blink |
153 | 153 |
154 #endif | 154 #endif |
OLD | NEW |