Changeset 68176 in webkit
- Timestamp:
- Sep 23, 2010 12:15:48 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r68174 r68176 1 2010-09-23 Matthew Delaney <mdelaney@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 context.drawImage with (source rect's height) = -(input image's native height) draws nothing 6 https://bugs.webkit.org/show_bug.cgi?id=46243 7 8 These test simply exercise using negative widths and heights for the source rect in ctx.drawImage calls. 9 10 * canvas/philip/tests/2d.drawImage.negativeSourceHeight-expected.txt: Added. 11 * canvas/philip/tests/2d.drawImage.negativeSourceHeight.html: Added. 12 * canvas/philip/tests/2d.drawImage.negativeSourceHeight2-expected.txt: Added. 13 * canvas/philip/tests/2d.drawImage.negativeSourceHeight2.html: Added. 14 * canvas/philip/tests/2d.drawImage.negativeSourceHeightAndWidth-expected.txt: Added. 15 * canvas/philip/tests/2d.drawImage.negativeSourceHeightAndWidth.html: Added. 16 1 17 2010-09-23 Nate Chapin <japhet@chromium.org> 2 18 -
trunk/WebCore/ChangeLog
r68175 r68176 1 2010-09-23 Matthew Delaney <mdelaney@apple.com> 2 3 Reviewed by Oliver Hunt. 4 5 context.drawImage with (source rect's height) = -(input image's native height) draws nothing 6 https://bugs.webkit.org/show_bug.cgi?id=46243 7 8 This patch changes canvasrenderingcontext2d's drawImage with an image element to 9 normalize the source and dest rects to acheive the desired canvas spec behavior 10 of allowing negative widths and heights that don't cause flipping and fix the 11 adverse behavior of specifying a source rect height of negative the source image's height 12 13 Tests: canvas/philip/tests/2d.drawImage.negativeSourceHeight.html 14 canvas/philip/tests/2d.drawImage.negativeSourceHeight2.html 15 canvas/philip/tests/2d.drawImage.negativeSourceHeightAndWidth.html 16 17 * html/canvas/CanvasRenderingContext2D.cpp: Normalize rects in drawImage before calling 18 lower level draw calls. 19 1 20 2010-09-23 Renata Hodovan <reni@inf.u-szeged.hu> 2 21 -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r67574 r68176 1187 1187 return; 1188 1188 1189 if (!dstRect.width() || !dstRect.height()) 1190 return; 1191 1189 1192 if (!image->complete()) 1190 1193 return; 1191 1194 1195 FloatRect normalizedSrcRect = normalizeRect(srcRect); 1196 FloatRect normalizedDstRect = normalizeRect(dstRect); 1197 1192 1198 FloatRect imageRect = FloatRect(FloatPoint(), size(image)); 1193 if (!imageRect.contains(normalize Rect(srcRect)) || !srcRect.width() || !srcRect.height()) {1199 if (!imageRect.contains(normalizedSrcRect) || !srcRect.width() || !srcRect.height()) { 1194 1200 ec = INDEX_SIZE_ERR; 1195 1201 return; 1196 1202 } 1197 1198 if (!dstRect.width() || !dstRect.height())1199 return;1200 1203 1201 1204 GraphicsContext* c = drawingContext(); … … 1215 1218 canvas()->setOriginTainted(); 1216 1219 1217 FloatRect sourceRect = c->roundToDevicePixels( srcRect);1218 FloatRect destRect = c->roundToDevicePixels( dstRect);1220 FloatRect sourceRect = c->roundToDevicePixels(normalizedSrcRect); 1221 FloatRect destRect = c->roundToDevicePixels(normalizedDstRect); 1219 1222 c->drawImage(cachedImage->image(), DeviceColorSpace, destRect, sourceRect, state().m_globalComposite); 1220 1223 didDraw(destRect);
Note: See TracChangeset
for help on using the changeset viewer.