Changeset 79595 in webkit


Ignore:
Timestamp:
Feb 24, 2011 11:31:59 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-02-24 Misha Tyutyunik <michael.tyutyunik@nokia.com>

Reviewed by Andreas Kling.

[Qt] Dont use QPixmapCache if QPixmapCache::cacheLimit() is too small
(2048Kb for now).
https://bugs.webkit.org/show_bug.cgi?id=54887

No new tests required.

  • platform/graphics/qt/GraphicsLayerQt.cpp: (WebCore::GraphicsLayerQtImpl::allowAcceleratedCompositingCache): (WebCore::GraphicsLayerQtImpl::drawLayerContent): (WebCore::GraphicsLayerQtImpl::paint): (WebCore::GraphicsLayerQtImpl::flushChanges):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r79592 r79595  
     12011-02-24  Misha Tyutyunik  <michael.tyutyunik@nokia.com>
     2
     3        Reviewed by Andreas Kling.
     4
     5        [Qt] Dont use QPixmapCache if QPixmapCache::cacheLimit() is too small
     6        (2048Kb for now).
     7        https://bugs.webkit.org/show_bug.cgi?id=54887
     8
     9        No new tests required.
     10
     11        * platform/graphics/qt/GraphicsLayerQt.cpp:
     12        (WebCore::GraphicsLayerQtImpl::allowAcceleratedCompositingCache):
     13        (WebCore::GraphicsLayerQtImpl::drawLayerContent):
     14        (WebCore::GraphicsLayerQtImpl::paint):
     15        (WebCore::GraphicsLayerQtImpl::flushChanges):
     16
    1172011-02-20  Martin Robinson  <mrobinson@igalia.com>
    218
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp

    r76600 r79595  
    5555#endif
    5656
    57 
    5857#define QT_DEBUG_RECACHE 0
    5958#define QT_DEBUG_CACHEDUMP 0
     
    6261
    6362namespace WebCore {
     63
     64static const int gMinimumPixmapCacheLimit = 2048;
    6465
    6566#ifndef QT_NO_GRAPHICSEFFECT
     
    207208    virtual Color tiledBackingStoreBackgroundColor() const;
    208209#endif
     210
     211    static bool allowAcceleratedCompositingCache() { return QPixmapCache::cacheLimit() > gMinimumPixmapCacheLimit; }
     212
     213    void drawLayerContent(QPainter*, const QRect&);
    209214
    210215public slots:
     
    382387}
    383388
     389
     390void GraphicsLayerQtImpl::drawLayerContent(QPainter* painter, const QRect& clipRect)
     391{
     392    painter->setClipRect(clipRect, Qt::IntersectClip);
     393    painter->setCompositionMode(QPainter::CompositionMode_SourceOver);
     394    GraphicsContext gc(painter);
     395    m_layer->paintGraphicsLayerContents(gc, clipRect);
     396}
     397
    384398QPixmap GraphicsLayerQtImpl::recache(const QRegion& regionToUpdate)
    385399{
     
    631645    case HTMLContentType:
    632646        if (m_state.drawsContent) {
    633             QPixmap backingStore;
    634             // We might need to recache, in case we try to paint and the cache was purged (e.g. if it was full).
    635             if (!QPixmapCache::find(m_backingStore.key, &backingStore) || backingStore.size() != m_size.toSize())
    636                 backingStore = recache(QRegion(m_state.contentsRect));
    637             const QRectF bounds(0, 0, m_backingStore.size.width(), m_backingStore.size.height());
    638             painter->drawPixmap(0, 0, backingStore);
     647            if (!allowAcceleratedCompositingCache())
     648                drawLayerContent(painter, option->exposedRect.toRect());
     649            else {
     650                QPixmap backingStore;
     651                // We might need to recache, in case we try to paint and the cache was purged (e.g. if it was full).
     652                if (!QPixmapCache::find(m_backingStore.key, &backingStore) || backingStore.size() != m_size.toSize())
     653                    backingStore = recache(QRegion(m_state.contentsRect));
     654                const QRectF bounds(0, 0, m_backingStore.size.width(), m_backingStore.size.height());
     655                painter->drawPixmap(0, 0, backingStore);
     656            }
    639657        }
    640658        break;
     
    838856        // We only need to do this for HTML content, there's no point in caching directly composited
    839857        // content like images or solid rectangles.
    840         if (m_pendingContent.contentType == HTMLContentType)
     858        if (m_pendingContent.contentType == HTMLContentType && allowAcceleratedCompositingCache())
    841859            recache(m_pendingContent.regionToUpdate);
    842860#endif
Note: See TracChangeset for help on using the changeset viewer.