Title: [158800] trunk/Source/WebCore
Revision
158800
Author
[email protected]
Date
2013-11-06 16:00:14 -0800 (Wed, 06 Nov 2013)

Log Message

Cleanup FontMac.mm
https://bugs.webkit.org/show_bug.cgi?id=123928

Reviewed by Andy Estes.

* platform/graphics/mac/FontMac.mm:
(WebCore::showGlyphsWithAdvances): Inline the value of variable isVertical as we
reference it exactly once and its value is sufficiently clear.
(WebCore::Font::drawGlyphs): Remove default case in switch block so that the compiler
checks that all cases are covered. Move definition of platformData to the top of the
function and use it whenever we want to access the platform font data

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (158799 => 158800)


--- trunk/Source/WebCore/ChangeLog	2013-11-06 23:53:02 UTC (rev 158799)
+++ trunk/Source/WebCore/ChangeLog	2013-11-07 00:00:14 UTC (rev 158800)
@@ -1,3 +1,17 @@
+2013-11-06  Daniel Bates  <[email protected]>
+
+        Cleanup FontMac.mm
+        https://bugs.webkit.org/show_bug.cgi?id=123928
+
+        Reviewed by Andy Estes.
+
+        * platform/graphics/mac/FontMac.mm:
+        (WebCore::showGlyphsWithAdvances): Inline the value of variable isVertical as we
+        reference it exactly once and its value is sufficiently clear.
+        (WebCore::Font::drawGlyphs): Remove default case in switch block so that the compiler
+        checks that all cases are covered. Move definition of platformData to the top of the
+        function and use it whenever we want to access the platform font data
+
 2013-11-06  Brent Fulgham  <[email protected]>
 
         [WebGL] We should not allow generateMipMap on compressed textures

Modified: trunk/Source/WebCore/platform/graphics/mac/FontMac.mm (158799 => 158800)


--- trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2013-11-06 23:53:02 UTC (rev 158799)
+++ trunk/Source/WebCore/platform/graphics/mac/FontMac.mm	2013-11-07 00:00:14 UTC (rev 158800)
@@ -71,8 +71,7 @@
             positions[i].y = positions[i - 1].y + advance.height;
         }
     }
-    bool isVertical = font->platformData().orientation() == Vertical;
-    if (isVertical) {
+    if (platformData.orientation() == Vertical) {
         CGAffineTransform savedMatrix;
         CGAffineTransform rotateLeftTransform = CGAffineTransformMake(0, -1, 1, 0, 0, 0);
         savedMatrix = CGContextGetTextMatrix(context);
@@ -109,13 +108,14 @@
 
 void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) const
 {
-    if (!font->platformData().size())
+    const FontPlatformData& platformData = font->platformData();
+    if (!platformData.size())
         return;
 
     CGContextRef cgContext = context->platformContext();
 
-    bool shouldSmoothFonts = true;
-    bool changeFontSmoothing = false;
+    bool shouldSmoothFonts;
+    bool changeFontSmoothing;
     
     switch(fontDescription().fontSmoothing()) {
     case Antialiased: {
@@ -137,11 +137,10 @@
         break;
     }
     case AutoSmoothing: {
-        // For the AutoSmooth case, don't do anything! Keep the default settings.
-        break; 
+        shouldSmoothFonts = true;
+        changeFontSmoothing = false;
+        break;
     }
-    default: 
-        ASSERT_NOT_REACHED();
     }
     
     if (!shouldUseSmoothing()) {
@@ -155,7 +154,6 @@
         CGContextSetShouldSmoothFonts(cgContext, shouldSmoothFonts);
     }
 
-    const FontPlatformData& platformData = font->platformData();
     NSFont* drawFont;
     if (!isPrinterFont()) {
         drawFont = [platformData.font() screenFont];
@@ -179,7 +177,7 @@
     matrix.d = -matrix.d;
     if (platformData.m_syntheticOblique) {
         static float obliqueSkew = tanf(SYNTHETIC_OBLIQUE_ANGLE * piFloat / 180);
-        if (font->platformData().orientation() == Vertical)
+        if (platformData.orientation() == Vertical)
             matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, obliqueSkew, 0, 1, 0, 0));
         else
             matrix = CGAffineTransformConcat(matrix, CGAffineTransformMake(1, 0, -obliqueSkew, 1, 0, 0));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to