diff options
author | Steve Block <steveblock@google.com> | 2010-09-29 17:32:26 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-29 17:35:08 +0100 |
commit | 68513a70bcd92384395513322f1b801e7bf9c729 (patch) | |
tree | 161b50f75a5921d61731bb25e730005994fcec85 /WebCore/platform/graphics/Gradient.cpp | |
parent | fd5c6425ce58eb75211be7718d5dee960842a37e (diff) | |
download | external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.zip external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.gz external_webkit-68513a70bcd92384395513322f1b801e7bf9c729.tar.bz2 |
Merge WebKit at r67908: Initial merge by Git
Change-Id: I43a553e7b3299b28cb6ee8aa035ed70fe342b972
Diffstat (limited to 'WebCore/platform/graphics/Gradient.cpp')
-rw-r--r-- | WebCore/platform/graphics/Gradient.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/WebCore/platform/graphics/Gradient.cpp b/WebCore/platform/graphics/Gradient.cpp index 3d8dfc9..f9427fb 100644 --- a/WebCore/platform/graphics/Gradient.cpp +++ b/WebCore/platform/graphics/Gradient.cpp @@ -117,9 +117,16 @@ void Gradient::sortStopsIfNecessary() if (m_stopsSorted) return; - if (m_stops.size()) - std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); m_stopsSorted = true; + + if (!m_stops.size()) + return; + + // Shortcut for the ideal case (ordered 2-stop gradient) + if (m_stops.size() == 2 && compareStops(*m_stops.begin(), *m_stops.end())) + return; + + std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); } void Gradient::getColor(float value, float* r, float* g, float* b, float* a) const |