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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 return a.stop < b.stop; | 74 return a.stop < b.stop; |
75 } | 75 } |
76 | 76 |
77 void Gradient::addColorStop(const Gradient::ColorStop& stop) { | 77 void Gradient::addColorStop(const Gradient::ColorStop& stop) { |
78 if (m_stops.isEmpty()) { | 78 if (m_stops.isEmpty()) { |
79 m_stopsSorted = true; | 79 m_stopsSorted = true; |
80 } else { | 80 } else { |
81 m_stopsSorted = m_stopsSorted && compareStops(m_stops.back(), stop); | 81 m_stopsSorted = m_stopsSorted && compareStops(m_stops.back(), stop); |
82 } | 82 } |
83 | 83 |
84 m_stops.append(stop); | 84 m_stops.push_back(stop); |
85 m_cachedShader.reset(); | 85 m_cachedShader.reset(); |
86 } | 86 } |
87 | 87 |
88 void Gradient::sortStopsIfNecessary() { | 88 void Gradient::sortStopsIfNecessary() { |
89 if (m_stopsSorted) | 89 if (m_stopsSorted) |
90 return; | 90 return; |
91 | 91 |
92 m_stopsSorted = true; | 92 m_stopsSorted = true; |
93 | 93 |
94 if (!m_stops.size()) | 94 if (!m_stops.size()) |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (!m_cachedShader || localMatrix != m_cachedShader->getLocalMatrix()) | 253 if (!m_cachedShader || localMatrix != m_cachedShader->getLocalMatrix()) |
254 m_cachedShader = createShader(localMatrix); | 254 m_cachedShader = createShader(localMatrix); |
255 | 255 |
256 paint.setShader(m_cachedShader); | 256 paint.setShader(m_cachedShader); |
257 | 257 |
258 // Legacy behavior: gradients are always dithered. | 258 // Legacy behavior: gradients are always dithered. |
259 paint.setDither(true); | 259 paint.setDither(true); |
260 } | 260 } |
261 | 261 |
262 } // namespace blink | 262 } // namespace blink |
OLD | NEW |