Reversing a GlyphBuffer needlessly queries its size multiple times
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Oct 2012 18:18:50 +0000 (18:18 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 5 Oct 2012 18:18:50 +0000 (18:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98530

Reviewed by Simon Fraser.

No new tests because there is no change in behavior.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/FontFastPath.cpp:
(WebCore::Font::getGlyphsAndAdvancesForSimpleText): Replaced the condition
(i < glyphBuffer.size() / 2) with the equivalent test (i < end).
* platform/graphics/mac/FontComplexTextMac.cpp:
(WebCore::Font::getGlyphsAndAdvancesForComplexText): Ditto.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontFastPath.cpp
Source/WebCore/platform/graphics/mac/FontComplexTextMac.cpp

index 013bb2e..c8a01bf 100644 (file)
@@ -1,3 +1,19 @@
+2012-10-05  Dan Bernstein  <mitz@apple.com>
+
+        Reversing a GlyphBuffer needlessly queries its size multiple times
+        https://bugs.webkit.org/show_bug.cgi?id=98530
+
+        Reviewed by Simon Fraser.
+
+        No new tests because there is no change in behavior.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/FontFastPath.cpp:
+        (WebCore::Font::getGlyphsAndAdvancesForSimpleText): Replaced the condition
+        (i < glyphBuffer.size() / 2) with the equivalent test (i < end).
+        * platform/graphics/mac/FontComplexTextMac.cpp:
+        (WebCore::Font::getGlyphsAndAdvancesForComplexText): Ditto.
+
 2012-10-05  José Dapena Paz  <jdapena@igalia.com>
 
         [GTK] Add support for creating EGL contexts
index e369b5d..3975ff7 100644 (file)
@@ -350,7 +350,7 @@ float Font::getGlyphsAndAdvancesForSimpleText(const TextRun& run, int from, int
         initialAdvance = beforeWidth;
 
     if (run.rtl()) {
-        for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end)
+        for (int i = 0, end = glyphBuffer.size() - 1; i < end; ++i, --end)
             glyphBuffer.swap(i, end);
     }
 
index 3526aae..af225af 100644 (file)
@@ -91,7 +91,7 @@ float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int
 
     if (run.rtl()) {
         initialAdvance = controller.totalWidth() + controller.finalRoundingWidth() - afterWidth;
-        for (int i = 0, end = glyphBuffer.size() - 1; i < glyphBuffer.size() / 2; ++i, --end)
+        for (int i = 0, end = glyphBuffer.size() - 1; i < end; ++i, --end)
             glyphBuffer.swap(i, end);
     } else
         initialAdvance = beforeWidth;