Gradient::platformGradient: Vector reserveCapacity -> reserveInitialCapacity
authorbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 May 2013 07:56:09 +0000 (07:56 +0000)
committerbenjamin@webkit.org <benjamin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 11 May 2013 07:56:09 +0000 (07:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=115779

Reviewed by Andreas Kling.

* platform/graphics/cg/GradientCG.cpp:
(WebCore::Gradient::platformGradient): Clang is surprisingly smart at removing
all the branches of this function. Remove two more with reserveInitialCapacity.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@149927 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/cg/GradientCG.cpp

index 141f228..e0da539 100644 (file)
@@ -1,3 +1,14 @@
+2013-05-11  Benjamin Poulain  <benjamin@webkit.org>
+
+        Gradient::platformGradient: Vector reserveCapacity -> reserveInitialCapacity
+        https://bugs.webkit.org/show_bug.cgi?id=115779
+
+        Reviewed by Andreas Kling.
+
+        * platform/graphics/cg/GradientCG.cpp:
+        (WebCore::Gradient::platformGradient): Clang is surprisingly smart at removing
+        all the branches of this function. Remove two more with reserveInitialCapacity.
+
 2013-05-10  Alexey Proskuryakov  <ap@apple.com>
 
         <rdar://problem/13666412> Clean up some edge cases of URL parsing.
index 9308e6f..47d9c7f 100644 (file)
@@ -48,10 +48,10 @@ CGGradientRef Gradient::platformGradient()
     
     const int cReservedStops = 3;
     Vector<CGFloat, 4 * cReservedStops> colorComponents;
-    colorComponents.reserveCapacity(m_stops.size() * 4); // RGBA components per stop
+    colorComponents.reserveInitialCapacity(m_stops.size() * 4); // RGBA components per stop
 
     Vector<CGFloat, cReservedStops> locations;
-    locations.reserveCapacity(m_stops.size());
+    locations.reserveInitialCapacity(m_stops.size());
 
     for (size_t i = 0; i < m_stops.size(); ++i) {
         colorComponents.uncheckedAppend(m_stops[i].red);