Changeset 62782 in webkit
- Timestamp:
- Jul 8, 2010 5:38:12 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r62779 r62782 1 2010-07-08 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Canvas putImageData() resets painter state 6 https://bugs.webkit.org/show_bug.cgi?id=41827 7 8 Added a test to verify that the painting state remains intact after calling putImageData(). 9 10 * fast/canvas/canvas-state-intact-after-putImageData-expected.txt: Added. 11 * fast/canvas/canvas-state-intact-after-putImageData.html: Added. 12 * fast/canvas/script-tests/canvas-state-intact-after-putImageData.js: Added. 13 1 14 2010-07-08 Justin Schuh <jschuh@chromium.org> 2 15 -
trunk/WebCore/ChangeLog
r62781 r62782 1 2010-07-08 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Simon Hausmann. 4 5 [Qt] Canvas putImageData() resets painter state 6 https://bugs.webkit.org/show_bug.cgi?id=41827 7 8 Use drawImage() to copy pixels in putImageData() instead of QPixmap::operator= 9 10 Test: fast/canvas/canvas-state-intact-after-putImageData.html 11 12 * platform/graphics/qt/ImageBufferQt.cpp: 13 (WebCore::putImageData): 14 1 15 2010-07-08 Andrey Kosyakov <caseq@chromium.org> 2 16 -
trunk/WebCore/platform/graphics/qt/ImageBufferQt.cpp
r60675 r62782 235 235 unsigned srcBytesPerRow = 4 * source->width(); 236 236 237 bool isPainting = data.m_painter->isActive(); 238 if (isPainting) 239 data.m_painter->end(); 240 241 QImage image = data.m_pixmap.toImage(); 242 if (multiplied == Unmultiplied) 243 image = image.convertToFormat(QImage::Format_ARGB32); 244 else 245 image = image.convertToFormat(QImage::Format_ARGB32_Premultiplied); 237 QRect destRect(destx, desty, endx - destx, endy - desty); 238 239 QImage::Format format = multiplied == Unmultiplied ? QImage::Format_ARGB32 : QImage::Format_ARGB32_Premultiplied; 240 QImage image(destRect.size(), format); 246 241 247 242 unsigned char* srcRows = source->data()->data()->data() + originy * srcBytesPerRow + originx * 4; 248 243 for (int y = 0; y < numRows; ++y) { 249 quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y + desty));244 quint32* scanLine = reinterpret_cast<quint32*>(image.scanLine(y)); 250 245 for (int x = 0; x < numColumns; x++) { 251 246 // ImageData stores the pixels in RGBA while QImage is ARGB 252 247 quint32 pixel = reinterpret_cast<quint32*>(srcRows + 4 * x)[0]; 253 248 pixel = ((pixel << 16) & 0xff0000) | ((pixel >> 16) & 0xff) | (pixel & 0xff00ff00); 254 scanLine[x + destx] = pixel;249 scanLine[x] = pixel; 255 250 } 256 251 … … 258 253 } 259 254 260 data.m_pixmap = QPixmap::fromImage(image); 261 262 if (isPainting) 255 bool isPainting = data.m_painter->isActive(); 256 if (!isPainting) 263 257 data.m_painter->begin(&data.m_pixmap); 258 else { 259 data.m_painter->save(); 260 261 // putImageData() should be unaffected by painter state 262 data.m_painter->resetTransform(); 263 data.m_painter->setOpacity(1.0); 264 data.m_painter->setClipping(false); 265 } 266 267 data.m_painter->setCompositionMode(QPainter::CompositionMode_Source); 268 data.m_painter->drawImage(destRect, image); 269 270 if (!isPainting) 271 data.m_painter->end(); 272 else 273 data.m_painter->restore(); 264 274 } 265 275
Note: See TracChangeset
for help on using the changeset viewer.