Changeset 102782 in webkit
- Timestamp:
- Dec 14, 2011 8:37:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102777 r102782 1 2011-12-14 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-14 Csaba Osztrogonác <ossy@webkit.org> 2 13 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r102767 r102782 2761 2761 // 2762 2762 2763 // This test expects that putImageData followed by getImageData at the same location 2764 // will return the exact same pixel values. However, the spec allows some fuzziness 2765 // due to conversion to/from premultiplied-alpha. When we do the conversions on the 2766 // GPU we may be off by one in r, g, and/or b. 2767 BUGWK73952 GPU : canvas/philip/tests/2d.imageData.put.unchanged.html = TEXT 2768 2763 2769 // Will need windows and linux baselines 2764 2770 -
trunk/Source/WebCore/ChangeLog
r102780 r102782 1 2011-12-14 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-14 Mary Wu <mary.wu@torchmobile.com.cn> 2 16 -
trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r102385 r102782 292 292 template <Multiply multiplied> 293 293 void putImageData(ByteArray*& source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, 294 Sk Device* dstDevice, const IntSize& size)294 SkCanvas* canvas, const IntSize& size) 295 295 { 296 296 ASSERT(sourceRect.width() > 0); … … 321 321 322 322 unsigned srcBytesPerRow = 4 * sourceSize.width(); 323 324 SkBitmap deviceBitmap = dstDevice->accessBitmap(true); 325 326 // If the device's bitmap doesn't have pixels we will make a temp and call writePixels on the device. 327 bool temporaryBitmap = !!deviceBitmap.getTexture(); 328 SkBitmap destBitmap; 329 330 if (temporaryBitmap) { 331 destBitmap.setConfig(SkBitmap::kARGB_8888_Config, numColumns, numRows, srcBytesPerRow); 332 if (!destBitmap.allocPixels()) 333 CRASH(); 334 } else 335 deviceBitmap.extractSubset(&destBitmap, SkIRect::MakeXYWH(destX, destY, numColumns, numRows)); 336 337 // Whether we made a temporary or not destBitmap is always configured to be written at 0,0 338 SkAutoLockPixels destAutoLock(destBitmap); 339 const unsigned char* srcRow = source->data() + originY * srcBytesPerRow + originX * 4; 340 for (int y = 0; y < numRows; ++y) { 341 SkPMColor* destRow = destBitmap.getAddr32(0, y); 342 for (int x = 0; x < numColumns; ++x) { 343 const unsigned char* srcPixel = &srcRow[x * 4]; 344 if (multiplied == Unmultiplied) { 345 unsigned char alpha = srcPixel[3]; 346 unsigned char r = SkMulDiv255Ceiling(srcPixel[0], alpha); 347 unsigned char g = SkMulDiv255Ceiling(srcPixel[1], alpha); 348 unsigned char b = SkMulDiv255Ceiling(srcPixel[2], alpha); 349 destRow[x] = SkPackARGB32(alpha, r, g, b); 350 } else 351 destRow[x] = SkPackARGB32NoCheck(srcPixel[3], srcPixel[0], srcPixel[1], srcPixel[2]); 352 } 353 srcRow += srcBytesPerRow; 354 } 355 356 // If we used a temporary then write it to the device 357 if (temporaryBitmap) 358 dstDevice->writePixels(destBitmap, destX, destY); 323 SkBitmap srcBitmap; 324 srcBitmap.setConfig(SkBitmap::kARGB_8888_Config, numColumns, numRows, srcBytesPerRow); 325 srcBitmap.setPixels(source->data() + originY * srcBytesPerRow + originX * 4); 326 327 SkCanvas::Config8888 config8888; 328 if (multiplied == Premultiplied) 329 config8888 = SkCanvas::kRGBA_Premul_Config8888; 330 else 331 config8888 = SkCanvas::kRGBA_Unpremul_Config8888; 332 333 canvas->writePixels(srcBitmap, destX, destY, config8888); 359 334 } 360 335 361 336 void ImageBuffer::putUnmultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) 362 337 { 363 putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas() ->getDevice(), m_size);338 putImageData<Unmultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas(), m_size); 364 339 } 365 340 366 341 void ImageBuffer::putPremultipliedImageData(ByteArray* source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint) 367 342 { 368 putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas() ->getDevice(), m_size);343 putImageData<Premultiplied>(source, sourceSize, sourceRect, destPoint, context()->platformContext()->canvas(), m_size); 369 344 } 370 345
Note: See TracChangeset
for help on using the changeset viewer.