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 * Copyright (C) 2013 Google Inc. All rights reserved. | 5 * Copyright (C) 2013 Google Inc. All rights reserved. |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 float blue; | 65 float blue; |
66 float alpha; | 66 float alpha; |
67 | 67 |
68 ColorStop() : stop(0), red(0), green(0), blue(0), alpha(0) { } | 68 ColorStop() : stop(0), red(0), green(0), blue(0), alpha(0) { } |
69 ColorStop(float s, float r, float g, float b, float a) : stop(s), red(r) , green(g), blue(b), alpha(a) { } | 69 ColorStop(float s, float r, float g, float b, float a) : stop(s), red(r) , green(g), blue(b), alpha(a) { } |
70 }; | 70 }; |
71 void addColorStop(const ColorStop&); | 71 void addColorStop(const ColorStop&); |
72 void addColorStop(float, const Color&); | 72 void addColorStop(float, const Color&); |
73 | 73 |
74 bool hasAlpha() const; | 74 bool hasAlpha() const; |
75 bool shaderChanged() const { return m_shaderChanged; } | |
f(malita)
2014/03/04 14:23:47
How about
return !m_shader?
Gradient already t
Stephen Chennney
2014/03/04 14:47:10
Done.
| |
75 | 76 |
76 bool isRadial() const { return m_radial; } | 77 bool isRadial() const { return m_radial; } |
77 bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y( ) && (!m_radial || m_r0 == m_r1); } | 78 bool isZeroSize() const { return m_p0.x() == m_p1.x() && m_p0.y() == m_p1.y( ) && (!m_radial || m_r0 == m_r1); } |
78 | 79 |
79 const FloatPoint& p0() const { return m_p0; } | 80 const FloatPoint& p0() const { return m_p0; } |
80 const FloatPoint& p1() const { return m_p1; } | 81 const FloatPoint& p1() const { return m_p1; } |
81 | 82 |
82 void setP0(const FloatPoint& p) | 83 void setP0(const FloatPoint& p) |
83 { | 84 { |
84 if (m_p0 == p) | 85 if (m_p0 == p) |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformat ion; } | 129 AffineTransform gradientSpaceTransform() { return m_gradientSpaceTransformat ion; } |
129 | 130 |
130 private: | 131 private: |
131 Gradient(const FloatPoint& p0, const FloatPoint& p1); | 132 Gradient(const FloatPoint& p0, const FloatPoint& p1); |
132 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, flo at aspectRatio); | 133 Gradient(const FloatPoint& p0, float r0, const FloatPoint& p1, float r1, flo at aspectRatio); |
133 | 134 |
134 void destroyShader(); | 135 void destroyShader(); |
135 | 136 |
136 void sortStopsIfNecessary(); | 137 void sortStopsIfNecessary(); |
137 | 138 |
138 // Keep any parameters relevant to rendering in sync with the structure in G radient::hash(). | |
139 bool m_radial; | |
140 FloatPoint m_p0; | 139 FloatPoint m_p0; |
141 FloatPoint m_p1; | 140 FloatPoint m_p1; |
142 float m_r0; | 141 float m_r0; |
143 float m_r1; | 142 float m_r1; |
144 float m_aspectRatio; // For elliptical gradient, width / height. | 143 float m_aspectRatio; // For elliptical gradient, width / height. |
145 mutable Vector<ColorStop, 2> m_stops; | 144 mutable Vector<ColorStop, 2> m_stops; |
145 bool m_radial; | |
146 mutable bool m_stopsSorted; | 146 mutable bool m_stopsSorted; |
147 bool m_shaderChanged; | |
f(malita)
2014/03/03 22:46:21
Looks like we can consolidate these three bools +
Stephen Chennney
2014/03/04 13:20:36
I missed the odd one at the bottom. So yes.
Stephen Chennney
2014/03/04 14:47:10
Done.
| |
147 GradientSpreadMethod m_spreadMethod; | 148 GradientSpreadMethod m_spreadMethod; |
148 AffineTransform m_gradientSpaceTransformation; | 149 AffineTransform m_gradientSpaceTransformation; |
149 | 150 |
150 bool m_drawInPMColorSpace; | 151 bool m_drawInPMColorSpace; |
151 | 152 |
152 RefPtr<SkShader> m_gradient; | 153 RefPtr<SkShader> m_gradient; |
153 }; | 154 }; |
154 | 155 |
155 } // namespace WebCore | 156 } // namespace WebCore |
156 | 157 |
157 #endif | 158 #endif |
OLD | NEW |