Changeset 65775 in webkit


Ignore:
Timestamp:
Aug 20, 2010 10:14:18 PM (14 years ago)
Author:
Girish Ramakrishnan
Message:

[Qt] When using the raster graphics system on Maemo5, allow
Flash to render directly into the raster window surface.
wmode=transparent is now supported as a result of this change.

Reviewed by Ariya Hidayat.

https://bugs.webkit.org/show_bug.cgi?id=44043

  • plugins/qt/PluginViewQt.cpp:

(WebCore::PluginView::paintUsingImageSurfaceExtension):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r65774 r65775  
     12010-08-20  Girish Ramakrishnan  <girish@forwardbias.in>
     2
     3        Reviewed by Ariya Hidayat.
     4
     5        [Qt] When using the raster graphics system on Maemo5, allow
     6        Flash to render directly into the raster window surface.
     7        wmode=transparent is now supported as a result of this change.
     8       
     9        https://bugs.webkit.org/show_bug.cgi?id=44043
     10       
     11        * plugins/qt/PluginViewQt.cpp:
     12        (WebCore::PluginView::paintUsingImageSurfaceExtension):
     13
    1142010-08-20  Alexey Proskuryakov  <ap@apple.com>
    215
  • trunk/WebCore/plugins/qt/PluginViewQt.cpp

    r65612 r65775  
    172172void PluginView::paintUsingImageSurfaceExtension(QPainter* painter, const IntRect& exposedRect)
    173173{
    174     if (m_isTransparent) {
    175         // On Maemo5, Flash expects the buffer to contain the contents that are below it.
    176         // We don't support transparency, so clean the image before giving to Flash.
    177         QPainter imagePainter(&m_image);
    178         imagePainter.fillRect(exposedRect, Qt::white);
    179     }
    180 
    181174    NPImageExpose imageExpose;
    182     imageExpose.data = reinterpret_cast<char*>(m_image.bits());
    183     imageExpose.stride = m_image.bytesPerLine();
    184     imageExpose.depth = m_image.depth();
     175    QPoint offset;
     176    QWebPageClient* client = m_parentFrame->view()->hostWindow()->platformPageClient();
     177    const bool surfaceHasUntransformedContents = client && qobject_cast<QWidget*>(client->pluginParent());
     178
     179    QPaintDevice* surface =  QPainter::redirected(painter->device(), &offset);
     180
     181    // If the surface is a QImage, we can render directly into it
     182    if (surfaceHasUntransformedContents && surface && surface->devType() == QInternal::Image) {
     183        QImage* image = static_cast<QImage*>(surface);
     184        offset = -offset; // negating the offset gives us the offset of the view within the surface
     185        imageExpose.data = reinterpret_cast<char*>(image->bits());
     186        imageExpose.dataSize.width = image->width();
     187        imageExpose.dataSize.height = image->height();
     188        imageExpose.stride = image->bytesPerLine();
     189        imageExpose.depth = image->depth(); // this is guaranteed to be 16 on Maemo5
     190        imageExpose.translateX = offset.x() + m_windowRect.x();
     191        imageExpose.translateY = offset.y() + m_windowRect.y();
     192        imageExpose.scaleX = 1;
     193        imageExpose.scaleY = 1;
     194    } else {
     195        if (m_isTransparent) {
     196            // On Maemo5, Flash expects the buffer to contain the contents that are below it.
     197            // We don't support transparency for non-raster graphicssystem, so clean the image
     198            // before giving to Flash.
     199            QPainter imagePainter(&m_image);
     200            imagePainter.fillRect(exposedRect, Qt::white);
     201        }
     202
     203        imageExpose.data = reinterpret_cast<char*>(m_image.bits());
     204        imageExpose.dataSize.width = m_image.width();
     205        imageExpose.dataSize.height = m_image.height();
     206        imageExpose.stride = m_image.bytesPerLine();
     207        imageExpose.depth = m_image.depth();
     208        imageExpose.translateX = 0;
     209        imageExpose.translateY = 0;
     210        imageExpose.scaleX = 1;
     211        imageExpose.scaleY = 1;
     212    }
    185213    imageExpose.x = exposedRect.x();
    186214    imageExpose.y = exposedRect.y();
    187215    imageExpose.width = exposedRect.width();
    188216    imageExpose.height = exposedRect.height();
    189     imageExpose.dataSize.width = m_image.width();
    190     imageExpose.dataSize.height = m_image.height();
    191     imageExpose.translateX = 0;
    192     imageExpose.translateY = 0;
    193     imageExpose.scaleX = 1;
    194     imageExpose.scaleY = 1;
    195217
    196218    XEvent xevent;
     
    207229    dispatchNPEvent(xevent);
    208230
    209     painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect);
     231    if (!surfaceHasUntransformedContents || !surface || surface->devType() != QInternal::Image)
     232        painter->drawImage(QPoint(frameRect().x() + exposedRect.x(), frameRect().y() + exposedRect.y()), m_image, exposedRect);
    210233}
    211234#endif
Note: See TracChangeset for help on using the changeset viewer.