OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (RenderObject* object = renderer()) | 118 if (RenderObject* object = renderer()) |
119 object->setNeedsLayout(); | 119 object->setNeedsLayout(); |
120 } | 120 } |
121 | 121 |
122 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() | 122 Vector<Gradient::ColorStop> SVGGradientElement::buildStops() |
123 { | 123 { |
124 Vector<Gradient::ColorStop> stops; | 124 Vector<Gradient::ColorStop> stops; |
125 | 125 |
126 float previousOffset = 0.0f; | 126 float previousOffset = 0.0f; |
127 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { | 127 for (SVGStopElement* stop = Traversal<SVGStopElement>::firstChild(*this); st
op; stop = Traversal<SVGStopElement>::nextSibling(*stop)) { |
128 Color color = stop->stopColorIncludingOpacity(); | |
129 | |
130 // Figure out right monotonic offset | 128 // Figure out right monotonic offset |
131 float offset = stop->offset()->currentValue()->value(); | 129 float offset = stop->offset()->currentValue()->value(); |
132 offset = std::min(std::max(previousOffset, offset), 1.0f); | 130 offset = std::min(std::max(previousOffset, offset), 1.0f); |
133 previousOffset = offset; | 131 previousOffset = offset; |
134 | 132 |
135 // Extract individual channel values | 133 stops.append(Gradient::ColorStop(offset, stop->stopColorIncludingOpacity
())); |
136 // FIXME: Why doesn't ColorStop take a Color and an offset?? | |
137 float r, g, b, a; | |
138 color.getRGBA(r, g, b, a); | |
139 | |
140 stops.append(Gradient::ColorStop(offset, r, g, b, a)); | |
141 } | 134 } |
142 | 135 |
143 return stops; | 136 return stops; |
144 } | 137 } |
145 | 138 |
146 } | 139 } |
OLD | NEW |