OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
4 * Copyright (C) 2008 Torch Mobile, Inc. | 4 * Copyright (C) 2008 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 29 matching lines...) Expand all Loading... |
40 typedef struct CGContext* CGContextRef; | 40 typedef struct CGContext* CGContextRef; |
41 | 41 |
42 typedef struct CGGradient* CGGradientRef; | 42 typedef struct CGGradient* CGGradientRef; |
43 typedef CGGradientRef PlatformGradient; | 43 typedef CGGradientRef PlatformGradient; |
44 | 44 |
45 #elif PLATFORM(QT) | 45 #elif PLATFORM(QT) |
46 QT_BEGIN_NAMESPACE | 46 QT_BEGIN_NAMESPACE |
47 class QGradient; | 47 class QGradient; |
48 QT_END_NAMESPACE | 48 QT_END_NAMESPACE |
49 typedef QGradient* PlatformGradient; | 49 typedef QGradient* PlatformGradient; |
50 #elif USE(CAIRO) | |
51 typedef struct _cairo_pattern cairo_pattern_t; | |
52 typedef cairo_pattern_t* PlatformGradient; | |
53 #elif USE(SKIA) | 50 #elif USE(SKIA) |
54 class SkShader; | 51 class SkShader; |
55 typedef class SkShader* PlatformGradient; | 52 typedef class SkShader* PlatformGradient; |
56 typedef class SkShader* PlatformPattern; | 53 typedef class SkShader* PlatformPattern; |
57 #elif PLATFORM(WX) | 54 #elif PLATFORM(WX) |
58 class wxGraphicsBrush; | 55 class wxGraphicsBrush; |
59 typedef wxGraphicsBrush* PlatformGradient; | 56 typedef wxGraphicsBrush* PlatformGradient; |
60 #else | 57 #else |
61 typedef void* PlatformGradient; | 58 typedef void* PlatformGradient; |
62 #endif | 59 #endif |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& s
rcRect); | 161 virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& s
rcRect); |
165 | 162 |
166 void setPlatformGradientSpaceTransform(const AffineTransform& gradientSp
aceTransformation); | 163 void setPlatformGradientSpaceTransform(const AffineTransform& gradientSp
aceTransformation); |
167 | 164 |
168 virtual unsigned hash() const OVERRIDE; | 165 virtual unsigned hash() const OVERRIDE; |
169 void invalidateHash() { m_cachedHash = 0; } | 166 void invalidateHash() { m_cachedHash = 0; } |
170 | 167 |
171 #if USE(CG) | 168 #if USE(CG) |
172 void paint(CGContextRef); | 169 void paint(CGContextRef); |
173 void paint(GraphicsContext*); | 170 void paint(GraphicsContext*); |
174 #elif USE(CAIRO) | |
175 PlatformGradient platformGradient(float globalAlpha); | |
176 #endif | 171 #endif |
177 | 172 |
178 private: | 173 private: |
179 Gradient(const FloatPoint& p0, const FloatPoint& p1); | 174 Gradient(const FloatPoint& p0, const FloatPoint& p1); |
180 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1,
float aspectRatio); | 175 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1,
float aspectRatio); |
181 | 176 |
182 void platformInit() { m_gradient = 0; } | 177 void platformInit() { m_gradient = 0; } |
183 void platformDestroy(); | 178 void platformDestroy(); |
184 | 179 |
185 int findStop(float value) const; | 180 int findStop(float value) const; |
186 void sortStopsIfNecessary(); | 181 void sortStopsIfNecessary(); |
187 | 182 |
188 // Keep any parameters relevant to rendering in sync with the structure
in Gradient::hash(). | 183 // Keep any parameters relevant to rendering in sync with the structure
in Gradient::hash(). |
189 bool m_radial; | 184 bool m_radial; |
190 FloatPoint m_p0; | 185 FloatPoint m_p0; |
191 FloatPoint m_p1; | 186 FloatPoint m_p1; |
192 float m_r0; | 187 float m_r0; |
193 float m_r1; | 188 float m_r1; |
194 float m_aspectRatio; // For elliptical gradient, width / height. | 189 float m_aspectRatio; // For elliptical gradient, width / height. |
195 mutable Vector<ColorStop, 2> m_stops; | 190 mutable Vector<ColorStop, 2> m_stops; |
196 mutable bool m_stopsSorted; | 191 mutable bool m_stopsSorted; |
197 mutable int m_lastStop; | 192 mutable int m_lastStop; |
198 GradientSpreadMethod m_spreadMethod; | 193 GradientSpreadMethod m_spreadMethod; |
199 AffineTransform m_gradientSpaceTransformation; | 194 AffineTransform m_gradientSpaceTransformation; |
200 | 195 |
201 mutable unsigned m_cachedHash; | 196 mutable unsigned m_cachedHash; |
202 | 197 |
203 PlatformGradient m_gradient; | 198 PlatformGradient m_gradient; |
204 | |
205 #if USE(CAIRO) | |
206 float m_platformGradientAlpha; | |
207 #endif | |
208 | |
209 }; | 199 }; |
210 | 200 |
211 } //namespace | 201 } //namespace |
212 | 202 |
213 #endif | 203 #endif |
OLD | NEW |