Changeset 69777 in webkit


Ignore:
Timestamp:
Oct 14, 2010 10:31:13 AM (14 years ago)
Author:
noam.rosenthal@nokia.com
Message:

2010-10-14 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Texmap] [Qt] Texture mapper initial implementation
https://bugs.webkit.org/show_bug.cgi?id=47070

Allow rendering of accelerated-compositing with TextureMapper, inside a QWebFrame. The frame will render the regular content,
either normally or through tiled backingstore, then let the TextureMapper layer render itself to the active context, and
then render the scrollbar and pan icon. This is different from the current implementation, which uses additional QGraphicsItems for AC
and the scrollbar overlay.

  • Api/qgraphicswebview.cpp: (QGraphicsWebView::paint):
  • Api/qwebframe.cpp: (QWebFramePrivate::renderFromTiledBackingStore): (QWebFramePrivate::renderRelativeCoords):
Location:
trunk/WebKit/qt
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/qt/Api/qgraphicswebview.cpp

    r68761 r69777  
    298298    }
    299299#endif
    300 #if USE(ACCELERATED_COMPOSITING)
     300#if USE(ACCELERATED_COMPOSITING) && !USE(TEXTURE_MAPPER)
    301301    page()->mainFrame()->render(painter, d->overlay() ? QWebFrame::ContentsLayer : QWebFrame::AllLayers, option->exposedRect.toAlignedRect());
    302302#else
  • trunk/WebKit/qt/Api/qwebframe.cpp

    r69009 r69777  
    9797#include "runtime_root.h"
    9898#endif
     99#if USE(TEXTURE_MAPPER)
     100#include "texmap/TextureMapperPlatformLayer.h"
     101#endif
    99102#include "wtf/HashMap.h"
    100103#include <QMultiMap>
     
    292295        painter->restore();
    293296    }
     297#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     298    // TextureMapper might use raw OpenGL or some other backend that requires native painting. On raster this doesn't have any effect.
     299    if (rootGraphicsLayer) {
     300        painter->beginNativePainting();
     301        rootGraphicsLayer->paint(context, view->size(), view->frameRect(), IntRect(clip.boundingRect()), TransformationMatrix(), painter->opacity());
     302        painter->endNativePainting();
     303    }
     304
     305    renderRelativeCoords(context, (QWebFrame::RenderLayer)(QWebFrame::ScrollBarLayer | QWebFrame::PanIconLayer), clip);
     306#endif
    294307}
    295308#endif
     
    309322    view->updateLayoutAndStyleIfNeededRecursive();
    310323
    311     for (int i = 0; i < vector.size(); ++i) {
    312         const QRect& clipRect = vector.at(i);
    313 
    314         QRect intersectedRect = clipRect.intersected(view->frameRect());
    315 
     324    if (layer & QWebFrame::ContentsLayer) {
    316325        painter->save();
    317         painter->setClipRect(clipRect, Qt::IntersectClip);
    318 
    319         int x = view->x();
    320         int y = view->y();
    321 
    322         if (layer & QWebFrame::ContentsLayer) {
     326        for (int i = 0; i < vector.size(); ++i) {
     327            const QRect& clipRect = vector.at(i);
     328
     329            QRect intersectedRect = clipRect.intersected(view->frameRect());
     330
     331            painter->setClipRect(clipRect, Qt::IntersectClip);
     332
     333            int x = view->x();
     334            int y = view->y();
     335
    323336            context->save();
    324337
     
    337350            context->restore();
    338351        }
    339 
    340         if (layer & QWebFrame::ScrollBarLayer
    341             && !view->scrollbarsSuppressed()
    342             && (view->horizontalScrollbar() || view->verticalScrollbar())) {
    343             context->save();
    344 
    345             QRect rect = intersectedRect;
    346             context->translate(x, y);
    347             rect.translate(-x, -y);
    348 
    349             view->paintScrollbars(context, rect);
    350 
    351             context->restore();
     352        painter->restore();
     353
     354#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     355        if (rootGraphicsLayer) {
     356            painter->save();
     357            painter->beginNativePainting();
     358            rootGraphicsLayer->paint(context, view->size(), view->frameRect(), IntRect(clip.boundingRect()),
     359                                     TransformationMatrix(), context->platformContext()->opacity());
     360            painter->endNativePainting();
     361            painter->restore();
    352362        }
     363#endif
     364    }
     365    if (layer & (QWebFrame::PanIconLayer | QWebFrame::ScrollBarLayer)) {
     366        for (int i = 0; i < vector.size(); ++i) {
     367            const QRect& clipRect = vector.at(i);
     368
     369            QRect intersectedRect = clipRect.intersected(view->frameRect());
     370
     371            painter->save();
     372            painter->setClipRect(clipRect, Qt::IntersectClip);
     373
     374            int x = view->x();
     375            int y = view->y();
     376
     377            if (layer & QWebFrame::ScrollBarLayer
     378                && !view->scrollbarsSuppressed()
     379                && (view->horizontalScrollbar() || view->verticalScrollbar())) {
     380                context->save();
     381
     382                QRect rect = intersectedRect;
     383                context->translate(x, y);
     384                rect.translate(-x, -y);
     385
     386                view->paintScrollbars(context, rect);
     387
     388                context->restore();
     389            }
    353390
    354391#if ENABLE(PAN_SCROLLING)
    355         if (layer & QWebFrame::PanIconLayer)
    356             view->paintPanScrollIcon(context);
     392            if (layer & QWebFrame::PanIconLayer)
     393                view->paintPanScrollIcon(context);
    357394#endif
    358395
    359         painter->restore();
     396            painter->restore();
     397        }
    360398    }
    361399}
  • trunk/WebKit/qt/ChangeLog

    r69688 r69777  
     12010-10-14  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Texmap] [Qt] Texture mapper initial implementation
     6        https://bugs.webkit.org/show_bug.cgi?id=47070
     7
     8        Allow rendering of accelerated-compositing with TextureMapper, inside a QWebFrame. The frame will render the regular content,
     9        either normally or through tiled backingstore, then let the TextureMapper layer render itself to the active context, and
     10        then render the scrollbar and pan icon. This is different from the current implementation, which uses additional QGraphicsItems for AC
     11        and the scrollbar overlay.
     12
     13        * Api/qgraphicswebview.cpp:
     14        (QGraphicsWebView::paint):
     15        * Api/qwebframe.cpp:
     16        (QWebFramePrivate::renderFromTiledBackingStore):
     17        (QWebFramePrivate::renderRelativeCoords):
     18
    1192010-10-13  Gavin Barraclough  <barraclough@apple.com>
    220
Note: See TracChangeset for help on using the changeset viewer.