Changeset 121435 in webkit


Ignore:
Timestamp:
Jun 28, 2012 9:14:54 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[Qt] Make GC's fill{Rounded}Rect use optimized shadow blur code
https://bugs.webkit.org/show_bug.cgi?id=90082

Patch by Bruno de Oliveira Abinader <Bruno de Oliveira Abinader> on 2012-06-28
Reviewed by Noam Rosenthal.

ShadowBlur::drawRectShadow makes use of optimized tiles-based drawPattern, which
is not present when using {begin/end}shadowLayer.

  • platform/graphics/qt/GraphicsContextQt.cpp:

(WebCore::GraphicsContext::fillRect):
(WebCore::GraphicsContext::fillRoundedRect):
(WebCore::GraphicsContext::pushTransparencyLayerInternal):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121433 r121435  
     12012-06-28  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
     2
     3        [Qt] Make GC's fill{Rounded}Rect use optimized shadow blur code
     4        https://bugs.webkit.org/show_bug.cgi?id=90082
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        ShadowBlur::drawRectShadow makes use of optimized tiles-based drawPattern, which
     9        is not present when using {begin/end}shadowLayer.
     10
     11        * platform/graphics/qt/GraphicsContextQt.cpp:
     12        (WebCore::GraphicsContext::fillRect):
     13        (WebCore::GraphicsContext::fillRoundedRect):
     14        (WebCore::GraphicsContext::pushTransparencyLayerInternal):
     15
    1162012-06-28  Rahul Tiwari  <rahultiwari.cse.iitr@gmail.com>
    217
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r120065 r121435  
    704704        return;
    705705
    706     m_data->solidColor.setColor(color);
    707     QPainter* p = m_data->p();
    708     QRectF normalizedRect = rect.normalized();
    709 
     706    QRectF platformRect(rect);
     707    QPainter* p = m_data->p();
    710708    if (hasShadow()) {
    711709        ShadowBlur* shadow = shadowBlur();
    712710        if (shadow->mustUseShadowBlur(this)) {
    713             GraphicsContext* shadowContext = shadow->beginShadowLayer(this, normalizedRect);
    714             if (shadowContext) {
    715                 QPainter* shadowPainter = shadowContext->platformContext();
    716                 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
    717                 shadowPainter->fillRect(normalizedRect, m_state.shadowColor);
    718                 shadow->endShadowLayer(this);
    719             }
     711            shadow->drawRectShadow(this, platformRect, RoundedRect::Radii());
    720712        } else {
    721713            QColor shadowColor = m_state.shadowColor;
    722714            shadowColor.setAlphaF(shadowColor.alphaF() * p->brush().color().alphaF());
    723             p->fillRect(normalizedRect.translated(QPointF(m_state.shadowOffset.width(), m_state.shadowOffset.height())), shadowColor);
     715            p->fillRect(platformRect.translated(QPointF(m_state.shadowOffset.width(), m_state.shadowOffset.height())), shadowColor);
    724716        }
    725717    }
    726 
    727     p->fillRect(normalizedRect, m_data->solidColor);
     718    p->fillRect(platformRect, QColor(color));
    728719}
    729720
     
    739730        ShadowBlur* shadow = shadowBlur();
    740731        if (shadow->mustUseShadowBlur(this)) {
    741             GraphicsContext* shadowContext = shadow->beginShadowLayer(this, rect);
    742             if (shadowContext) {
    743                 QPainter* shadowPainter = shadowContext->platformContext();
    744                 shadowPainter->setCompositionMode(QPainter::CompositionMode_Source);
    745                 shadowPainter->fillPath(path.platformPath(), QColor(m_state.shadowColor));
    746                 shadow->endShadowLayer(this);
    747             }
     732            shadow->drawRectShadow(this, rect, RoundedRect::Radii(topLeft, topRight, bottomLeft, bottomRight));
    748733        } else {
    749734            const QPointF shadowOffset(m_state.shadowOffset.width(), m_state.shadowOffset.height());
     
    10461031    QPainter* p = m_data->p();
    10471032
    1048     QRect deviceClip = p->transform().mapRect(rect);
     1033    QTransform deviceTransform = p->transform();
     1034    QRect deviceClip = deviceTransform.mapRect(rect);
     1035
     1036    alphaMask = alphaMask.transformed(deviceTransform);
    10491037    if (alphaMask.width() != deviceClip.width() || alphaMask.height() != deviceClip.height())
    10501038        alphaMask = alphaMask.scaled(deviceClip.width(), deviceClip.height());
Note: See TracChangeset for help on using the changeset viewer.