diff options
| -rw-r--r-- | Source/WebCore/platform/graphics/GraphicsContext.h | 1 | ||||
| -rw-r--r-- | Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | 33 |
2 files changed, 27 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index 9c5f4da19..2fd032f02 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -482,6 +482,7 @@ namespace WebCore { #if PLATFORM(QT) void pushTransparencyLayerInternal(const QRect&, qreal, QPixmap&); + void popTransparencyLayerInternal(); void takeOwnershipOfPlatformContext(); #endif diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index ffd88804a..f62ac6400 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -391,7 +391,7 @@ void GraphicsContext::restorePlatformState() { if (!m_data->layers.isEmpty() && !m_data->layers.top()->alphaMask.isNull()) if (!--m_data->layers.top()->saveCounter) - endPlatformTransparencyLayer(); + popTransparencyLayerInternal(); m_data->p()->restore(); } @@ -1269,18 +1269,37 @@ void GraphicsContext::beginPlatformTransparencyLayer(float opacity) ++m_data->layerCount; } +void GraphicsContext::popTransparencyLayerInternal() +{ + TransparencyLayer* layer = m_data->layers.pop(); + ASSERT(!layer->alphaMask.isNull()); + ASSERT(layer->saveCounter == 0); + layer->painter.resetTransform(); + layer->painter.setCompositionMode(QPainter::CompositionMode_DestinationIn); + layer->painter.drawPixmap(QPoint(), layer->alphaMask); + layer->painter.end(); + + QPainter* p = m_data->p(); + p->save(); + p->resetTransform(); + p->setOpacity(layer->opacity); + p->drawPixmap(layer->offset, layer->pixmap); + p->restore(); + + delete layer; +} + void GraphicsContext::endPlatformTransparencyLayer() { if (paintingDisabled()) return; + while ( ! m_data->layers.top()->alphaMask.isNull() ){ + --m_data->layers.top()->saveCounter; + popTransparencyLayerInternal(); + } TransparencyLayer* layer = m_data->layers.pop(); - if (!layer->alphaMask.isNull()) { - layer->painter.resetTransform(); - layer->painter.setCompositionMode(QPainter::CompositionMode_DestinationIn); - layer->painter.drawPixmap(QPoint(), layer->alphaMask); - } else - --m_data->layerCount; // see the comment for layerCount + --m_data->layerCount; // see the comment for layerCount layer->painter.end(); QPainter* p = m_data->p(); |
