Changeset 102244 in webkit
- Timestamp:
- Dec 7, 2011 10:08:25 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102236 r102244 1 2011-12-07 Brian Salomon <bsalomon@google.com> 2 3 [CHROMIUM] Make canvas/philip/tests/2d.imageData.put.unchanged.html be expected to fail 4 on the GPU due to slight difference in alpha-premul computation. 5 6 https://bugs.webkit.org/show_bug.cgi?id=73953 7 8 Reviewed by Stephen White. 9 10 * platform/chromium/test_expectations.txt: 11 1 12 2011-12-07 Balazs Kelemen <kbalazs@webkit.org> 2 13 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r102229 r102244 2654 2654 // 2655 2655 2656 // This test expects that putImageData followed by getImageData at the same location 2657 // will return the exact same pixel values. However, the spec allows some fuzziness 2658 // due to conversion to/from premultiplied-alpha. When we do the conversions on the 2659 // GPU we may be off by one in r, g, and/or b. 2660 BUGWK73952 GPU : canvas/philip/tests/2d.imageData.put.unchanged.html = TEXT 2661 2656 2662 // Will need windows and linux baselines 2657 2663 -
trunk/Source/WebCore/ChangeLog
r102243 r102244 1 2011-12-07 Brian Salomon <bsalomon@google.com> 2 3 [CHROMIUM/SKIA] Handle put[Un/Pre]multipliedImageData conversions in Skia rather than ImageBuffer 4 https://bugs.webkit.org/show_bug.cgi?id=73953 5 6 Reviewed by Stephen White. 7 8 Tested by existing canvas2d layout tests. 9 10 * platform/graphics/skia/ImageBufferSkia.cpp: 11 (WebCore::putImageData): 12 (WebCore::ImageBuffer::putUnmultipliedImageData): 13 (WebCore::ImageBuffer::putPremultipliedImageData): 14 1 15 2011-12-07 Andreas Kling <kling@webkit.org> 2 16 -
trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r102088 r102244 293 293 template <Multiply multiplied> 294 294 void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, 295 Sk Device* dstDevice, const IntSize& size)295 SkCanvas* canvas, const IntSize& size) 296 296 { 297 297 ASSERT(sourceRect.width() > 0); … … 322 322 323 323 unsigned srcBytesPerRow = 4 * sourceSize.width(); 324 325 SkBitmap deviceBitmap = dstDevice->accessBitmap(true); 326 327 // If the device's bitmap doesn't have pixels we will make a temp and call writePixels on the device. 328 bool temporaryBitmap = !!deviceBitmap.getTexture(); 329 SkBitmap destBitmap; 330 331 if (temporaryBitmap) { 332 destBitmap.setConfig(SkBitmap::kARGB_8888_Config, numColumns, numRows, srcBytesPerRow); 333 if (!destBitmap.allocPixels()) 334 CRASH(); 335 } else 336 deviceBitmap.extractSubset(&destBitmap, SkIRect::MakeXYWH(destX, destY, numColumns, numRows)); 337 338 // Whether we made a temporary or not destBitmap is always configured to be written at 0,0 339 SkAutoLockPixels destAutoLock(destBitmap); 340 const unsigned char* srcRow = source->data() + originY * srcBytesPerRow + originX * 4; 341 for (int y = 0; y < numRows; ++y) { 342 SkPMColor* destRow = destBitmap.getAddr32(0, y); 343 for (int x = 0; x < numColumns; ++x) { 344 const unsigned char* srcPixel = &srcRow[x * 4]; 345 if (multiplied == Unmultiplied) { 346 unsigned char alpha = srcPixel[3]; 347 unsigned char r = SkMulDiv255Ceiling(srcPixel[0], alpha); 348 unsigned char g = SkMulDiv255Ceiling(srcPixel[1], alpha); 349 unsigned char b = SkMulDiv255Ceiling(srcPixel[2], alpha); 350 destRow[x] = SkPackARGB32(alpha, r, g, b); 351 } else 352 destRow[x] = SkPackARGB32NoCheck(srcPixel[3], srcPixel[0], srcPixel[1], srcPixel[2]); 353 } 354 srcRow += srcBytesPerRow; 355 } 356 357 // If we used a temporary then write it to the device 358 if (temporaryBitmap) 359 dstDevice->writePixels(destBitmap, destX, destY); 324 SkBitmap srcBitmap; 325 srcBitmap.setConfig(SkBitmap::kARGB_8888_Config, numColumns, numRows, srcBytesPerRow); 326 srcBitmap.setPixels(source->data() + originY * srcBytesPerRow + originX * 4); 327 328 SkCanvas::Config8888 config8888; 329 if (multiplied == Premultiplied) 330 config8888 = SkCanvas::kRGBA_Premul_Config8888; 331 else 332 config8888 = SkCanvas::kRGBA_Unpremul_Config8888; 333 334 canvas->writePixels(srcBitmap, destX, destY, config8888); 360 335 } 361 336 362 337 void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) 363 338 { 364 putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas() ->getDevice(), m_size);339 putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas(), m_size); 365 340 } 366 341 367 342 void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) 368 343 { 369 putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas() ->getDevice(), m_size);344 putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas(), m_size); 370 345 } 371 346
Note: See TracChangeset
for help on using the changeset viewer.