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 24 matching lines...) Expand all Loading... |
35 #include <wtf/PassRefPtr.h> | 35 #include <wtf/PassRefPtr.h> |
36 #include <wtf/Vector.h> | 36 #include <wtf/Vector.h> |
37 | 37 |
38 #if USE(CG) | 38 #if USE(CG) |
39 | 39 |
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) | |
46 QT_BEGIN_NAMESPACE | |
47 class QGradient; | |
48 QT_END_NAMESPACE | |
49 typedef QGradient* PlatformGradient; | |
50 #elif USE(SKIA) | 45 #elif USE(SKIA) |
51 class SkShader; | 46 class SkShader; |
52 typedef class SkShader* PlatformGradient; | 47 typedef class SkShader* PlatformGradient; |
53 typedef class SkShader* PlatformPattern; | 48 typedef class SkShader* PlatformPattern; |
54 #else | 49 #else |
55 typedef void* PlatformGradient; | 50 typedef void* PlatformGradient; |
56 #endif | 51 #endif |
57 | 52 |
58 namespace WebCore { | 53 namespace WebCore { |
59 | 54 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (m_r1 == r) | 117 if (m_r1 == r) |
123 return; | 118 return; |
124 | 119 |
125 m_r1 = r; | 120 m_r1 = r; |
126 | 121 |
127 invalidateHash(); | 122 invalidateHash(); |
128 } | 123 } |
129 | 124 |
130 float aspectRatio() const { return m_aspectRatio; } | 125 float aspectRatio() const { return m_aspectRatio; } |
131 | 126 |
132 #if OS(WINCE) && !PLATFORM(QT) | 127 #if OS(WINCE) |
133 const Vector<ColorStop, 2>& getStops() const; | 128 const Vector<ColorStop, 2>& getStops() const; |
134 #else | 129 #else |
135 PlatformGradient platformGradient(); | 130 PlatformGradient platformGradient(); |
136 #endif | 131 #endif |
137 | 132 |
138 struct ColorStop { | 133 struct ColorStop { |
139 float stop; | 134 float stop; |
140 float red; | 135 float red; |
141 float green; | 136 float green; |
142 float blue; | 137 float blue; |
143 float alpha; | 138 float alpha; |
144 | 139 |
145 ColorStop() : stop(0), red(0), green(0), blue(0), alpha(0) { } | 140 ColorStop() : stop(0), red(0), green(0), blue(0), alpha(0) { } |
146 ColorStop(float s, float r, float g, float b, float a) : stop(s), re
d(r), green(g), blue(b), alpha(a) { } | 141 ColorStop(float s, float r, float g, float b, float a) : stop(s), re
d(r), green(g), blue(b), alpha(a) { } |
147 }; | 142 }; |
148 | 143 |
149 void setStopsSorted(bool s) { m_stopsSorted = s; } | 144 void setStopsSorted(bool s) { m_stopsSorted = s; } |
150 | 145 |
151 void setSpreadMethod(GradientSpreadMethod); | 146 void setSpreadMethod(GradientSpreadMethod); |
152 GradientSpreadMethod spreadMethod() { return m_spreadMethod; } | 147 GradientSpreadMethod spreadMethod() { return m_spreadMethod; } |
153 void setGradientSpaceTransform(const AffineTransform& gradientSpaceTrans
formation); | 148 void setGradientSpaceTransform(const AffineTransform& gradientSpaceTrans
formation); |
154 // Qt and CG transform the gradient at draw time | 149 // CG transform the gradient at draw time |
155 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransfo
rmation; } | 150 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransfo
rmation; } |
156 | 151 |
157 virtual void fill(GraphicsContext*, const FloatRect&); | 152 virtual void fill(GraphicsContext*, const FloatRect&); |
158 virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& s
rcRect); | 153 virtual void adjustParametersForTiledDrawing(IntSize& size, FloatRect& s
rcRect); |
159 | 154 |
160 void setPlatformGradientSpaceTransform(const AffineTransform& gradientSp
aceTransformation); | 155 void setPlatformGradientSpaceTransform(const AffineTransform& gradientSp
aceTransformation); |
161 | 156 |
162 virtual unsigned hash() const OVERRIDE; | 157 virtual unsigned hash() const OVERRIDE; |
163 void invalidateHash() { m_cachedHash = 0; } | 158 void invalidateHash() { m_cachedHash = 0; } |
164 | 159 |
(...skipping 26 matching lines...) Expand all Loading... |
191 AffineTransform m_gradientSpaceTransformation; | 186 AffineTransform m_gradientSpaceTransformation; |
192 | 187 |
193 mutable unsigned m_cachedHash; | 188 mutable unsigned m_cachedHash; |
194 | 189 |
195 PlatformGradient m_gradient; | 190 PlatformGradient m_gradient; |
196 }; | 191 }; |
197 | 192 |
198 } //namespace | 193 } //namespace |
199 | 194 |
200 #endif | 195 #endif |
OLD | NEW |