[Webkit-unassigned] [Bug 20373] New: <canvas> code needs fewer #ifdefs (part 2)

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Aug 13 14:47:36 PDT 2008


https://bugs.webkit.org/show_bug.cgi?id=20373

           Summary: <canvas> code needs fewer #ifdefs (part 2)
           Product: WebKit
           Version: 526+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: vbs85 at gmx.de


This are only some idears, which need the patches of
https://bugs.webkit.org/show_bug.cgi?id=20351. The main idear is to avoid
#ifdefs and to draw Canvas by GraphicsContext.

Changes in CanvasRenderingContext2D:
void CanvasRenderingContext2D::fillRect(float x, float y, float width, float
height)
{
    if (!validateRectForCanvas(x, y, width, height))
        return;

    GraphicsContext* c = drawingContext();
    if (!c)
        return;

    FloatRect rect(x, y, width, height);
    willDraw(rect);

    if (state().m_fillStyle->canvasGradient()) {
        applyFillGradient();
    else if (state().m_fillStyle->pattern())
        applyFillPattern();
    else
        c->fillRect(rect);       // a new function in GC, should use
fillColor()
}
// the same for strokeRect()

//like applyFillPattern() in the patch
https://bugs.webkit.org/attachment.cgi?id=22764
void CanvasRenderingContext2D::applyFillGradient()
{
    GraphicsContext* c = drawingContext();
    if (!c)
        return;

    // needs some convertations to match or use CanvasGradient* and add an
extra function to GC
    CanvasPattern* pattern = state().m_fillStyle->canvasGradient()->gradient();
    if (!pattern)
        return;

    c->applyFillPattern(pattern->pattern());
    state().m_appliedFillGradient = true;
}

We could add a function for pathes strokePath() in GC to draw lines and shapes
by GC.
I'll make a patch later.


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list