Changeset 139911 in webkit
- Timestamp:
- Jan 16, 2013 12:25:06 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r139904 r139911 1 2013-01-16 Arnaud Renevier <a.renevier@sisa.samsung.com> 2 3 inconsistency in drawImage with target rect negative dimensions. 4 https://bugs.webkit.org/show_bug.cgi?id=100026 5 6 Reviewed by Dean Jackson. 7 8 Add a drawImage check for a destination rectangle with -1px 9 width/height. When drawing to (1, 1, -1, -1) rectangle, first 10 (top-left) pixel should have been and been the only one drawn into. 11 12 * fast/canvas/drawImage-with-negative-source-destination-expected.txt: 13 * fast/canvas/drawImage-with-negative-source-destination.js: 14 1 15 2013-01-16 W. James MacLean <wjmaclean@chromium.org> 2 16 -
trunk/LayoutTests/fast/canvas/drawImage-with-negative-source-destination-expected.txt
r36075 r139911 7 7 PASS imgdata[5] is 255 8 8 PASS imgdata[6] is 0 9 PASS imgdata[0] is 255 10 PASS imgdata[1] is 0 11 PASS imgdata[2] is 0 12 PASS imgdata[4] is 0 13 PASS imgdata[5] is 0 14 PASS imgdata[6] is 0 9 15 PASS successfullyParsed is true 10 16 -
trunk/LayoutTests/fast/canvas/drawImage-with-negative-source-destination.js
r98407 r139911 20 20 shouldBe("imgdata[5]", "255"); 21 21 shouldBe("imgdata[6]", "0"); 22 23 // test width or height -1 24 canvas.fillStyle = '#000'; 25 canvas.fillRect(0, 0, 1, 2); 26 canvas.drawImage(canvas2, 0, 0, 1, 1, 1, 1, -1, -1); 27 var imageData = canvas.getImageData(0, 0, 1, 2); 28 var imgdata = imageData.data; 29 shouldBe("imgdata[0]", "255"); 30 shouldBe("imgdata[1]", "0"); 31 shouldBe("imgdata[2]", "0"); 32 shouldBe("imgdata[4]", "0"); 33 shouldBe("imgdata[5]", "0"); 34 shouldBe("imgdata[6]", "0"); -
trunk/PerformanceTests/ChangeLog
r139728 r139911 1 2013-01-16 Arnaud Renevier <a.renevier@sisa.samsung.com> 2 3 inconsistency in drawImage with target rect negative dimensions. 4 https://bugs.webkit.org/show_bug.cgi?id=100026 5 6 Reviewed by Dean Jackson. 7 8 Create a drawImage performance test. There is no significative change 9 in performance: 27144.6851528 runs/s without the patch; 27153.517612 10 runs/s with the patch. Test is currently skipped. 11 12 * Canvas/drawimage.html: Added. 13 * Skipped: 14 1 15 2013-01-15 Dominic Cooney <dominicc@chromium.org> 2 16 -
trunk/PerformanceTests/Skipped
r136120 r139911 63 63 # Bug 102646 - ShadowDOM is not enabled in some ports. 64 64 ShadowDOM 65 66 Canvas/drawimage.html -
trunk/Source/WebCore/ChangeLog
r139908 r139911 1 2013-01-16 Arnaud Renevier <a.renevier@sisa.samsung.com> 2 3 inconsistency in drawImage with target rect negative dimensions. 4 https://bugs.webkit.org/show_bug.cgi?id=100026 5 6 Reviewed by Dean Jackson. 7 8 Remove -1, -1 special case in drawImage and drawImageBuffer. Replace 9 all -1 -1 arguments calls to with the correct rectangle dimensions. 10 11 Remove FloatRect(0, 0, -1, -1) default argument for srcRect, and 12 instead, add new overloaded functions to create a FloatRect from image 13 size. 14 15 Replace -1 -1 arguments calls in FEComposite::platformApplySoftware 16 with correct rectangle dimensions. 17 18 Replace ImageGStreamer rect method (which may return -1 -1 rectangle) 19 with cropRect method, and make caller check for rectangle emptiness. 20 21 * fast/canvas/drawImage-with-negative-source-destination-expected.txt: 22 * fast/canvas/drawImage-with-negative-source-destination.js: 23 24 * platform/graphics/GraphicsContext.cpp: 25 (WebCore::GraphicsContext::drawImage): 26 (WebCore): 27 (WebCore::GraphicsContext::drawImageBuffer): 28 * platform/graphics/GraphicsContext.h: 29 (GraphicsContext): 30 * platform/graphics/filters/FEComposite.cpp: 31 (WebCore::FEComposite::platformApplySoftware): 32 * platform/graphics/gstreamer/ImageGStreamer.h: 33 (WebCore::ImageGStreamer::rect): 34 1 35 2013-01-16 Simon Fraser <simon.fraser@apple.com> 2 36 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp
r139353 r139911 449 449 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation) 450 450 { 451 drawImage(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op, shouldRespectImageOrientation); 451 if (!image) 452 return; 453 drawImage(image, styleColorSpace, p, IntRect(IntPoint(), image->size()), op, shouldRespectImageOrientation); 452 454 } 453 455 454 456 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale) 455 457 { 456 drawImage(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, shouldRespectImageOrientation, useLowQualityScale); 458 if (!image) 459 return; 460 drawImage(image, styleColorSpace, r, IntRect(IntPoint(), image->size()), op, shouldRespectImageOrientation, useLowQualityScale); 457 461 } 458 462 … … 470 474 { 471 475 drawImage(image, styleColorSpace, FloatRect(dest), src, op, BlendModeNormal, shouldRespectImageOrientation, useLowQualityScale); 476 } 477 478 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest) 479 { 480 if (!image) 481 return; 482 drawImage(image, styleColorSpace, dest, FloatRect(IntRect(IntPoint(), image->size()))); 472 483 } 473 484 … … 475 486 { if (paintingDisabled() || !image) 476 487 return; 477 478 float tsw = src.width();479 float tsh = src.height();480 float tw = dest.width();481 float th = dest.height();482 483 if (tsw == -1)484 tsw = image->width();485 if (tsh == -1)486 tsh = image->height();487 488 if (tw == -1)489 tw = image->width();490 if (th == -1)491 th = image->height();492 488 493 489 InterpolationQuality previousInterpolationQuality = InterpolationDefault; … … 503 499 } 504 500 505 image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, blendMode, shouldRespectImageOrientation);501 image->draw(this, dest, src, styleColorSpace, op, blendMode, shouldRespectImageOrientation); 506 502 507 503 if (useLowQualityScale) … … 546 542 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& p, CompositeOperator op, BlendMode blendMode) 547 543 { 548 drawImageBuffer(image, styleColorSpace, p, IntRect(0, 0, -1, -1), op, blendMode); 544 if (!image) 545 return; 546 drawImageBuffer(image, styleColorSpace, p, IntRect(IntPoint(), image->logicalSize()), op, blendMode); 549 547 } 550 548 551 549 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale) 552 550 { 553 drawImageBuffer(image, styleColorSpace, r, IntRect(0, 0, -1, -1), op, blendMode, useLowQualityScale); 551 if (!image) 552 return; 553 drawImageBuffer(image, styleColorSpace, r, IntRect(IntPoint(), image->logicalSize()), op, blendMode, useLowQualityScale); 554 554 } 555 555 … … 564 564 } 565 565 566 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const FloatRect& dest) 567 { 568 if (!image) 569 return; 570 drawImageBuffer(image, styleColorSpace, dest, FloatRect(IntRect(IntPoint(), image->logicalSize()))); 571 } 572 566 573 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale) 567 574 { 568 575 if (paintingDisabled() || !image) 569 576 return; 570 571 float tsw = src.width();572 float tsh = src.height();573 float tw = dest.width();574 float th = dest.height();575 576 if (tsw == -1)577 tsw = image->logicalSize().width();578 if (tsh == -1)579 tsh = image->logicalSize().height();580 581 if (tw == -1)582 tw = image->logicalSize().width();583 if (th == -1)584 th = image->logicalSize().height();585 577 586 578 if (useLowQualityScale) { … … 592 584 setImageInterpolationQuality(InterpolationNone); 593 585 #endif 594 image->draw(this, styleColorSpace, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op, blendMode, useLowQualityScale);586 image->draw(this, styleColorSpace, dest, src, op, blendMode, useLowQualityScale); 595 587 setImageInterpolationQuality(previousInterpolationQuality); 596 588 } else 597 image->draw(this, styleColorSpace, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), op, blendMode, useLowQualityScale);589 image->draw(this, styleColorSpace, dest, src, op, blendMode, useLowQualityScale); 598 590 } 599 591 -
trunk/Source/WebCore/platform/graphics/GraphicsContext.h
r139353 r139911 323 323 void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation); 324 324 void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false); 325 void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect , const FloatRect& srcRect = FloatRect(0, 0, -1, -1),326 325 void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect); 326 void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false); 327 327 void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false); 328 328 … … 337 337 void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal); 338 338 void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false); 339 void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect = FloatRect(0, 0, -1, -1), CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false); 339 void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const FloatRect& destRect); 340 void drawImageBuffer(ImageBuffer*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, BlendMode = BlendModeNormal, bool useLowQualityScale = false); 340 341 341 342 void setImageInterpolationQuality(InterpolationQuality); -
trunk/Source/WebCore/platform/graphics/filters/FEComposite.cpp
r123605 r139911 275 275 GraphicsContext* filterContext = resultImage->context(); 276 276 277 FloatRect srcRect = FloatRect(0, 0, -1, -1); 277 ImageBuffer* imageBuffer = in->asImageBuffer(); 278 ImageBuffer* imageBuffer2 = in2->asImageBuffer(); 279 ASSERT(imageBuffer); 280 ASSERT(imageBuffer2); 281 278 282 switch (m_type) { 279 283 case FECOMPOSITE_OPERATOR_OVER: 280 filterContext->drawImageBuffer(i n2->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));281 filterContext->drawImageBuffer(i n->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()));284 filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 285 filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 282 286 break; 283 287 case FECOMPOSITE_OPERATOR_IN: { … … 293 297 IntRect source2Rect(IntPoint(destinationRect.x() - in2->absolutePaintRect().x(), 294 298 destinationRect.y() - in2->absolutePaintRect().y()), destinationRect.size()); 295 filterContext->drawImageBuffer(i n2->asImageBuffer(), ColorSpaceDeviceRGB, destinationPoint, source2Rect);296 filterContext->drawImageBuffer(i n->asImageBuffer(), ColorSpaceDeviceRGB, destinationPoint, sourceRect, CompositeSourceIn);299 filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, destinationPoint, source2Rect); 300 filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, destinationPoint, sourceRect, CompositeSourceIn); 297 301 break; 298 302 } 299 303 case FECOMPOSITE_OPERATOR_OUT: 300 filterContext->drawImageBuffer(i n->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()));301 filterContext->drawImageBuffer(i n2->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()), srcRect, CompositeDestinationOut);304 filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect())); 305 filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()), IntRect(IntPoint(), imageBuffer2->logicalSize()), CompositeDestinationOut); 302 306 break; 303 307 case FECOMPOSITE_OPERATOR_ATOP: 304 filterContext->drawImageBuffer(i n2->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));305 filterContext->drawImageBuffer(i n->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), srcRect, CompositeSourceAtop);308 filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 309 filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), CompositeSourceAtop); 306 310 break; 307 311 case FECOMPOSITE_OPERATOR_XOR: 308 filterContext->drawImageBuffer(i n2->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect()));309 filterContext->drawImageBuffer(i n->asImageBuffer(), ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), srcRect, CompositeXOR);312 filterContext->drawImageBuffer(imageBuffer2, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in2->absolutePaintRect())); 313 filterContext->drawImageBuffer(imageBuffer, ColorSpaceDeviceRGB, drawingRegionOfInputImage(in->absolutePaintRect()), IntRect(IntPoint(), imageBuffer->logicalSize()), CompositeXOR); 310 314 break; 311 315 default: -
trunk/Source/WebCore/platform/graphics/gstreamer/ImageGStreamer.h
r139896 r139911 52 52 if (!m_cropRect.isEmpty()) 53 53 return FloatRect(m_cropRect); 54 55 // Default rectangle used by GraphicsContext::drawImage(). 56 return FloatRect(0, 0, -1, -1); 54 ASSERT(m_image); 55 return FloatRect(0, 0, m_image->size().width(), m_image->size().height()); 57 56 } 58 57
Note: See TracChangeset
for help on using the changeset viewer.