| 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 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 if (m_stops.isEmpty()) { | 79 if (m_stops.isEmpty()) { |
| 80 m_stopsSorted = true; | 80 m_stopsSorted = true; |
| 81 } else { | 81 } else { |
| 82 m_stopsSorted = m_stopsSorted && compareStops(m_stops.back(), stop); | 82 m_stopsSorted = m_stopsSorted && compareStops(m_stops.back(), stop); |
| 83 } | 83 } |
| 84 | 84 |
| 85 m_stops.push_back(stop); | 85 m_stops.push_back(stop); |
| 86 m_cachedShader.reset(); | 86 m_cachedShader.reset(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void Gradient::addColorStops(const Vector<Gradient::ColorStop>& stops) { |
| 90 for (const auto& stop : stops) |
| 91 addColorStop(stop); |
| 92 } |
| 93 |
| 89 void Gradient::sortStopsIfNecessary() { | 94 void Gradient::sortStopsIfNecessary() { |
| 90 if (m_stopsSorted) | 95 if (m_stopsSorted) |
| 91 return; | 96 return; |
| 92 | 97 |
| 93 m_stopsSorted = true; | 98 m_stopsSorted = true; |
| 94 | 99 |
| 95 if (!m_stops.size()) | 100 if (!m_stops.size()) |
| 96 return; | 101 return; |
| 97 | 102 |
| 98 std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); | 103 std::stable_sort(m_stops.begin(), m_stops.end(), compareStops); |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 if (!m_cachedShader || localMatrix != m_cachedShader->getLocalMatrix()) | 259 if (!m_cachedShader || localMatrix != m_cachedShader->getLocalMatrix()) |
| 255 m_cachedShader = createShader(localMatrix); | 260 m_cachedShader = createShader(localMatrix); |
| 256 | 261 |
| 257 flags.setShader(m_cachedShader); | 262 flags.setShader(m_cachedShader); |
| 258 | 263 |
| 259 // Legacy behavior: gradients are always dithered. | 264 // Legacy behavior: gradients are always dithered. |
| 260 flags.setDither(true); | 265 flags.setDither(true); |
| 261 } | 266 } |
| 262 | 267 |
| 263 } // namespace blink | 268 } // namespace blink |
| OLD | NEW |