Changeset 76415 in webkit


Ignore:
Timestamp:
Jan 21, 2011 5:45:14 PM (13 years ago)
Author:
andreas.kling@nokia.com
Message:

2011-01-21 Andreas Kling <kling@webkit.org>

Reviewed by Kenneth Rohde Christiansen.

[Qt] Always set composition mode through GraphicsContext
https://bugs.webkit.org/show_bug.cgi?id=52940

GraphicsContext tracks the current composition mode so we should
never call through to the QPainter directly.

  • platform/graphics/GraphicsContext.h:
  • platform/graphics/qt/GraphicsContextQt.cpp: (WebCore::toQtCompositionMode): Changed this method to a static inline since it's only used by GraphicsContextQt.cpp now.
  • platform/graphics/qt/ImageQt.cpp: (WebCore::Image::drawPattern): (WebCore::BitmapImage::draw):
Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r76414 r76415  
     12011-01-21  Andreas Kling  <kling@webkit.org>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Qt] Always set composition mode through GraphicsContext
     6        https://bugs.webkit.org/show_bug.cgi?id=52940
     7
     8        GraphicsContext tracks the current composition mode so we should
     9        never call through to the QPainter directly.
     10
     11        * platform/graphics/GraphicsContext.h:
     12        * platform/graphics/qt/GraphicsContextQt.cpp:
     13        (WebCore::toQtCompositionMode): Changed this method to a static inline
     14        since it's only used by GraphicsContextQt.cpp now.
     15
     16        * platform/graphics/qt/ImageQt.cpp:
     17        (WebCore::Image::drawPattern):
     18        (WebCore::BitmapImage::draw):
     19
    1202011-01-21  Dan Bernstein  <mitz@apple.com>
    221
  • trunk/Source/WebCore/platform/graphics/GraphicsContext.h

    r76248 r76415  
    466466        void pushTransparencyLayerInternal(const QRect &rect, qreal opacity, QPixmap& alphaMask);
    467467        void takeOwnershipOfPlatformContext();
    468         static QPainter::CompositionMode toQtCompositionMode(CompositeOperator op);
    469468#endif
    470469
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r76405 r76415  
    7070namespace WebCore {
    7171
    72 QPainter::CompositionMode GraphicsContext::toQtCompositionMode(CompositeOperator op)
     72static inline QPainter::CompositionMode toQtCompositionMode(CompositeOperator op)
    7373{
    7474    switch (op) {
  • trunk/Source/WebCore/platform/graphics/qt/ImageQt.cpp

    r75926 r76415  
    121121    CompositeOperator previousOperator = ctxt->compositeOperation();
    122122
    123     ctxt->setCompositeOperation(op);
     123    ctxt->setCompositeOperation(!pixmap.hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
     124
    124125    QPainter* p = ctxt->platformContext();
    125     if (!pixmap.hasAlpha() && p->compositionMode() == QPainter::CompositionMode_SourceOver)
    126         p->setCompositionMode(QPainter::CompositionMode_Source);
    127 
    128126    QTransform transform(patternTransform);
    129127
     
    224222    }
    225223
    226     QPainter* painter(ctxt->platformContext());
    227 
    228     QPainter::CompositionMode compositionMode = GraphicsContext::toQtCompositionMode(op);
    229 
    230     if (!image->hasAlpha() && painter->compositionMode() == QPainter::CompositionMode_SourceOver)
    231         compositionMode = QPainter::CompositionMode_Source;
    232 
    233     QPainter::CompositionMode lastCompositionMode = painter->compositionMode();
    234     painter->setCompositionMode(compositionMode);
     224    CompositeOperator previousOperator = ctxt->compositeOperation();
     225    ctxt->setCompositeOperation(!image->hasAlpha() && op == CompositeSourceOver ? CompositeCopy : op);
    235226
    236227    ContextShadow* shadow = ctxt->contextShadow();
     
    244235    }
    245236
    246     // Test using example site at
    247     // http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
    248     painter->drawPixmap(normalizedDst, *image, normalizedSrc);
    249 
    250     painter->setCompositionMode(lastCompositionMode);
     237    ctxt->platformContext()->drawPixmap(normalizedDst, *image, normalizedSrc);
     238
     239    ctxt->setCompositeOperation(previousOperator);
    251240
    252241    if (imageObserver())
Note: See TracChangeset for help on using the changeset viewer.