Title: [95777] trunk/Source/WebCore
Revision
95777
Author
[email protected]
Date
2011-09-22 20:00:38 -0700 (Thu, 22 Sep 2011)

Log Message

Refactor checks for antialiasing lines to share a single function
https://bugs.webkit.org/show_bug.cgi?id=68666

Reviewed by Dan Bernstein.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintColumnRules): Call shouldAntialiasLines.
* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder): Ditto.
(WebCore::RenderBoxModelObject::shouldAntialiasLines): Added.
* rendering/RenderBoxModelObject.h: Added shouldAntialiasLines function.
* rendering/RenderInline.cpp:
(WebCore::RenderInline::paintOutlineForLine): Call shouldAntialiasLines.
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintCollapsedBorder): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (95776 => 95777)


--- trunk/Source/WebCore/ChangeLog	2011-09-23 02:41:55 UTC (rev 95776)
+++ trunk/Source/WebCore/ChangeLog	2011-09-23 03:00:38 UTC (rev 95777)
@@ -1,3 +1,21 @@
+2011-09-22  Darin Adler  <[email protected]>
+
+        Refactor checks for antialiasing lines to share a single function
+        https://bugs.webkit.org/show_bug.cgi?id=68666
+
+        Reviewed by Dan Bernstein.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintColumnRules): Call shouldAntialiasLines.
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBorder): Ditto.
+        (WebCore::RenderBoxModelObject::shouldAntialiasLines): Added.
+        * rendering/RenderBoxModelObject.h: Added shouldAntialiasLines function.
+        * rendering/RenderInline.cpp:
+        (WebCore::RenderInline::paintOutlineForLine): Call shouldAntialiasLines.
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintCollapsedBorder): Ditto.
+
 2011-09-22  Antoine Labour  <[email protected]>
 
         Remove unused members from LayerChromium.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (95776 => 95777)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-09-23 02:41:55 UTC (rev 95776)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2011-09-23 03:00:38 UTC (rev 95777)
@@ -2342,8 +2342,7 @@
     LayoutUnit ruleAdd = logicalLeftOffsetForContent();
     LayoutUnit ruleLogicalLeft = style()->isLeftToRightDirection() ? 0 : contentLogicalWidth();
 
-    const AffineTransform& currentCTM = paintInfo.context->getCTM();
-    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
+    bool antialias = shouldAntialiasLines(paintInfo.context);
 
     for (unsigned i = 0; i < colCount; i++) {
         LayoutRect colRect = columnRectAt(colInfo, i);

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (95776 => 95777)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-09-23 02:41:55 UTC (rev 95776)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2011-09-23 03:00:38 UTC (rev 95777)
@@ -1537,10 +1537,6 @@
     RoundedRect outerBorder = style->getRoundedBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
     RoundedRect innerBorder = style->getRoundedInnerBorderFor(rect, includeLogicalLeftEdge, includeLogicalRightEdge);
 
-    const AffineTransform& currentCTM = graphicsContext->getCTM();
-    // FIXME: this isn't quite correct. We may want to antialias when scaled by a non-integral value, or when the translation is non-integral.
-    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
-    
     bool haveAlphaColor = false;
     bool haveAllSolidEdges = true;
     bool allEdgesVisible = true;
@@ -1626,6 +1622,7 @@
         graphicsContext->clipOutRoundedRect(innerBorder);
     }
 
+    bool antialias = shouldAntialiasLines(graphicsContext);    
     if (haveAlphaColor)
         paintTranslucentBorderSides(graphicsContext, style, outerBorder, innerBorder, edges, bleedAvoidance, includeLogicalLeftEdge, includeLogicalRightEdge, antialias);
     else
@@ -2475,4 +2472,11 @@
     }
 }
 
+bool RenderBoxModelObject::shouldAntialiasLines(GraphicsContext* context)
+{
+    // FIXME: We may want to not antialias when scaled by an integral value,
+    // and we may want to antialias when translated by a non-integral value.
+    return !context->getCTM().isIdentityOrTranslationOrFlipped();
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.h (95776 => 95777)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2011-09-23 02:41:55 UTC (rev 95776)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.h	2011-09-23 03:00:38 UTC (rev 95777)
@@ -190,6 +190,8 @@
     RenderBoxModelObject* continuation() const;
     void setContinuation(RenderBoxModelObject*);
 
+    static bool shouldAntialiasLines(GraphicsContext*);
+
 private:
     virtual bool isBoxModelObject() const { return true; }
 

Modified: trunk/Source/WebCore/rendering/RenderInline.cpp (95776 => 95777)


--- trunk/Source/WebCore/rendering/RenderInline.cpp	2011-09-23 02:41:55 UTC (rev 95776)
+++ trunk/Source/WebCore/rendering/RenderInline.cpp	2011-09-23 03:00:38 UTC (rev 95777)
@@ -1421,8 +1421,7 @@
     LayoutUnit outlineWidth = styleToUse->outlineWidth();
     EBorderStyle outlineStyle = styleToUse->outlineStyle();
 
-    const AffineTransform& currentCTM = graphicsContext->getCTM();
-    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
+    bool antialias = shouldAntialiasLines(graphicsContext);
 
     LayoutUnit offset = style()->outlineOffset();
 

Modified: trunk/Source/WebCore/rendering/RenderTableCell.cpp (95776 => 95777)


--- trunk/Source/WebCore/rendering/RenderTableCell.cpp	2011-09-23 02:41:55 UTC (rev 95776)
+++ trunk/Source/WebCore/rendering/RenderTableCell.cpp	2011-09-23 03:00:38 UTC (rev 95777)
@@ -944,8 +944,7 @@
     borders.addBorder(leftVal, BSLeft, renderLeft, x, y, x + leftWidth, y + h, leftStyle);
     borders.addBorder(rightVal, BSRight, renderRight, x + w - rightWidth, y, x + w, y + h, rightStyle);
 
-    const AffineTransform& currentCTM = graphicsContext->getCTM();
-    bool antialias = !currentCTM.isIdentityOrTranslationOrFlipped();
+    bool antialias = shouldAntialiasLines(graphicsContext);
     
     for (CollapsedBorder* border = borders.nextBorder(); border; border = borders.nextBorder()) {
         if (border->borderValue == *table()->currentBorderStyle())
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to