diff options
Diffstat (limited to 'Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp b/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp index 3d7037c2f..59c763b51 100644 --- a/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp +++ b/Source/WebCore/platform/graphics/texmap/BitmapTextureGL.cpp @@ -37,6 +37,10 @@ #include <wtf/RefCounted.h> #include <wtf/TemporaryChange.h> +#if PLATFORM(QT) +#include <QPaintEngine> +#endif + #if USE(CAIRO) #include "CairoUtilities.h" #include "RefPtrCairo.h" @@ -200,7 +204,17 @@ void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect, co imageData = reinterpret_cast<const char*>(cairo_image_surface_get_data(surface)); bytesPerLine = cairo_image_surface_get_stride(surface); #elif PLATFORM(QT) - QImage qImage = frameImage->toImage(); + QImage qImage; + QPaintEngine* paintEngine = frameImage->paintEngine(); + if (paintEngine && paintEngine->type() == QPaintEngine::Raster) { + // QRasterPixmapData::toImage() will deep-copy the backing QImage if there's an active QPainter on it. + // For performance reasons, we don't want that here, so we temporarily redirect the paint engine. + QPaintDevice* currentPaintDevice = paintEngine->paintDevice(); + paintEngine->setPaintDevice(0); + qImage = frameImage->toImage(); + paintEngine->setPaintDevice(currentPaintDevice); + } else + qImage = frameImage->toImage(); imageData = reinterpret_cast<const char*>(qImage.constBits()); bytesPerLine = qImage.bytesPerLine(); #endif |