Changeset 148923 in webkit


Ignore:
Timestamp:
Apr 22, 2013 4:06:16 PM (11 years ago)
Author:
Martin Robinson
Message:

[Cairo] Canvas-shadow behavior is not being as expected
https://bugs.webkit.org/show_bug.cgi?id=108897

Patch by Rashmi Shyamasundar <rashmi.s2@samsung.com> on 2013-04-22
Reviewed by Martin Robinson.

Source/WebCore:

Use the pattern-extend-mode "CAIRO_EXTEND_NONE" instead of "CAIRO_EXTEND_PAD" in
PlatformContextCairo::drawSurfaceToContext().

In the function PlatformContextCairo::drawSurfaceToContext(), a pattern is being
created from the source surface and this pattern is drawn onto the destination
context. There is no gradient involved. Hence the extend mode for filling the
pattern should be "CAIRO_EXTEND_NONE". If we use the extend mode
"CAIRO_EXTEND_PAD" in PlatformContextCairo::drawSurfaceToContext(), the original
image area is also filled with the shadow color which is not the expected behavior.

Test: fast/canvas/canvas-image-shadow.html

  • platform/graphics/cairo/PlatformContextCairo.cpp:

(WebCore::PlatformContextCairo::drawSurfaceToContext):

LayoutTests:

Test to verify the shadow of an image drawn on canvas.
This test uses an image whose size is smaller than,
the size of the rectangle which should be filled with the image.

  • fast/canvas/canvas-image-shadow-expected.txt: Added.
  • fast/canvas/canvas-image-shadow.html: Added.
  • fast/canvas/green.png: Added.
  • fast/canvas/script-tests/canvas-image-shadow.js: Added.

(draw):

Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r148921 r148923  
     12013-04-22  Rashmi Shyamasundar  <rashmi.s2@samsung.com>
     2
     3        [Cairo] Canvas-shadow behavior is not being as expected
     4        https://bugs.webkit.org/show_bug.cgi?id=108897
     5
     6        Reviewed by Martin Robinson.
     7
     8        Test to verify the shadow of an image drawn on canvas.
     9        This test uses an image whose size is smaller than,
     10        the size of the rectangle which should be filled with the image.
     11
     12        * fast/canvas/canvas-image-shadow-expected.txt: Added.
     13        * fast/canvas/canvas-image-shadow.html: Added.
     14        * fast/canvas/green.png: Added.
     15        * fast/canvas/script-tests/canvas-image-shadow.js: Added.
     16        (draw):
     17
    1182013-04-22  Benjamin Poulain  <benjamin@webkit.org>
    219
  • trunk/Source/WebCore/ChangeLog

    r148921 r148923  
     12013-04-22  Rashmi Shyamasundar  <rashmi.s2@samsung.com>
     2
     3        [Cairo] Canvas-shadow behavior is not being as expected
     4        https://bugs.webkit.org/show_bug.cgi?id=108897
     5
     6        Reviewed by Martin Robinson.
     7
     8        Use the pattern-extend-mode "CAIRO_EXTEND_NONE" instead of "CAIRO_EXTEND_PAD" in
     9        PlatformContextCairo::drawSurfaceToContext().
     10
     11        In the function PlatformContextCairo::drawSurfaceToContext(), a pattern is being
     12        created from the source surface and this pattern is drawn onto the destination
     13        context. There is no gradient involved. Hence the extend mode for filling the
     14        pattern should be "CAIRO_EXTEND_NONE". If we use the extend mode
     15        "CAIRO_EXTEND_PAD" in PlatformContextCairo::drawSurfaceToContext(), the original
     16        image area is also filled with the shadow color which is not the expected behavior.
     17
     18        Test: fast/canvas/canvas-image-shadow.html
     19
     20        * platform/graphics/cairo/PlatformContextCairo.cpp:
     21        (WebCore::PlatformContextCairo::drawSurfaceToContext):
     22
    1232013-04-22  Benjamin Poulain  <benjamin@webkit.org>
    224
  • trunk/Source/WebCore/platform/graphics/cairo/PlatformContextCairo.cpp

    r148681 r148923  
    192192        break;
    193193    }
    194     cairo_pattern_set_extend(pattern.get(), CAIRO_EXTEND_PAD);
     194    cairo_pattern_set_extend(pattern.get(), CAIRO_EXTEND_NONE);
    195195
    196196    // The pattern transformation properly scales the pattern for when the source rectangle is a
Note: See TracChangeset for help on using the changeset viewer.