Bug 22186 - [QT] lacks putImageData support in Canvas
Summary: [QT] lacks putImageData support in Canvas
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords: Qt
Depends on:
Blocks:
 
Reported: 2008-11-11 13:54 PST by Dirk Schulze
Modified: 2009-03-02 12:32 PST (History)
0 users

See Also:


Attachments
getImageData support (2.83 KB, patch)
2008-11-11 14:02 PST, Dirk Schulze
no flags Details | Formatted Diff | Diff
getImageData support (3.22 KB, patch)
2009-02-03 06:18 PST, Dirk Schulze
no flags Details | Formatted Diff | Diff
getImageData support (3.06 KB, patch)
2009-02-03 12:56 PST, Dirk Schulze
sam: review+
Details | Formatted Diff | Diff
follow up of getImageData (1.49 KB, patch)
2009-02-03 15:48 PST, Dirk Schulze
sam: review+
Details | Formatted Diff | Diff
putImageData support for Qt (3.50 KB, patch)
2009-03-01 00:42 PST, Dirk Schulze
no flags Details | Formatted Diff | Diff
putImageData support for Qt (3.30 KB, patch)
2009-03-02 04:37 PST, Dirk Schulze
no flags Details | Formatted Diff | Diff
putImageData support for Qt (3.77 KB, patch)
2009-03-02 05:56 PST, Dirk Schulze
zecke: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2008-11-11 13:54:09 PST
QtWebKit lacks getImageDatat / putImageData support for Canvas.
Comment 1 Dirk Schulze 2008-11-11 14:02:31 PST
Created attachment 25053 [details]
getImageData support

This adds getImageData-support to Qt. It fails when the alpha is lower than 255. Don't know if it is a problem of the calculation, this bug: https://bugs.webkit.org/show_bug.cgi?id=20079 or if the alpha-value is allways 255 from translating a QPixmap to a QImage.
Comment 2 Dirk Schulze 2009-02-03 06:18:58 PST
Created attachment 27277 [details]
getImageData support

add getImageData support for qt.
Comment 3 Dirk Schulze 2009-02-03 12:56:05 PST
Created attachment 27284 [details]
getImageData support

use qt to convert to QImage::Format_ARGB32 instead of premultiplied colors. Added a check, if the default qimage format (premultiplied colors) changes.
Comment 4 Sam Weinig 2009-02-03 13:04:10 PST
Comment on attachment 27284 [details]
getImageData support

r=oliver+sam
Comment 5 Dirk Schulze 2009-02-03 13:28:58 PST
landed getImageData support in r40546.
Comment 6 Dirk Schulze 2009-02-03 15:48:59 PST
Created attachment 27295 [details]
follow up of getImageData

follow up of the getImageData patch above. To call toImage once speeds up getImageData.
Comment 7 Dirk Schulze 2009-02-04 01:11:29 PST
landed follow up in r40559
Comment 8 Pam Greene (IRC:pamg) 2009-02-12 10:59:51 PST
Bug gardening: landed, so fixed.
Comment 9 Dirk Schulze 2009-02-12 11:41:54 PST
(In reply to comment #8)
> Bug gardening: landed, so fixed.
No. Just getImageData was landed. putImageData is missing. I'll upload a patch soon and rename the summary
Comment 10 Dirk Schulze 2009-03-01 00:42:14 PST
Created attachment 28135 [details]
putImageData support for Qt

putImageData support. I'm not sure if I have to premultiply the Image before I copy the image to the pixmap. I do it for now.
Comment 11 Dirk Schulze 2009-03-02 04:37:59 PST
Created attachment 28167 [details]
putImageData support for Qt

make putImageData a bit faster.
Comment 12 Dirk Schulze 2009-03-02 05:56:46 PST
Created attachment 28168 [details]
putImageData support for Qt

more speed-up.
Comment 13 Holger Freyther 2009-03-02 06:09:42 PST
Comment on attachment 28168 [details]
putImageData support for Qt

> + [QT] lacks putImageData support in Canvas

Qt please.


> +    unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4;
> +    for (int y = 0; y < numRows; ++y) {
> +        quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y + desty));
> +        for (int x = 0; x < numColumns; x++) {
> +            int basex = x * 4;
> +
> +            scanLine[x + destx] = reinterpret_cast<quint32*>(srcRows + basex)[0];
> +        }
> +        srcRows += srcBytesPerRow;
> +    }
> +    m_data.m_pixmap = QPixmap::fromImage(image);

weird spacing here... extra line in the for/for... but not at the end of the loops..


> +    if (isPainting)
> +        m_data.m_painter->begin(&m_data.m_pixmap);
>  }

and the naming is really weird here..:
   endy,endx vs. endY, endX
   srcRows vs. srcRow.. but all this is coming from the CG variant so I will put it back my complains... just change the spacing and QT... thanks for removing the last notImplemented from there.
Comment 14 Dirk Schulze 2009-03-02 12:32:23 PST
landed in 41355.