Changeset 106477 in webkit
- Timestamp:
- Feb 1, 2012 11:21:32 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106476 r106477 1 2012-02-01 Brian Salomon <bsalomon@google.com> 2 3 [SKIA/CHROMIUM] Perform getImageData format conversions using Skia 4 https://bugs.webkit.org/show_bug.cgi?id=77553 5 6 Reviewed by Stephen White. 7 8 * platform/chromium/test_expectations.txt: 9 1 10 2012-02-01 Nate Chapin <japhet@chromium.org> 2 11 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r106459 r106477 2380 2380 BUGWK52509 LINUX WIN : svg/css/rect-gradient-stroke-shadow.svg = IMAGE 2381 2381 BUGWK52509 LEOPARD : svg/css/rect-gradient-stroke-shadow.svg = IMAGE 2382 BUGCR63921 LINUX WIN CPU: fast/canvas/canvas-fillPath-shadow.html = TEXT2382 BUGCR63921 LINUX WIN : fast/canvas/canvas-fillPath-shadow.html = TEXT 2383 2383 2384 2384 // Mainly flaky with mac debug, but also intermittent crashes seen on linux and windows … … 2592 2592 // 2593 2593 2594 // This test expects that putImageData followed by getImageData at the same location 2595 // will return the exact same pixel values. However, the spec allows some fuzziness 2596 // due to conversion to/from premultiplied-alpha. When we do the conversions on the 2597 // GPU we may be off by one in r, g, and/or b. 2598 BUGWK73952 GPU : canvas/philip/tests/2d.imageData.put.unchanged.html = TEXT 2594 // Combination of unpremul plus gradient computation at half-integer coords causes 2595 // this to fail. 2596 BUGWK77550 GPU : canvas/philip/tests/2d.gradient.interpolate.colouralpha.html = TEXT 2599 2597 2600 2598 // These will have slight differences on the edges of antialiased paths and need rebaseling -
trunk/Source/WebCore/ChangeLog
r106476 r106477 1 2012-02-01 Brian Salomon <bsalomon@google.com> 2 3 [SKIA/CHROMIUM] Perform getImageData format conversions using Skia 4 https://bugs.webkit.org/show_bug.cgi?id=77553 5 6 Reviewed by Stephen White. 7 8 Many existing canvas tests exercise this functionality. 9 10 * platform/graphics/skia/ImageBufferSkia.cpp: 11 (WebCore::getImageData): 12 1 13 2012-02-01 Nate Chapin <japhet@chromium.org> 2 14 -
trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
r104501 r106477 227 227 memset(data, 0, result->length()); 228 228 229 int originX = rect.x();230 int destX = 0;231 if (originX < 0) {232 destX = -originX;233 originX = 0;234 }235 int endX = rect.maxX();236 if (endX > size.width())237 endX = size.width();238 int numColumns = endX - originX;239 240 if (numColumns <= 0)241 return result.release();242 243 int originY = rect.y();244 int destY = 0;245 if (originY < 0) {246 destY = -originY;247 originY = 0;248 }249 int endY = rect.maxY();250 if (endY > size.height())251 endY = size.height();252 int numRows = endY - originY;253 254 if (numRows <= 0)255 return result.release();256 257 SkBitmap srcBitmap;258 if (!canvas->readPixels(SkIRect::MakeXYWH(originX, originY, numColumns, numRows), &srcBitmap))259 return result.release();260 261 229 unsigned destBytesPerRow = 4 * rect.width(); 262 unsigned char* destRow = data + destY * destBytesPerRow + destX * 4; 263 264 // Do conversion of byte order and alpha divide (if necessary) 265 for (int y = 0; y < numRows; ++y) { 266 SkPMColor* srcBitmapRow = srcBitmap.getAddr32(0, y); 267 for (int x = 0; x < numColumns; ++x) { 268 SkPMColor srcPMColor = srcBitmapRow[x]; 269 unsigned char* destPixel = &destRow[x * 4]; 270 if (multiplied == Unmultiplied) { 271 unsigned char a = SkGetPackedA32(srcPMColor); 272 destPixel[0] = a ? SkGetPackedR32(srcPMColor) * 255 / a : 0; 273 destPixel[1] = a ? SkGetPackedG32(srcPMColor) * 255 / a : 0; 274 destPixel[2] = a ? SkGetPackedB32(srcPMColor) * 255 / a : 0; 275 destPixel[3] = a; 276 } else { 277 // Input and output are both pre-multiplied, we just need to re-arrange the 278 // bytes from the bitmap format to RGBA. 279 destPixel[0] = SkGetPackedR32(srcPMColor); 280 destPixel[1] = SkGetPackedG32(srcPMColor); 281 destPixel[2] = SkGetPackedB32(srcPMColor); 282 destPixel[3] = SkGetPackedA32(srcPMColor); 283 } 284 } 285 destRow += destBytesPerRow; 286 } 287 230 SkBitmap destBitmap; 231 destBitmap.setConfig(SkBitmap::kARGB_8888_Config, rect.width(), rect.height(), destBytesPerRow); 232 destBitmap.setPixels(data); 233 234 SkCanvas::Config8888 config8888; 235 if (multiplied == Premultiplied) 236 config8888 = SkCanvas::kRGBA_Premul_Config8888; 237 else 238 config8888 = SkCanvas::kRGBA_Unpremul_Config8888; 239 240 canvas->readPixels(&destBitmap, rect.x(), rect.y(), config8888); 288 241 return result.release(); 289 242 }
Note: See TracChangeset
for help on using the changeset viewer.