[webkit-reviews] review requested: [Bug 89865] [Qt] Avoid a deep copy of QImage in GraphicsContext3D::getImageData. : [Attachment 149270] patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 25 04:10:26 PDT 2012


Huang Dongsung <luxtella at company100.net> has asked  for review:
Bug 89865: [Qt] Avoid a deep copy of QImage in GraphicsContext3D::getImageData.
https://bugs.webkit.org/show_bug.cgi?id=89865

Attachment 149270: patch
https://bugs.webkit.org/attachment.cgi?id=149270&action=review

------- Additional Comments from Huang Dongsung <luxtella at company100.net>
This patch follows BitmapTextureGL::updateContents.

void BitmapTextureGL::updateContents(Image* image, const IntRect& targetRect,
const IntPoint& offset)
{
    if (!image)
	return;
    NativeImagePtr frameImage = image->nativeImageForCurrentFrame();
    if (!frameImage)
	return;

    int bytesPerLine;
    const char* imageData;

#if PLATFORM(QT)
    QImage qtImage;
#if HAVE(QT5)
    // With QPA, we can avoid a deep copy.
    qtImage = *frameImage->handle()->buffer();
#else
    // This might be a deep copy, depending on other references to the pixmap.
    qtImage = frameImage->toImage();
#endif
    imageData = reinterpret_cast<const char*>(qtImage.constBits());
    bytesPerLine = qtImage.bytesPerLine();
#elif USE(CAIRO)
    cairo_surface_t* surface = frameImage->surface();
    imageData = reinterpret_cast<const
char*>(cairo_image_surface_get_data(surface));
    bytesPerLine = cairo_image_surface_get_stride(surface);
#endif

    updateContents(imageData, targetRect, offset, bytesPerLine);
}


More information about the webkit-reviews mailing list