Changeset 28944 in webkit


Ignore:
Timestamp:
Dec 21, 2007 5:01:24 PM (16 years ago)
Author:
alp@webkit.org
Message:

2007-12-21 Brent Fulgham <bfulgham@gmail.com>

Reviewed by Alp Toker.

http://bugs.webkit.org/show_bug.cgi?id=16558
Cairo WebCore Rendering Fails on arc drawing

Fix for bug reported (and patched) by Apollo team in which
arcs were draw in reverse (resulting in inverted images).
Review of the source found that the 'clockwise' term was
actually meant to mean 'anticlockwise' so the IDL and
supporting classes have been changed to match this.

  • html/CanvasRenderingContext2D.cpp: (WebCore::CanvasRenderingContext2D::arc):
  • html/CanvasRenderingContext2D.idl:
  • platform/graphics/cairo/PathCairo.cpp: (WebCore::Path::addArc): (WebCore::Path::addEllipse):
  • platform/graphics/Path.h:
Location:
trunk/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r28934 r28944  
     12007-12-21  Brent Fulgham  <bfulgham@gmail.com>
     2
     3        Reviewed by Alp Toker.
     4
     5        http://bugs.webkit.org/show_bug.cgi?id=16558
     6        Cairo WebCore Rendering Fails on arc drawing
     7
     8        Fix for bug reported (and patched) by Apollo team in which
     9        arcs were draw in reverse (resulting in inverted images).
     10        Review of the source found that the 'clockwise' term was
     11        actually meant to mean 'anticlockwise' so the IDL and
     12        supporting classes have been changed to match this.
     13
     14        * html/CanvasRenderingContext2D.cpp:
     15        (WebCore::CanvasRenderingContext2D::arc):
     16        * html/CanvasRenderingContext2D.idl:
     17        * platform/graphics/cairo/PathCairo.cpp:
     18        (WebCore::Path::addArc):
     19        (WebCore::Path::addEllipse):
     20        * platform/graphics/Path.h:
     21
    1222007-12-21  Alexey Proskuryakov  <ap@webkit.org>
    223
  • trunk/WebCore/html/CanvasRenderingContext2D.cpp

    r28382 r28944  
    420420}
    421421
    422 void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea, bool clockwise, ExceptionCode& ec)
     422void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode& ec)
    423423{
    424424    ec = 0;
     
    427427        return;
    428428    }
    429     state().m_path.addArc(FloatPoint(x, y), r, sa, ea, clockwise);
     429    state().m_path.addArc(FloatPoint(x, y), r, sa, ea, anticlockwise);
    430430}
    431431
  • trunk/WebCore/html/CanvasRenderingContext2D.idl

    r27276 r28944  
    7373        void rect(in float x, in float y, in float width, in float height)
    7474            raises (DOMException);
    75         void arc(in float x, in float y, in float radius, in float startAngle, in float endAngle, in boolean clockwise)
     75        void arc(in float x, in float y, in float radius, in float startAngle, in float endAngle, in boolean anticlockwise)
    7676            raises (DOMException);
    7777        void fill();
  • trunk/WebCore/platform/graphics/Path.h

    r27190 r28944  
    9898        void closeSubpath();
    9999
    100         void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool clockwise);
     100        void addArc(const FloatPoint&, float radius, float startAngle, float endAngle, bool anticlockwise);
    101101        void addRect(const FloatRect&);
    102102        void addEllipse(const FloatRect&);
  • trunk/WebCore/platform/graphics/cairo/PathCairo.cpp

    r28860 r28944  
    3333#include <cairo.h>
    3434#include <math.h>
     35#include <wtf/MathExtras.h>
    3536
    3637namespace WebCore {
     
    137138}
    138139
    139 void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool clockwise)
     140void Path::addArc(const FloatPoint& p, float r, float sa, float ea, bool anticlockwise)
    140141{
    141142    // http://bugs.webkit.org/show_bug.cgi?id=16449
     
    145146
    146147    cairo_t* cr = platformPath()->m_cr;
    147     if (clockwise)
     148    if (anticlockwise)
     149        cairo_arc_negative(cr, p.x(), p.y(), r, sa, ea);
     150    else
    148151        cairo_arc(cr, p.x(), p.y(), r, sa, ea);
    149     else
    150         cairo_arc_negative(cr, p.x(), p.y(), r, sa, ea);
    151152}
    152153
     
    166167    cairo_translate(cr, rect.x() + xRadius, rect.y() + yRadius);
    167168    cairo_scale(cr, xRadius, yRadius);
    168     cairo_arc(cr, 0., 0., 1., 0., 2 * M_PI);
     169    cairo_arc(cr, 0., 0., 1., 0., 2 * piDouble);
    169170    cairo_restore(cr);
    170171}
Note: See TracChangeset for help on using the changeset viewer.