Changeset 163159 in webkit


Ignore:
Timestamp:
Jan 30, 2014 9:47:20 PM (10 years ago)
Author:
Alan Bujtas
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r163158 r163159  
     12014-01-30  Zalan Bujtas  <zalan@apple.com>
     2
     3        Subpixel rendering: Change drawRect()/drawLine() signature to support subpixel rendering.
     4        https://bugs.webkit.org/show_bug.cgi?id=127961
     5
     6        Reviewed by Simon Fraser.
     7
     8        IntRect/IntPoint -> FloatRect/FloatPoint.
     9
     10        Covered by existing tests. No change in functionality.
     11
     12        * platform/graphics/GraphicsContext.h:
     13        * platform/graphics/cairo/GraphicsContextCairo.cpp:
     14        (WebCore::GraphicsContext::drawRect):
     15        (WebCore::GraphicsContext::drawLine):
     16        * platform/graphics/cg/GraphicsContextCG.cpp:
     17        (WebCore::GraphicsContext::drawRect):
     18        (WebCore::GraphicsContext::drawLine): Keep 'distance' int for DottedStroke and DashedStroke for now.
     19        * platform/graphics/wince/GraphicsContextWinCE.cpp:
     20        (WebCore::GraphicsContext::drawRect):
     21        (WebCore::GraphicsContext::drawLine):
     22
    1232014-01-30  Simon Fraser  <simon.fraser@apple.com>
    224
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r163156 r163159  
    271271        // using a 1-pixel stroke inset from the rect borders (of the correct
    272272        // stroke color).
    273         void drawRect(const IntRect&);
    274         void drawLine(const IntPoint&, const IntPoint&);
     273        void drawRect(const FloatRect&);
     274        void drawLine(const FloatPoint&, const FloatPoint&);
    275275
    276276#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp

    r163156 r163159  
    231231
    232232// Draws a filled rectangle with a stroked border.
    233 void GraphicsContext::drawRect(const IntRect& rect)
     233void GraphicsContext::drawRect(const FloatRect& rect)
    234234{
    235235    if (paintingDisabled())
     
    333333
    334334// This is only used to draw borders, so we should not draw shadows.
    335 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
     335void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2)
    336336{
    337337    if (paintingDisabled())
  • trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r163156 r163159  
    281281
    282282// Draws a filled rectangle with a stroked border.
    283 void GraphicsContext::drawRect(const IntRect& rect)
     283void GraphicsContext::drawRect(const FloatRect& rect)
    284284{
    285285    // FIXME: this function does not handle patterns and gradients
     
    312312
    313313// This is only used to draw borders.
    314 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
     314void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2)
    315315{
    316316    if (paintingDisabled())
     
    328328    // For odd widths, we add in 0.5 to the appropriate x/y so that the float arithmetic
    329329    // works out.  For example, with a border width of 3, KHTML will pass us (y1+y2)/2, e.g.,
    330     // (50+53)/2 = 103/2 = 51 when we want 51.5.  It is always true that an even width gave
     330    // (50+53)/2 = 103/2 = 51 when we want 51.5. It is always true that an even width gave
    331331    // us a perfect position, but an odd width gave us a position that is off by exactly 0.5.
    332332    if (strokeStyle() == DottedStroke || strokeStyle() == DashedStroke) {
     
    395395        // Remainder is 20.  The maximum pixels of line we could paint
    396396        // will be 50 pixels.
    397         int distance = (isVerticalLine ? (point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;
     397        int distance = (isVerticalLine ? (int)(point2.y() - point1.y()) : (point2.x() - point1.x())) - 2*(int)width;
    398398        int remainder = distance % patWidth;
    399399        int coverage = distance - remainder;
  • trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp

    r163156 r163159  
    625625}
    626626
    627 void GraphicsContext::drawRect(const IntRect& rect)
     627void GraphicsContext::drawRect(const FloatRect& rect)
    628628{
    629629    if (!m_data->m_opacity || paintingDisabled() || rect.isEmpty())
     
    670670}
    671671
    672 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2)
     672void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point2)
    673673{
    674674    if (!m_data->m_opacity || paintingDisabled() || strokeStyle() == NoStroke || !strokeColor().alpha())
Note: See TracChangeset for help on using the changeset viewer.