| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 float previousOffset = 0.0f; | 143 float previousOffset = 0.0f; |
| 144 for (Node* n = firstChild(); n; n = n->nextSibling()) { | 144 for (Node* n = firstChild(); n; n = n->nextSibling()) { |
| 145 SVGElement* element = n->isSVGElement() ? toSVGElement(n) : 0; | 145 SVGElement* element = n->isSVGElement() ? toSVGElement(n) : 0; |
| 146 if (!element || !element->isGradientStop()) | 146 if (!element || !element->isGradientStop()) |
| 147 continue; | 147 continue; |
| 148 | 148 |
| 149 SVGStopElement* stop = toSVGStopElement(element); | 149 SVGStopElement* stop = toSVGStopElement(element); |
| 150 Color color = stop->stopColorIncludingOpacity(); | 150 Color color = stop->stopColorIncludingOpacity(); |
| 151 | 151 |
| 152 // Figure out right monotonic offset | 152 // Figure out right monotonic offset |
| 153 float offset = stop->offset(); | 153 float offset = stop->offsetCurrentValue(); |
| 154 offset = std::min(std::max(previousOffset, offset), 1.0f); | 154 offset = std::min(std::max(previousOffset, offset), 1.0f); |
| 155 previousOffset = offset; | 155 previousOffset = offset; |
| 156 | 156 |
| 157 // Extract individual channel values | 157 // Extract individual channel values |
| 158 // FIXME: Why doesn't ColorStop take a Color and an offset?? | 158 // FIXME: Why doesn't ColorStop take a Color and an offset?? |
| 159 float r, g, b, a; | 159 float r, g, b, a; |
| 160 color.getRGBA(r, g, b, a); | 160 color.getRGBA(r, g, b, a); |
| 161 | 161 |
| 162 stops.append(Gradient::ColorStop(offset, r, g, b, a)); | 162 stops.append(Gradient::ColorStop(offset, r, g, b, a)); |
| 163 } | 163 } |
| 164 | 164 |
| 165 return stops; | 165 return stops; |
| 166 } | 166 } |
| 167 | 167 |
| 168 } | 168 } |
| OLD | NEW |