| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void Gradient::sortStopsIfNecessary() | 117 void Gradient::sortStopsIfNecessary() |
| 118 { | 118 { |
| 119 if (m_stopsSorted) | 119 if (m_stopsSorted) |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 m_stopsSorted = true; | 122 m_stopsSorted = true; |
| 123 | 123 |
| 124 if (!m_stops.size()) | 124 if (!m_stops.size()) |
| 125 return; | 125 return; |
| 126 | 126 |
| 127 // Shortcut for the ideal case (ordered 2-stop gradient) | |
| 128 if (m_stops.size() == 2 && compareStops(*m_stops.begin(), *m_stops.end())) | |
| 129 return; | |
| 130 | |
| 131 std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); | 127 std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); |
| 132 } | 128 } |
| 133 | 129 |
| 134 void Gradient::getColor(float value, float* r, float* g, float* b, float* a) con
st | 130 void Gradient::getColor(float value, float* r, float* g, float* b, float* a) con
st |
| 135 { | 131 { |
| 136 ASSERT(value >= 0); | 132 ASSERT(value >= 0); |
| 137 ASSERT(value <= 1); | 133 ASSERT(value <= 1); |
| 138 | 134 |
| 139 if (m_stops.isEmpty()) { | 135 if (m_stops.isEmpty()) { |
| 140 *r = 0; | 136 *r = 0; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 218 } |
| 223 | 219 |
| 224 #if !USE(SKIA) && !USE(CAIRO) | 220 #if !USE(SKIA) && !USE(CAIRO) |
| 225 void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&) | 221 void Gradient::setPlatformGradientSpaceTransform(const AffineTransform&) |
| 226 { | 222 { |
| 227 } | 223 } |
| 228 #endif | 224 #endif |
| 229 | 225 |
| 230 | 226 |
| 231 } //namespace | 227 } //namespace |
| OLD | NEW |