Title: [163159] trunk/Source/WebCore
Revision
163159
Author
[email protected]
Date
2014-01-30 21:47:20 -0800 (Thu, 30 Jan 2014)

Log Message

Subpixel rendering: Change drawRect()/drawLine() signature to support subpixel rendering.
https://bugs.webkit.org/show_bug.cgi?id=127961

Reviewed by Simon Fraser.

IntRect/IntPoint -> FloatRect/FloatPoint.

Covered by existing tests. No change in functionality.

* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine): Keep 'distance' int for DottedStroke and DashedStroke for now.
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawRect):
(WebCore::GraphicsContext::drawLine):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (163158 => 163159)


--- trunk/Source/WebCore/ChangeLog	2014-01-31 05:42:27 UTC (rev 163158)
+++ trunk/Source/WebCore/ChangeLog	2014-01-31 05:47:20 UTC (rev 163159)
@@ -1,3 +1,25 @@
+2014-01-30  Zalan Bujtas  <[email protected]>
+
+        Subpixel rendering: Change drawRect()/drawLine() signature to support subpixel rendering.
+        https://bugs.webkit.org/show_bug.cgi?id=127961
+
+        Reviewed by Simon Fraser.
+
+        IntRect/IntPoint -> FloatRect/FloatPoint.
+
+        Covered by existing tests. No change in functionality.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawLine):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawLine): Keep 'distance' int for DottedStroke and DashedStroke for now.
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::drawRect):
+        (WebCore::GraphicsContext::drawLine):
+
 2014-01-30  Simon Fraser  <[email protected]>
 
         Remove ScrollingCoordinator::setLayerIsContainerForFixedPositionLayers() which is no longer used

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (163158 => 163159)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2014-01-31 05:42:27 UTC (rev 163158)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2014-01-31 05:47:20 UTC (rev 163159)
@@ -270,8 +270,8 @@
         // FIXME: ...except drawRect(), which fills properly but always strokes
         // using a 1-pixel stroke inset from the rect borders (of the correct
         // stroke color).
-        void drawRect(const IntRect&);
-        void drawLine(const IntPoint&, const IntPoint&);
+        void drawRect(const FloatRect&);
+        void drawLine(const FloatPoint&, const FloatPoint&);
 
 #if PLATFORM(IOS)
         void drawJoinedLines(CGPoint points[], unsigned count, bool antialias, CGLineCap = kCGLineCapButt);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (163158 => 163159)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2014-01-31 05:42:27 UTC (rev 163158)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2014-01-31 05:47:20 UTC (rev 163159)
@@ -230,7 +230,7 @@
 }
 
 // Draws a filled rectangle with a stroked border.
-void GraphicsContext::drawRect(const IntRect& rect)
+void GraphicsContext::drawRect(const FloatRect& rect)
 {
     if (paintingDisabled())
         return;
@@ -332,7 +332,7 @@
 }
 
 // This is only used to draw borders, so we should not draw shadows.
-void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
+void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2)
 {
     if (paintingDisabled())
         return;

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (163158 => 163159)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2014-01-31 05:42:27 UTC (rev 163158)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2014-01-31 05:47:20 UTC (rev 163159)
@@ -280,7 +280,7 @@
 }
 
 // Draws a filled rectangle with a stroked border.
-void GraphicsContext::drawRect(const IntRect& rect)
+void GraphicsContext::drawRect(const FloatRect& rect)
 {
     // FIXME: this function does not handle patterns and gradients
     // like drawPath does, it probably should.
@@ -311,7 +311,7 @@
 }
 
 // This is only used to draw borders.
-void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
+void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2)
 {
     if (paintingDisabled())
         return;
@@ -327,7 +327,7 @@
     
     // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic
     // works out.  For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g.,
-    // (50+53)/2 = 103/2 = 51 when we want 51.5.  It is always true that an even width gave
+    // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave
     // us a perfect position, but an odd width gave us a position that is off by exactly 0.5.
     if (strokeStyle() == DottedStroke || strokeStyle() == DashedStroke) {
         if (isVerticalLine) {
@@ -394,7 +394,7 @@
         // Example: 80 pixels with a width of 30 pixels.
         // Remainder is 20.  The maximum pixels of line we could paint
         // will be 50 pixels.
-        int distance = (isVerticalLine ? (point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;
+        int distance = (isVerticalLine ? (int)(point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;
         int remainder = distance % patWidth;
         int coverage = distance - remainder;
         int numSegments = coverage / patWidth;

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (163158 => 163159)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2014-01-31 05:42:27 UTC (rev 163158)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2014-01-31 05:47:20 UTC (rev 163159)
@@ -624,7 +624,7 @@
     m_data->restore();
 }
 
-void GraphicsContext::drawRect(const IntRect& rect)
+void GraphicsContext::drawRect(const FloatRect& rect)
 {
     if (!m_data->m_opacity || paintingDisabled() || rect.isEmpty())
         return;
@@ -669,7 +669,7 @@
     SelectObject(dc, oldBrush);
 }
 
-void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
+void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2)
 {
     if (!m_data->m_opacity || paintingDisabled() || strokeStyle() == NoStroke || !strokeColor().alpha())
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to