Changeset 166840 in webkit


Ignore:
Timestamp:
Apr 5, 2014 2:34:44 PM (10 years ago)
Author:
krit@webkit.org
Message:

Canvas strokeText and fillText with SourceIn, DestinationIn, SourceOut, DestinationAtop and Copy have errors
https://bugs.webkit.org/show_bug.cgi?id=66766

Reviewed by Andreas Kling.

Source/WebCore:

Use transparency layers to draw text with certain compositing modes on
the canvas. This follows the Canvas specification and makes WebKit fully
compatible with IE. It also makes it more compatible with Firefox, even though
Firefox still has some bugs.

Test: fast/canvas/canvas-composite-text-alpha.html

  • html/canvas/CanvasRenderingContext2D.cpp:

(WebCore::CanvasRenderingContext2D::drawTextInternal):

LayoutTests:

330 tests check compositing on Canvas with text.

  • fast/canvas/canvas-composite-text-alpha-expected.txt: Added.
  • fast/canvas/canvas-composite-text-alpha.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r166836 r166840  
     12014-04-05  Dirk Schulze  <krit@webkit.org>
     2
     3        Canvas strokeText and fillText with SourceIn, DestinationIn, SourceOut, DestinationAtop and Copy have errors
     4        https://bugs.webkit.org/show_bug.cgi?id=66766
     5
     6        Reviewed by Andreas Kling.
     7
     8        330 tests check compositing on Canvas with text.
     9
     10        * fast/canvas/canvas-composite-text-alpha-expected.txt: Added.
     11        * fast/canvas/canvas-composite-text-alpha.html: Added.
     12
    1132014-04-05  Dirk Schulze  <krit@webkit.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r166839 r166840  
     12014-04-05  Dirk Schulze  <krit@webkit.org>
     2
     3        Canvas strokeText and fillText with SourceIn, DestinationIn, SourceOut, DestinationAtop and Copy have errors
     4        https://bugs.webkit.org/show_bug.cgi?id=66766
     5
     6        Reviewed by Andreas Kling.
     7
     8        Use transparency layers to draw text with certain compositing modes on
     9        the canvas. This follows the Canvas specification and makes WebKit fully
     10        compatible with IE. It also makes it more compatible with Firefox, even though
     11        Firefox still has some bugs.
     12
     13        Test: fast/canvas/canvas-composite-text-alpha.html
     14
     15        * html/canvas/CanvasRenderingContext2D.cpp:
     16        (WebCore::CanvasRenderingContext2D::drawTextInternal):
     17
    1182014-04-05  Andreas Kling  <akling@apple.com>
    219
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r166836 r166840  
    23352335    c->setTextDrawingMode(fill ? TextModeFill : TextModeStroke);
    23362336
     2337    GraphicsContextStateSaver stateSaver(*c);
    23372338    if (useMaxWidth) {
    2338         GraphicsContextStateSaver stateSaver(*c);
    23392339        c->translate(location.x(), location.y());
    23402340        // We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work.
    23412341        c->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
    2342         c->drawBidiText(font, textRun, FloatPoint(0, 0), Font::UseFallbackIfFontNotReady);
    2343     } else
     2342        location = FloatPoint();
     2343    }
     2344
     2345    if (isFullCanvasCompositeMode(state().m_globalComposite)) {
     2346        c->beginTransparencyLayer(1);
    23442347        c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
    2345 
    2346     didDraw(textRect);
     2348        c->endTransparencyLayer();
     2349        didDrawEntireCanvas();
     2350    } else if (state().m_globalComposite == CompositeCopy) {
     2351        clearCanvas();
     2352        c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
     2353        didDrawEntireCanvas();
     2354    } else {
     2355        c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
     2356        didDraw(textRect);
     2357    }
    23472358}
    23482359
Note: See TracChangeset for help on using the changeset viewer.