| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
| 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
| 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
| 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> | 6 * Copyright (C) 2008 Dirk Schulze <krit@webkit.org> |
| 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. | 7 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. |
| 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. | 8 * Copyright (C) 2012, 2013 Intel Corporation. All rights reserved. |
| 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 9 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 10 * | 10 * |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1282 didDraw(clipBounds); | 1282 didDraw(clipBounds); |
| 1283 } else { | 1283 } else { |
| 1284 FloatRect dirtyRect; | 1284 FloatRect dirtyRect; |
| 1285 if (computeDirtyRect(dstRect, &dirtyRect)) { | 1285 if (computeDirtyRect(dstRect, &dirtyRect)) { |
| 1286 c->drawImage(image, dstRect, srcRect, op, blendMode); | 1286 c->drawImage(image, dstRect, srcRect, op, blendMode); |
| 1287 didDraw(dirtyRect); | 1287 didDraw(dirtyRect); |
| 1288 } | 1288 } |
| 1289 } | 1289 } |
| 1290 } | 1290 } |
| 1291 | 1291 |
| 1292 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, float x, float y,
ExceptionState& es) | 1292 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, float x, float y,
ExceptionState& exceptionState) |
| 1293 { | 1293 { |
| 1294 if (!bitmap) { | 1294 if (!bitmap) { |
| 1295 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1295 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1296 return; | 1296 return; |
| 1297 } | 1297 } |
| 1298 drawImage(bitmap, x, y, bitmap->width(), bitmap->height(), es); | 1298 drawImage(bitmap, x, y, bitmap->width(), bitmap->height(), exceptionState); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, | 1301 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, |
| 1302 float x, float y, float width, float height, ExceptionState& es) | 1302 float x, float y, float width, float height, ExceptionState& exceptionState) |
| 1303 { | 1303 { |
| 1304 if (!bitmap) { | 1304 if (!bitmap) { |
| 1305 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1305 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1306 return; | 1306 return; |
| 1307 } | 1307 } |
| 1308 if (!bitmap->bitmapRect().width() || !bitmap->bitmapRect().height()) | 1308 if (!bitmap->bitmapRect().width() || !bitmap->bitmapRect().height()) |
| 1309 return; | 1309 return; |
| 1310 | 1310 |
| 1311 drawImage(bitmap, 0, 0, bitmap->width(), bitmap->height(), x, y, width, heig
ht, es); | 1311 drawImage(bitmap, 0, 0, bitmap->width(), bitmap->height(), x, y, width, heig
ht, exceptionState); |
| 1312 } | 1312 } |
| 1313 | 1313 |
| 1314 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, | 1314 void CanvasRenderingContext2D::drawImage(ImageBitmap* bitmap, |
| 1315 float sx, float sy, float sw, float sh, | 1315 float sx, float sy, float sw, float sh, |
| 1316 float dx, float dy, float dw, float dh, ExceptionState& es) | 1316 float dx, float dy, float dw, float dh, ExceptionState& exceptionState) |
| 1317 { | 1317 { |
| 1318 if (!bitmap) { | 1318 if (!bitmap) { |
| 1319 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1319 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1320 return; | 1320 return; |
| 1321 } | 1321 } |
| 1322 | 1322 |
| 1323 FloatRect srcRect(sx, sy, sw, sh); | 1323 FloatRect srcRect(sx, sy, sw, sh); |
| 1324 FloatRect dstRect(dx, dy, dw, dh); | 1324 FloatRect dstRect(dx, dy, dw, dh); |
| 1325 FloatRect bitmapRect = bitmap->bitmapRect(); | 1325 FloatRect bitmapRect = bitmap->bitmapRect(); |
| 1326 | 1326 |
| 1327 if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfi
nite(dstRect.width()) || !std::isfinite(dstRect.height()) | 1327 if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfi
nite(dstRect.width()) || !std::isfinite(dstRect.height()) |
| 1328 || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::i
sfinite(srcRect.width()) || !std::isfinite(srcRect.height())) | 1328 || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::i
sfinite(srcRect.width()) || !std::isfinite(srcRect.height())) |
| 1329 return; | 1329 return; |
| 1330 | 1330 |
| 1331 if (!dstRect.width() || !dstRect.height()) | 1331 if (!dstRect.width() || !dstRect.height()) |
| 1332 return; | 1332 return; |
| 1333 if (!srcRect.width() || !srcRect.height()) { | 1333 if (!srcRect.width() || !srcRect.height()) { |
| 1334 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1334 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1335 return; | 1335 return; |
| 1336 } | 1336 } |
| 1337 | 1337 |
| 1338 ASSERT(bitmap->height() && bitmap->width()); | 1338 ASSERT(bitmap->height() && bitmap->width()); |
| 1339 FloatRect normalizedSrcRect = normalizeRect(srcRect); | 1339 FloatRect normalizedSrcRect = normalizeRect(srcRect); |
| 1340 FloatRect normalizedDstRect = normalizeRect(dstRect); | 1340 FloatRect normalizedDstRect = normalizeRect(dstRect); |
| 1341 | 1341 |
| 1342 // Clip the rects to where the user thinks that the image is situated. | 1342 // Clip the rects to where the user thinks that the image is situated. |
| 1343 clipRectsToImageRect(IntRect(IntPoint(), bitmap->size()), &normalizedSrcRect
, &normalizedDstRect); | 1343 clipRectsToImageRect(IntRect(IntPoint(), bitmap->size()), &normalizedSrcRect
, &normalizedDstRect); |
| 1344 | 1344 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1357 if (!imageRect.intersects(actualSrcRect)) | 1357 if (!imageRect.intersects(actualSrcRect)) |
| 1358 return; | 1358 return; |
| 1359 | 1359 |
| 1360 RefPtr<Image> imageForRendering = bitmap->bitmapImage(); | 1360 RefPtr<Image> imageForRendering = bitmap->bitmapImage(); |
| 1361 if (!imageForRendering) | 1361 if (!imageForRendering) |
| 1362 return; | 1362 return; |
| 1363 | 1363 |
| 1364 drawImageInternal(imageForRendering.get(), actualSrcRect, actualDstRect, sta
te().m_globalComposite, state().m_globalBlend); | 1364 drawImageInternal(imageForRendering.get(), actualSrcRect, actualDstRect, sta
te().m_globalComposite, state().m_globalBlend); |
| 1365 } | 1365 } |
| 1366 | 1366 |
| 1367 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float
y, ExceptionState& es) | 1367 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float
y, ExceptionState& exceptionState) |
| 1368 { | 1368 { |
| 1369 if (!image) { | 1369 if (!image) { |
| 1370 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1370 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1371 return; | 1371 return; |
| 1372 } | 1372 } |
| 1373 LayoutSize destRectSize = sizeFor(image, ImageSizeAfterDevicePixelRatio); | 1373 LayoutSize destRectSize = sizeFor(image, ImageSizeAfterDevicePixelRatio); |
| 1374 drawImage(image, x, y, destRectSize.width(), destRectSize.height(), es); | 1374 drawImage(image, x, y, destRectSize.width(), destRectSize.height(), exceptio
nState); |
| 1375 } | 1375 } |
| 1376 | 1376 |
| 1377 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, | 1377 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, |
| 1378 float x, float y, float width, float height, ExceptionState& es) | 1378 float x, float y, float width, float height, ExceptionState& exceptionState) |
| 1379 { | 1379 { |
| 1380 if (!image) { | 1380 if (!image) { |
| 1381 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1381 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1382 return; | 1382 return; |
| 1383 } | 1383 } |
| 1384 LayoutSize sourceRectSize = sizeFor(image, ImageSizeBeforeDevicePixelRatio); | 1384 LayoutSize sourceRectSize = sizeFor(image, ImageSizeBeforeDevicePixelRatio); |
| 1385 drawImage(image, FloatRect(0, 0, sourceRectSize.width(), sourceRectSize.heig
ht()), FloatRect(x, y, width, height), es); | 1385 drawImage(image, FloatRect(0, 0, sourceRectSize.width(), sourceRectSize.heig
ht()), FloatRect(x, y, width, height), exceptionState); |
| 1386 } | 1386 } |
| 1387 | 1387 |
| 1388 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, | 1388 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, |
| 1389 float sx, float sy, float sw, float sh, | 1389 float sx, float sy, float sw, float sh, |
| 1390 float dx, float dy, float dw, float dh, ExceptionState& es) | 1390 float dx, float dy, float dw, float dh, ExceptionState& exceptionState) |
| 1391 { | 1391 { |
| 1392 drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), es); | 1392 drawImage(image, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), excep
tionState); |
| 1393 } | 1393 } |
| 1394 | 1394 |
| 1395 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
t& srcRect, const FloatRect& dstRect, ExceptionState& es) | 1395 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
t& srcRect, const FloatRect& dstRect, ExceptionState& exceptionState) |
| 1396 { | 1396 { |
| 1397 drawImage(image, srcRect, dstRect, state().m_globalComposite, state().m_glob
alBlend, es); | 1397 drawImage(image, srcRect, dstRect, state().m_globalComposite, state().m_glob
alBlend, exceptionState); |
| 1398 } | 1398 } |
| 1399 | 1399 |
| 1400 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
t& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMo
de& blendMode, ExceptionState& es) | 1400 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, const FloatRec
t& srcRect, const FloatRect& dstRect, const CompositeOperator& op, const BlendMo
de& blendMode, ExceptionState& exceptionState) |
| 1401 { | 1401 { |
| 1402 if (!image) { | 1402 if (!image) { |
| 1403 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1403 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1404 return; | 1404 return; |
| 1405 } | 1405 } |
| 1406 | 1406 |
| 1407 if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfi
nite(dstRect.width()) || !std::isfinite(dstRect.height()) | 1407 if (!std::isfinite(dstRect.x()) || !std::isfinite(dstRect.y()) || !std::isfi
nite(dstRect.width()) || !std::isfinite(dstRect.height()) |
| 1408 || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::i
sfinite(srcRect.width()) || !std::isfinite(srcRect.height())) | 1408 || !std::isfinite(srcRect.x()) || !std::isfinite(srcRect.y()) || !std::i
sfinite(srcRect.width()) || !std::isfinite(srcRect.height())) |
| 1409 return; | 1409 return; |
| 1410 | 1410 |
| 1411 ImageResource* cachedImage = image->cachedImage(); | 1411 ImageResource* cachedImage = image->cachedImage(); |
| 1412 if (!cachedImage || !image->complete()) | 1412 if (!cachedImage || !image->complete()) |
| 1413 return; | 1413 return; |
| 1414 | 1414 |
| 1415 LayoutSize size = sizeFor(image, ImageSizeBeforeDevicePixelRatio); | 1415 LayoutSize size = sizeFor(image, ImageSizeBeforeDevicePixelRatio); |
| 1416 if (!size.width() || !size.height()) { | 1416 if (!size.width() || !size.height()) { |
| 1417 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1417 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 1418 return; | 1418 return; |
| 1419 } | 1419 } |
| 1420 | 1420 |
| 1421 if (!dstRect.width() || !dstRect.height()) | 1421 if (!dstRect.width() || !dstRect.height()) |
| 1422 return; | 1422 return; |
| 1423 | 1423 |
| 1424 FloatRect normalizedSrcRect = normalizeRect(srcRect); | 1424 FloatRect normalizedSrcRect = normalizeRect(srcRect); |
| 1425 FloatRect normalizedDstRect = normalizeRect(dstRect); | 1425 FloatRect normalizedDstRect = normalizeRect(dstRect); |
| 1426 | 1426 |
| 1427 FloatRect imageRect = FloatRect(FloatPoint(), size); | 1427 FloatRect imageRect = FloatRect(FloatPoint(), size); |
| 1428 if (!srcRect.width() || !srcRect.height()) { | 1428 if (!srcRect.width() || !srcRect.height()) { |
| 1429 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1429 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1430 return; | 1430 return; |
| 1431 } | 1431 } |
| 1432 if (!imageRect.intersects(normalizedSrcRect)) | 1432 if (!imageRect.intersects(normalizedSrcRect)) |
| 1433 return; | 1433 return; |
| 1434 | 1434 |
| 1435 clipRectsToImageRect(imageRect, &normalizedSrcRect, &normalizedDstRect); | 1435 clipRectsToImageRect(imageRect, &normalizedSrcRect, &normalizedDstRect); |
| 1436 | 1436 |
| 1437 checkOrigin(image); | 1437 checkOrigin(image); |
| 1438 | 1438 |
| 1439 Image* imageForRendering = cachedImage->imageForRenderer(image->renderer()); | 1439 Image* imageForRendering = cachedImage->imageForRenderer(image->renderer()); |
| 1440 | 1440 |
| 1441 // For images that depend on an unavailable container size, we need to fall
back to the intrinsic | 1441 // For images that depend on an unavailable container size, we need to fall
back to the intrinsic |
| 1442 // object size. http://www.w3.org/TR/2dcontext2/#dom-context-2d-drawimage | 1442 // object size. http://www.w3.org/TR/2dcontext2/#dom-context-2d-drawimage |
| 1443 // FIXME: Without a specified image size this should resolve against the can
vas element's size, see: crbug.com/230163. | 1443 // FIXME: Without a specified image size this should resolve against the can
vas element's size, see: crbug.com/230163. |
| 1444 if (!image->renderer() && imageForRendering->usesContainerSize()) | 1444 if (!image->renderer() && imageForRendering->usesContainerSize()) |
| 1445 imageForRendering->setContainerSize(imageForRendering->size()); | 1445 imageForRendering->setContainerSize(imageForRendering->size()); |
| 1446 | 1446 |
| 1447 drawImageInternal(imageForRendering, normalizedSrcRect, normalizedDstRect, o
p, blendMode); | 1447 drawImageInternal(imageForRendering, normalizedSrcRect, normalizedDstRect, o
p, blendMode); |
| 1448 } | 1448 } |
| 1449 | 1449 |
| 1450 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float
x, float y, ExceptionState& es) | 1450 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, float
x, float y, ExceptionState& exceptionState) |
| 1451 { | 1451 { |
| 1452 drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(),
x, y, sourceCanvas->width(), sourceCanvas->height(), es); | 1452 drawImage(sourceCanvas, 0, 0, sourceCanvas->width(), sourceCanvas->height(),
x, y, sourceCanvas->width(), sourceCanvas->height(), exceptionState); |
| 1453 } | 1453 } |
| 1454 | 1454 |
| 1455 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, | 1455 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, |
| 1456 float x, float y, float width, float height, ExceptionState& es) | 1456 float x, float y, float width, float height, ExceptionState& exceptionState) |
| 1457 { | 1457 { |
| 1458 drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas-
>height()), FloatRect(x, y, width, height), es); | 1458 drawImage(sourceCanvas, FloatRect(0, 0, sourceCanvas->width(), sourceCanvas-
>height()), FloatRect(x, y, width, height), exceptionState); |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, | 1461 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, |
| 1462 float sx, float sy, float sw, float sh, | 1462 float sx, float sy, float sw, float sh, |
| 1463 float dx, float dy, float dw, float dh, ExceptionState& es) | 1463 float dx, float dy, float dw, float dh, ExceptionState& exceptionState) |
| 1464 { | 1464 { |
| 1465 drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh)
, es); | 1465 drawImage(sourceCanvas, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh)
, exceptionState); |
| 1466 } | 1466 } |
| 1467 | 1467 |
| 1468 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const
FloatRect& srcRect, | 1468 void CanvasRenderingContext2D::drawImage(HTMLCanvasElement* sourceCanvas, const
FloatRect& srcRect, |
| 1469 const FloatRect& dstRect, ExceptionState& es) | 1469 const FloatRect& dstRect, ExceptionState& exceptionState) |
| 1470 { | 1470 { |
| 1471 if (!sourceCanvas) { | 1471 if (!sourceCanvas) { |
| 1472 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1472 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1473 return; | 1473 return; |
| 1474 } | 1474 } |
| 1475 | 1475 |
| 1476 FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas->size()); | 1476 FloatRect srcCanvasRect = FloatRect(FloatPoint(), sourceCanvas->size()); |
| 1477 | 1477 |
| 1478 if (!srcCanvasRect.width() || !srcCanvasRect.height()) { | 1478 if (!srcCanvasRect.width() || !srcCanvasRect.height()) { |
| 1479 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1479 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 1480 return; | 1480 return; |
| 1481 } | 1481 } |
| 1482 | 1482 |
| 1483 if (!srcRect.width() || !srcRect.height()) { | 1483 if (!srcRect.width() || !srcRect.height()) { |
| 1484 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1484 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1485 return; | 1485 return; |
| 1486 } | 1486 } |
| 1487 | 1487 |
| 1488 FloatRect normalizedSrcRect = normalizeRect(srcRect); | 1488 FloatRect normalizedSrcRect = normalizeRect(srcRect); |
| 1489 FloatRect normalizedDstRect = normalizeRect(dstRect); | 1489 FloatRect normalizedDstRect = normalizeRect(dstRect); |
| 1490 | 1490 |
| 1491 if (!srcCanvasRect.intersects(normalizedSrcRect) || !normalizedDstRect.width
() || !normalizedDstRect.height()) | 1491 if (!srcCanvasRect.intersects(normalizedSrcRect) || !normalizedDstRect.width
() || !normalizedDstRect.height()) |
| 1492 return; | 1492 return; |
| 1493 | 1493 |
| 1494 clipRectsToImageRect(srcCanvasRect, &normalizedSrcRect, &normalizedDstRect); | 1494 clipRectsToImageRect(srcCanvasRect, &normalizedSrcRect, &normalizedDstRect); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1529 didDraw(clipBounds); | 1529 didDraw(clipBounds); |
| 1530 } else { | 1530 } else { |
| 1531 FloatRect dirtyRect; | 1531 FloatRect dirtyRect; |
| 1532 if (computeDirtyRect(normalizedDstRect, clipBounds, &dirtyRect)) { | 1532 if (computeDirtyRect(normalizedDstRect, clipBounds, &dirtyRect)) { |
| 1533 c->drawImageBuffer(buffer, normalizedDstRect, normalizedSrcRect, sta
te().m_globalComposite, state().m_globalBlend); | 1533 c->drawImageBuffer(buffer, normalizedDstRect, normalizedSrcRect, sta
te().m_globalComposite, state().m_globalBlend); |
| 1534 didDraw(dirtyRect); | 1534 didDraw(dirtyRect); |
| 1535 } | 1535 } |
| 1536 } | 1536 } |
| 1537 } | 1537 } |
| 1538 | 1538 |
| 1539 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, float x, float
y, ExceptionState& es) | 1539 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, float x, float
y, ExceptionState& exceptionState) |
| 1540 { | 1540 { |
| 1541 if (!video) { | 1541 if (!video) { |
| 1542 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1542 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1543 return; | 1543 return; |
| 1544 } | 1544 } |
| 1545 IntSize size = sizeFor(video); | 1545 IntSize size = sizeFor(video); |
| 1546 drawImage(video, x, y, size.width(), size.height(), es); | 1546 drawImage(video, x, y, size.width(), size.height(), exceptionState); |
| 1547 } | 1547 } |
| 1548 | 1548 |
| 1549 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, | 1549 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, |
| 1550 float x, float y, float width, float height, ExceptionState& es) | 1550 float x, float y, float width, float height, ExceptionState& exceptionState) |
| 1551 { | 1551 { |
| 1552 if (!video) { | 1552 if (!video) { |
| 1553 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1553 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1554 return; | 1554 return; |
| 1555 } | 1555 } |
| 1556 IntSize size = sizeFor(video); | 1556 IntSize size = sizeFor(video); |
| 1557 drawImage(video, FloatRect(0, 0, size.width(), size.height()), FloatRect(x,
y, width, height), es); | 1557 drawImage(video, FloatRect(0, 0, size.width(), size.height()), FloatRect(x,
y, width, height), exceptionState); |
| 1558 } | 1558 } |
| 1559 | 1559 |
| 1560 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, | 1560 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, |
| 1561 float sx, float sy, float sw, float sh, | 1561 float sx, float sy, float sw, float sh, |
| 1562 float dx, float dy, float dw, float dh, ExceptionState& es) | 1562 float dx, float dy, float dw, float dh, ExceptionState& exceptionState) |
| 1563 { | 1563 { |
| 1564 drawImage(video, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), es); | 1564 drawImage(video, FloatRect(sx, sy, sw, sh), FloatRect(dx, dy, dw, dh), excep
tionState); |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
t& srcRect, const FloatRect& dstRect, ExceptionState& es) | 1567 void CanvasRenderingContext2D::drawImage(HTMLVideoElement* video, const FloatRec
t& srcRect, const FloatRect& dstRect, ExceptionState& exceptionState) |
| 1568 { | 1568 { |
| 1569 if (!video) { | 1569 if (!video) { |
| 1570 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1570 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1571 return; | 1571 return; |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 if (video->readyState() == HTMLMediaElement::HAVE_NOTHING || video->readySta
te() == HTMLMediaElement::HAVE_METADATA) | 1574 if (video->readyState() == HTMLMediaElement::HAVE_NOTHING || video->readySta
te() == HTMLMediaElement::HAVE_METADATA) |
| 1575 return; | 1575 return; |
| 1576 | 1576 |
| 1577 FloatRect videoRect = FloatRect(FloatPoint(), sizeFor(video)); | 1577 FloatRect videoRect = FloatRect(FloatPoint(), sizeFor(video)); |
| 1578 if (!srcRect.width() || !srcRect.height()) { | 1578 if (!srcRect.width() || !srcRect.height()) { |
| 1579 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1579 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1580 return; | 1580 return; |
| 1581 } | 1581 } |
| 1582 | 1582 |
| 1583 FloatRect normalizedSrcRect = normalizeRect(srcRect); | 1583 FloatRect normalizedSrcRect = normalizeRect(srcRect); |
| 1584 FloatRect normalizedDstRect = normalizeRect(dstRect); | 1584 FloatRect normalizedDstRect = normalizeRect(dstRect); |
| 1585 | 1585 |
| 1586 if (!videoRect.intersects(normalizedSrcRect) || !normalizedDstRect.width() |
| !normalizedDstRect.height()) | 1586 if (!videoRect.intersects(normalizedSrcRect) || !normalizedDstRect.width() |
| !normalizedDstRect.height()) |
| 1587 return; | 1587 return; |
| 1588 | 1588 |
| 1589 clipRectsToImageRect(videoRect, &normalizedSrcRect, &normalizedDstRect); | 1589 clipRectsToImageRect(videoRect, &normalizedSrcRect, &normalizedDstRect); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1690 GraphicsContext* c = drawingContext(); | 1690 GraphicsContext* c = drawingContext(); |
| 1691 ASSERT(c); | 1691 ASSERT(c); |
| 1692 c->beginLayer(1, state().m_globalComposite); | 1692 c->beginLayer(1, state().m_globalComposite); |
| 1693 CompositeOperator previousOperator = c->compositeOperation(); | 1693 CompositeOperator previousOperator = c->compositeOperation(); |
| 1694 c->setCompositeOperation(CompositeSourceOver); | 1694 c->setCompositeOperation(CompositeSourceOver); |
| 1695 fillPrimitive(area, c); | 1695 fillPrimitive(area, c); |
| 1696 c->setCompositeOperation(previousOperator); | 1696 c->setCompositeOperation(previousOperator); |
| 1697 c->endLayer(); | 1697 c->endLayer(); |
| 1698 } | 1698 } |
| 1699 | 1699 |
| 1700 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float
x0, float y0, float x1, float y1, ExceptionState& es) | 1700 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createLinearGradient(float
x0, float y0, float x1, float y1, ExceptionState& exceptionState) |
| 1701 { | 1701 { |
| 1702 if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(x1) || !std::
isfinite(y1)) { | 1702 if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(x1) || !std::
isfinite(y1)) { |
| 1703 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1703 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1704 return 0; | 1704 return 0; |
| 1705 } | 1705 } |
| 1706 | 1706 |
| 1707 RefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0),
FloatPoint(x1, y1)); | 1707 RefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0),
FloatPoint(x1, y1)); |
| 1708 return gradient.release(); | 1708 return gradient.release(); |
| 1709 } | 1709 } |
| 1710 | 1710 |
| 1711 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float
x0, float y0, float r0, float x1, float y1, float r1, ExceptionState& es) | 1711 PassRefPtr<CanvasGradient> CanvasRenderingContext2D::createRadialGradient(float
x0, float y0, float r0, float x1, float y1, float r1, ExceptionState& exceptionS
tate) |
| 1712 { | 1712 { |
| 1713 if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(r0) || !std::
isfinite(x1) || !std::isfinite(y1) || !std::isfinite(r1)) { | 1713 if (!std::isfinite(x0) || !std::isfinite(y0) || !std::isfinite(r0) || !std::
isfinite(x1) || !std::isfinite(y1) || !std::isfinite(r1)) { |
| 1714 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1714 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1715 return 0; | 1715 return 0; |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 if (r0 < 0 || r1 < 0) { | 1718 if (r0 < 0 || r1 < 0) { |
| 1719 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1719 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1720 return 0; | 1720 return 0; |
| 1721 } | 1721 } |
| 1722 | 1722 |
| 1723 RefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0),
r0, FloatPoint(x1, y1), r1); | 1723 RefPtr<CanvasGradient> gradient = CanvasGradient::create(FloatPoint(x0, y0),
r0, FloatPoint(x1, y1), r1); |
| 1724 return gradient.release(); | 1724 return gradient.release(); |
| 1725 } | 1725 } |
| 1726 | 1726 |
| 1727 PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme
nt* image, | 1727 PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLImageEleme
nt* image, |
| 1728 const String& repetitionType, ExceptionState& es) | 1728 const String& repetitionType, ExceptionState& exceptionState) |
| 1729 { | 1729 { |
| 1730 if (!image) { | 1730 if (!image) { |
| 1731 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1731 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1732 return 0; | 1732 return 0; |
| 1733 } | 1733 } |
| 1734 bool repeatX, repeatY; | 1734 bool repeatX, repeatY; |
| 1735 CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, es); | 1735 CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, excepti
onState); |
| 1736 if (es.hadException()) | 1736 if (exceptionState.hadException()) |
| 1737 return 0; | 1737 return 0; |
| 1738 | 1738 |
| 1739 if (!image->complete()) | 1739 if (!image->complete()) |
| 1740 return 0; | 1740 return 0; |
| 1741 | 1741 |
| 1742 ImageResource* cachedImage = image->cachedImage(); | 1742 ImageResource* cachedImage = image->cachedImage(); |
| 1743 Image* imageForRendering = cachedImage ? cachedImage->imageForRenderer(image
->renderer()) : 0; | 1743 Image* imageForRendering = cachedImage ? cachedImage->imageForRenderer(image
->renderer()) : 0; |
| 1744 if (!imageForRendering) | 1744 if (!imageForRendering) |
| 1745 return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true)
; | 1745 return CanvasPattern::create(Image::nullImage(), repeatX, repeatY, true)
; |
| 1746 | 1746 |
| 1747 // We need to synthesize a container size if a renderer is not available to
provide one. | 1747 // We need to synthesize a container size if a renderer is not available to
provide one. |
| 1748 if (!image->renderer() && imageForRendering->usesContainerSize()) | 1748 if (!image->renderer() && imageForRendering->usesContainerSize()) |
| 1749 imageForRendering->setContainerSize(imageForRendering->size()); | 1749 imageForRendering->setContainerSize(imageForRendering->size()); |
| 1750 | 1750 |
| 1751 bool originClean = cachedImage->isAccessAllowed(canvas()->securityOrigin()); | 1751 bool originClean = cachedImage->isAccessAllowed(canvas()->securityOrigin()); |
| 1752 return CanvasPattern::create(imageForRendering, repeatX, repeatY, originClea
n); | 1752 return CanvasPattern::create(imageForRendering, repeatX, repeatY, originClea
n); |
| 1753 } | 1753 } |
| 1754 | 1754 |
| 1755 PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElem
ent* canvas, | 1755 PassRefPtr<CanvasPattern> CanvasRenderingContext2D::createPattern(HTMLCanvasElem
ent* canvas, |
| 1756 const String& repetitionType, ExceptionState& es) | 1756 const String& repetitionType, ExceptionState& exceptionState) |
| 1757 { | 1757 { |
| 1758 if (!canvas) { | 1758 if (!canvas) { |
| 1759 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1759 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1760 return 0; | 1760 return 0; |
| 1761 } | 1761 } |
| 1762 if (!canvas->width() || !canvas->height()) { | 1762 if (!canvas->width() || !canvas->height()) { |
| 1763 es.throwUninformativeAndGenericDOMException(InvalidStateError); | 1763 exceptionState.throwUninformativeAndGenericDOMException(InvalidStateErro
r); |
| 1764 return 0; | 1764 return 0; |
| 1765 } | 1765 } |
| 1766 | 1766 |
| 1767 bool repeatX, repeatY; | 1767 bool repeatX, repeatY; |
| 1768 CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, es); | 1768 CanvasPattern::parseRepetitionType(repetitionType, repeatX, repeatY, excepti
onState); |
| 1769 if (es.hadException()) | 1769 if (exceptionState.hadException()) |
| 1770 return 0; | 1770 return 0; |
| 1771 return CanvasPattern::create(canvas->copiedImage(), repeatX, repeatY, canvas
->originClean()); | 1771 return CanvasPattern::create(canvas->copiedImage(), repeatX, repeatY, canvas
->originClean()); |
| 1772 } | 1772 } |
| 1773 | 1773 |
| 1774 bool CanvasRenderingContext2D::computeDirtyRect(const FloatRect& localRect, Floa
tRect* dirtyRect) | 1774 bool CanvasRenderingContext2D::computeDirtyRect(const FloatRect& localRect, Floa
tRect* dirtyRect) |
| 1775 { | 1775 { |
| 1776 FloatRect clipBounds; | 1776 FloatRect clipBounds; |
| 1777 if (!drawingContext()->getTransformedClipBounds(&clipBounds)) | 1777 if (!drawingContext()->getTransformedClipBounds(&clipBounds)) |
| 1778 return false; | 1778 return false; |
| 1779 return computeDirtyRect(localRect, clipBounds, dirtyRect); | 1779 return computeDirtyRect(localRect, clipBounds, dirtyRect); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 dataSize *= size.width(); | 1830 dataSize *= size.width(); |
| 1831 dataSize *= size.height(); | 1831 dataSize *= size.height(); |
| 1832 if (dataSize.hasOverflowed()) | 1832 if (dataSize.hasOverflowed()) |
| 1833 return 0; | 1833 return 0; |
| 1834 | 1834 |
| 1835 RefPtr<ImageData> data = ImageData::create(size); | 1835 RefPtr<ImageData> data = ImageData::create(size); |
| 1836 data->data()->zeroFill(); | 1836 data->data()->zeroFill(); |
| 1837 return data.release(); | 1837 return data.release(); |
| 1838 } | 1838 } |
| 1839 | 1839 |
| 1840 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<Image
Data> imageData, ExceptionState& es) const | 1840 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<Image
Data> imageData, ExceptionState& exceptionState) const |
| 1841 { | 1841 { |
| 1842 if (!imageData) { | 1842 if (!imageData) { |
| 1843 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1843 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1844 return 0; | 1844 return 0; |
| 1845 } | 1845 } |
| 1846 | 1846 |
| 1847 return createEmptyImageData(imageData->size()); | 1847 return createEmptyImageData(imageData->size()); |
| 1848 } | 1848 } |
| 1849 | 1849 |
| 1850 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float
sh, ExceptionState& es) const | 1850 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float
sh, ExceptionState& exceptionState) const |
| 1851 { | 1851 { |
| 1852 if (!sw || !sh) { | 1852 if (!sw || !sh) { |
| 1853 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1853 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1854 return 0; | 1854 return 0; |
| 1855 } | 1855 } |
| 1856 if (!std::isfinite(sw) || !std::isfinite(sh)) { | 1856 if (!std::isfinite(sw) || !std::isfinite(sh)) { |
| 1857 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1857 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1858 return 0; | 1858 return 0; |
| 1859 } | 1859 } |
| 1860 | 1860 |
| 1861 FloatSize logicalSize(fabs(sw), fabs(sh)); | 1861 FloatSize logicalSize(fabs(sw), fabs(sh)); |
| 1862 if (!logicalSize.isExpressibleAsIntSize()) | 1862 if (!logicalSize.isExpressibleAsIntSize()) |
| 1863 return 0; | 1863 return 0; |
| 1864 | 1864 |
| 1865 IntSize size = expandedIntSize(logicalSize); | 1865 IntSize size = expandedIntSize(logicalSize); |
| 1866 if (size.width() < 1) | 1866 if (size.width() < 1) |
| 1867 size.setWidth(1); | 1867 size.setWidth(1); |
| 1868 if (size.height() < 1) | 1868 if (size.height() < 1) |
| 1869 size.setHeight(1); | 1869 size.setHeight(1); |
| 1870 | 1870 |
| 1871 return createEmptyImageData(size); | 1871 return createEmptyImageData(size); |
| 1872 } | 1872 } |
| 1873 | 1873 |
| 1874 PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy,
float sw, float sh, ExceptionState& es) const | 1874 PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy,
float sw, float sh, ExceptionState& exceptionState) const |
| 1875 { | 1875 { |
| 1876 return getImageData(ImageBuffer::LogicalCoordinateSystem, sx, sy, sw, sh, es
); | 1876 return getImageData(ImageBuffer::LogicalCoordinateSystem, sx, sy, sw, sh, ex
ceptionState); |
| 1877 } | 1877 } |
| 1878 | 1878 |
| 1879 PassRefPtr<ImageData> CanvasRenderingContext2D::webkitGetImageDataHD(float sx, f
loat sy, float sw, float sh, ExceptionState& es) const | 1879 PassRefPtr<ImageData> CanvasRenderingContext2D::webkitGetImageDataHD(float sx, f
loat sy, float sw, float sh, ExceptionState& exceptionState) const |
| 1880 { | 1880 { |
| 1881 return getImageData(ImageBuffer::BackingStoreCoordinateSystem, sx, sy, sw, s
h, es); | 1881 return getImageData(ImageBuffer::BackingStoreCoordinateSystem, sx, sy, sw, s
h, exceptionState); |
| 1882 } | 1882 } |
| 1883 | 1883 |
| 1884 PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(ImageBuffer::Coordi
nateSystem coordinateSystem, float sx, float sy, float sw, float sh, ExceptionSt
ate& es) const | 1884 PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(ImageBuffer::Coordi
nateSystem coordinateSystem, float sx, float sy, float sw, float sh, ExceptionSt
ate& exceptionState) const |
| 1885 { | 1885 { |
| 1886 if (!canvas()->originClean()) { | 1886 if (!canvas()->originClean()) { |
| 1887 es.throwSecurityError(ExceptionMessages::failedToExecute("getImageData",
"CanvasRenderingContext2D", "the canvas has been tainted by cross-origin data."
)); | 1887 exceptionState.throwSecurityError(ExceptionMessages::failedToExecute("ge
tImageData", "CanvasRenderingContext2D", "the canvas has been tainted by cross-o
rigin data.")); |
| 1888 return 0; | 1888 return 0; |
| 1889 } | 1889 } |
| 1890 | 1890 |
| 1891 if (!sw || !sh) { | 1891 if (!sw || !sh) { |
| 1892 es.throwUninformativeAndGenericDOMException(IndexSizeError); | 1892 exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 1893 return 0; | 1893 return 0; |
| 1894 } | 1894 } |
| 1895 if (!std::isfinite(sx) || !std::isfinite(sy) || !std::isfinite(sw) || !std::
isfinite(sh)) { | 1895 if (!std::isfinite(sx) || !std::isfinite(sy) || !std::isfinite(sw) || !std::
isfinite(sh)) { |
| 1896 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1896 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1897 return 0; | 1897 return 0; |
| 1898 } | 1898 } |
| 1899 | 1899 |
| 1900 if (sw < 0) { | 1900 if (sw < 0) { |
| 1901 sx += sw; | 1901 sx += sw; |
| 1902 sw = -sw; | 1902 sw = -sw; |
| 1903 } | 1903 } |
| 1904 if (sh < 0) { | 1904 if (sh < 0) { |
| 1905 sy += sh; | 1905 sy += sh; |
| 1906 sh = -sh; | 1906 sh = -sh; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1919 if (!buffer) | 1919 if (!buffer) |
| 1920 return createEmptyImageData(imageDataRect.size()); | 1920 return createEmptyImageData(imageDataRect.size()); |
| 1921 | 1921 |
| 1922 RefPtr<Uint8ClampedArray> byteArray = buffer->getUnmultipliedImageData(image
DataRect, coordinateSystem); | 1922 RefPtr<Uint8ClampedArray> byteArray = buffer->getUnmultipliedImageData(image
DataRect, coordinateSystem); |
| 1923 if (!byteArray) | 1923 if (!byteArray) |
| 1924 return 0; | 1924 return 0; |
| 1925 | 1925 |
| 1926 return ImageData::create(imageDataRect.size(), byteArray.release()); | 1926 return ImageData::create(imageDataRect.size(), byteArray.release()); |
| 1927 } | 1927 } |
| 1928 | 1928 |
| 1929 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
ExceptionState& es) | 1929 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
ExceptionState& exceptionState) |
| 1930 { | 1930 { |
| 1931 if (!data) { | 1931 if (!data) { |
| 1932 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1932 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1933 return; | 1933 return; |
| 1934 } | 1934 } |
| 1935 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), es); | 1935 putImageData(data, dx, dy, 0, 0, data->width(), data->height(), exceptionSta
te); |
| 1936 } | 1936 } |
| 1937 | 1937 |
| 1938 void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, f
loat dy, ExceptionState& es) | 1938 void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, f
loat dy, ExceptionState& exceptionState) |
| 1939 { | 1939 { |
| 1940 if (!data) { | 1940 if (!data) { |
| 1941 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1941 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1942 return; | 1942 return; |
| 1943 } | 1943 } |
| 1944 webkitPutImageDataHD(data, dx, dy, 0, 0, data->width(), data->height(), es); | 1944 webkitPutImageDataHD(data, dx, dy, 0, 0, data->width(), data->height(), exce
ptionState); |
| 1945 } | 1945 } |
| 1946 | 1946 |
| 1947 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
float dirtyX, float dirtyY, | 1947 void CanvasRenderingContext2D::putImageData(ImageData* data, float dx, float dy,
float dirtyX, float dirtyY, |
| 1948 float dirtyWidth, float dirtyHeight, ExceptionState& es) | 1948 float dirtyWidth, float dirtyHeight, ExceptionState& exceptionState) |
| 1949 { | 1949 { |
| 1950 putImageData(data, ImageBuffer::LogicalCoordinateSystem, dx, dy, dirtyX, dir
tyY, dirtyWidth, dirtyHeight, es); | 1950 putImageData(data, ImageBuffer::LogicalCoordinateSystem, dx, dy, dirtyX, dir
tyY, dirtyWidth, dirtyHeight, exceptionState); |
| 1951 } | 1951 } |
| 1952 | 1952 |
| 1953 void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, f
loat dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, Except
ionState& es) | 1953 void CanvasRenderingContext2D::webkitPutImageDataHD(ImageData* data, float dx, f
loat dy, float dirtyX, float dirtyY, float dirtyWidth, float dirtyHeight, Except
ionState& exceptionState) |
| 1954 { | 1954 { |
| 1955 putImageData(data, ImageBuffer::BackingStoreCoordinateSystem, dx, dy, dirtyX
, dirtyY, dirtyWidth, dirtyHeight, es); | 1955 putImageData(data, ImageBuffer::BackingStoreCoordinateSystem, dx, dy, dirtyX
, dirtyY, dirtyWidth, dirtyHeight, exceptionState); |
| 1956 } | 1956 } |
| 1957 | 1957 |
| 1958 void CanvasRenderingContext2D::putImageData(ImageData* data, ImageBuffer::Coordi
nateSystem coordinateSystem, float dx, float dy, float dirtyX, float dirtyY, | 1958 void CanvasRenderingContext2D::putImageData(ImageData* data, ImageBuffer::Coordi
nateSystem coordinateSystem, float dx, float dy, float dirtyX, float dirtyY, |
| 1959 float dirtyWidth, float dirtyHeight, ExceptionState& es) | 1959 float dirtyWidth, float dirtyHeight, ExceptionState& exceptionState) |
| 1960 { | 1960 { |
| 1961 if (!data) { | 1961 if (!data) { |
| 1962 es.throwUninformativeAndGenericDOMException(TypeMismatchError); | 1962 exceptionState.throwUninformativeAndGenericDOMException(TypeMismatchErro
r); |
| 1963 return; | 1963 return; |
| 1964 } | 1964 } |
| 1965 if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dirtyX) || !s
td::isfinite(dirtyY) || !std::isfinite(dirtyWidth) || !std::isfinite(dirtyHeight
)) { | 1965 if (!std::isfinite(dx) || !std::isfinite(dy) || !std::isfinite(dirtyX) || !s
td::isfinite(dirtyY) || !std::isfinite(dirtyWidth) || !std::isfinite(dirtyHeight
)) { |
| 1966 es.throwUninformativeAndGenericDOMException(NotSupportedError); | 1966 exceptionState.throwUninformativeAndGenericDOMException(NotSupportedErro
r); |
| 1967 return; | 1967 return; |
| 1968 } | 1968 } |
| 1969 | 1969 |
| 1970 ImageBuffer* buffer = canvas()->buffer(); | 1970 ImageBuffer* buffer = canvas()->buffer(); |
| 1971 if (!buffer) | 1971 if (!buffer) |
| 1972 return; | 1972 return; |
| 1973 | 1973 |
| 1974 if (dirtyWidth < 0) { | 1974 if (dirtyWidth < 0) { |
| 1975 dirtyX += dirtyWidth; | 1975 dirtyX += dirtyWidth; |
| 1976 dirtyWidth = -dirtyWidth; | 1976 dirtyWidth = -dirtyWidth; |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2429 const int focusRingWidth = 5; | 2429 const int focusRingWidth = 5; |
| 2430 const int focusRingOutline = 0; | 2430 const int focusRingOutline = 0; |
| 2431 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); | 2431 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); |
| 2432 | 2432 |
| 2433 c->restore(); | 2433 c->restore(); |
| 2434 | 2434 |
| 2435 didDraw(dirtyRect); | 2435 didDraw(dirtyRect); |
| 2436 } | 2436 } |
| 2437 | 2437 |
| 2438 } // namespace WebCore | 2438 } // namespace WebCore |
| OLD | NEW |