Changeset 106729 in webkit
- Timestamp:
- Feb 3, 2012, 10:43:50 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
html/canvas/CanvasRenderingContext2D.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106725 r106729 1 2012-02-03 Tim Horton <timothy_horton@apple.com> 2 3 Canvas-into-canvas drawing should respect backing store scale ratio 4 https://bugs.webkit.org/show_bug.cgi?id=77784 5 <rdar://problem/10549729> 6 7 Reviewed by Dan Bernstein. 8 9 Respect the backing store scale ratio when drawing a canvas into another 10 canvas via ctx.drawImage(canvas, x, y). Previous behavior caused canvas 11 drawing to differ based on the size of the backing store, which is ideally 12 an implementation detail to authors. 13 14 Also, rename the source canvas arguments to CanvasRenderingContext2D::drawImage 15 to be more clear. 16 17 No new tests. 18 19 * html/canvas/CanvasRenderingContext2D.cpp: 20 (WebCore::CanvasRenderingContext2D::drawImage): 21 1 22 2012-02-03 Beth Dakin <bdakin@apple.com> 2 23 -
trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r106695 r106729 1365 1365 } 1366 1366 1367 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, float x, float y, ExceptionCode& ec)1368 { 1369 if (! canvas) {1367 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float x, float y, ExceptionCode& ec) 1368 { 1369 if (!sourceCanvas) { 1370 1370 ec = TYPE_MISMATCH_ERR; 1371 1371 return; 1372 1372 } 1373 1373 1374 // In order to emulate drawing the result of toDataURL() into the canvas, we 1375 // need to deflate the size of the source rectangle by the source canvas's 1376 // backing store scale factor. 1377 // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=15041 for motivation. 1378 1379 FloatSize logicalSize = canvas->convertDeviceToLogical(canvas->size()); 1380 1381 drawImage(canvas, 0, 0, logicalSize.width(), logicalSize.height(), x, y, canvas->width(), canvas->height(), ec); 1382 } 1383 1384 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas, 1374 drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(), x, y, sourceCanvas->width(), sourceCanvas->height(), ec); 1375 } 1376 1377 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, 1385 1378 float x, float y, float width, float height, ExceptionCode& ec) 1386 1379 { 1387 if (! canvas) {1380 if (!sourceCanvas) { 1388 1381 ec = TYPE_MISMATCH_ERR; 1389 1382 return; 1390 1383 } 1391 drawImage( canvas, FloatRect(0, 0, canvas->width(), canvas->height()), FloatRect(x, y, width, height), ec);1392 } 1393 1394 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* canvas,1384 drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas->height()), FloatRect(x, y, width, height), ec); 1385 } 1386 1387 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, 1395 1388 float sx, float sy, float sw, float sh, 1396 1389 float dx, float dy, float dw, float dh, ExceptionCode& ec) 1397 1390 { 1398 drawImage( canvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec);1391 drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), ec); 1399 1392 } 1400 1393
Note:
See TracChangeset
for help on using the changeset viewer.