Changeset 63656 in webkit


Ignore:
Timestamp:
Jul 19, 2010 7:24:36 AM (14 years ago)
Author:
andreas.kling@nokia.com
Message:

2010-07-19 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Render shadow when drawing one canvas onto another
https://bugs.webkit.org/show_bug.cgi?id=42508

  • platform/graphics/qt/StillImageQt.cpp: (WebCore::StillImage::draw):

2010-07-19 Andreas Kling <andreas.kling@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Render shadow when drawing one canvas onto another
https://bugs.webkit.org/show_bug.cgi?id=42508

Unskip:

  • canvas/philip/tests/2d.shadow.canvas.basic.html

Reskip (bug now exposed):

  • canvas/philip/tests/2d.shadow.canvas.transparent.1.html
  • platform/qt/Skipped:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63655 r63656  
     12010-07-19  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Render shadow when drawing one canvas onto another
     6        https://bugs.webkit.org/show_bug.cgi?id=42508
     7
     8        Unskip:
     9        - canvas/philip/tests/2d.shadow.canvas.basic.html
     10
     11        Reskip (bug now exposed):
     12        - canvas/philip/tests/2d.shadow.canvas.transparent.1.html
     13
     14        * platform/qt/Skipped:
     15
    1162010-07-19  Csaba Osztrogonác  <ossy@webkit.org>
    217
  • trunk/LayoutTests/platform/qt/Skipped

    r63654 r63656  
    52895289canvas/philip/tests/2d.pattern.image.undefined.html
    52905290canvas/philip/tests/2d.shadow.canvas.alpha.html
    5291 canvas/philip/tests/2d.shadow.canvas.basic.html
     5291canvas/philip/tests/2d.shadow.canvas.transparent.1.html
    52925292canvas/philip/tests/2d.shadow.canvas.transparent.2.html
    52935293canvas/philip/tests/2d.shadow.image.alpha.html
  • trunk/WebCore/ChangeLog

    r63654 r63656  
     12010-07-19  Andreas Kling  <andreas.kling@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Render shadow when drawing one canvas onto another
     6        https://bugs.webkit.org/show_bug.cgi?id=42508
     7
     8        * platform/graphics/qt/StillImageQt.cpp:
     9        (WebCore::StillImage::draw):
     10
    1112010-07-19  Andreas Kling  <andreas.kling@nokia.com>
    212
  • trunk/WebCore/platform/graphics/qt/StillImageQt.cpp

    r63606 r63656  
    6868        return;
    6969
    70     ctxt->save();
     70
     71    FloatRect normalizedSrc = src.normalized();
     72    FloatRect normalizedDst = dst.normalized();
     73
     74    QPainter* painter = ctxt->platformContext();
     75    QPainter::CompositionMode oldCompositionMode = painter->compositionMode();
     76
    7177    ctxt->setCompositeOperation(op);
    7278
    73     // To support width or height is negative
    74     float sx = src.x();
    75     float sy = src.y();
    76     float sw = src.width();
    77     float sh = src.height();
     79    FloatSize shadowSize;
     80    float shadowBlur;
     81    Color shadowColor;
     82    if (ctxt->getShadow(shadowSize, shadowBlur, shadowColor)) {
     83        FloatRect shadowImageRect(normalizedDst);
     84        shadowImageRect.move(shadowSize.width(), shadowSize.height());
    7885
    79     if (sw < 0) {
    80         sx = sx + sw;
    81         sw = -sw;
     86        QImage shadowImage(QSize(static_cast<int>(normalizedSrc.width()), static_cast<int>(normalizedSrc.height())), QImage::Format_ARGB32_Premultiplied);
     87        QPainter p(&shadowImage);
     88        p.setCompositionMode(QPainter::CompositionMode_Source);
     89        p.fillRect(shadowImage.rect(), shadowColor);
     90        p.setCompositionMode(QPainter::CompositionMode_DestinationIn);
     91        p.drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
     92        p.end();
     93        painter->drawImage(shadowImageRect, shadowImage, normalizedSrc);
    8294    }
    8395
    84     if (sh < 0) {
    85         sy = sy + sh;
    86         sh = -sh;
    87     }
    88 
    89     float dx = dst.x();
    90     float dy = dst.y();
    91     float dw = dst.width();
    92     float dh = dst.height();
    93 
    94     if (dw < 0) {
    95         dx = dx + dw;
    96         dw = -dw;
    97     }
    98 
    99     if (dh < 0) {
    100         dy = dy + dh;
    101         dh = -dh;
    102     }
    103 
    104     FloatRect srcM(sx, sy, sw, sh);
    105     FloatRect dstM(dx, dy, dw, dh);
    106     QPainter* painter(ctxt->platformContext());
    107 
    108     painter->drawPixmap(dstM, *m_pixmap, srcM);
    109     ctxt->restore();
     96    painter->drawPixmap(normalizedDst, *m_pixmap, normalizedSrc);
     97    painter->setCompositionMode(oldCompositionMode);
    11098}
    11199
Note: See TracChangeset for help on using the changeset viewer.