| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "core/css/StylePropertySet.h" | 42 #include "core/css/StylePropertySet.h" |
| 43 #include "core/css/resolver/StyleResolver.h" | 43 #include "core/css/resolver/StyleResolver.h" |
| 44 #include "core/dom/ExceptionCode.h" | 44 #include "core/dom/ExceptionCode.h" |
| 45 #include "core/dom/StyleEngine.h" | 45 #include "core/dom/StyleEngine.h" |
| 46 #include "core/events/Event.h" | 46 #include "core/events/Event.h" |
| 47 #include "core/fetch/ImageResource.h" | 47 #include "core/fetch/ImageResource.h" |
| 48 #include "core/frame/ImageBitmap.h" | 48 #include "core/frame/ImageBitmap.h" |
| 49 #include "core/html/HTMLCanvasElement.h" | 49 #include "core/html/HTMLCanvasElement.h" |
| 50 #include "core/html/HTMLImageElement.h" | 50 #include "core/html/HTMLImageElement.h" |
| 51 #include "core/html/HTMLMediaElement.h" | 51 #include "core/html/HTMLMediaElement.h" |
| 52 #include "core/html/HTMLVideoElement.h" | |
| 53 #include "core/html/ImageData.h" | 52 #include "core/html/ImageData.h" |
| 54 #include "core/html/TextMetrics.h" | 53 #include "core/html/TextMetrics.h" |
| 55 #include "core/html/canvas/CanvasGradient.h" | 54 #include "core/html/canvas/CanvasGradient.h" |
| 56 #include "core/html/canvas/CanvasPattern.h" | 55 #include "core/html/canvas/CanvasPattern.h" |
| 57 #include "core/html/canvas/CanvasStyle.h" | 56 #include "core/html/canvas/CanvasStyle.h" |
| 58 #include "core/html/canvas/Path2D.h" | 57 #include "core/html/canvas/Path2D.h" |
| 59 #include "core/rendering/RenderImage.h" | 58 #include "core/rendering/RenderImage.h" |
| 60 #include "core/rendering/RenderLayer.h" | 59 #include "core/rendering/RenderLayer.h" |
| 61 #include "core/rendering/RenderTheme.h" | 60 #include "core/rendering/RenderTheme.h" |
| 62 #include "platform/fonts/FontCache.h" | 61 #include "platform/fonts/FontCache.h" |
| (...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 FloatRect dstRect = normalizeRect(FloatRect(dx, dy, dw, dh)); | 1504 FloatRect dstRect = normalizeRect(FloatRect(dx, dy, dw, dh)); |
| 1506 | 1505 |
| 1507 clipRectsToImageRect(FloatRect(FloatPoint(), imageSource->sourceSize()), &sr
cRect, &dstRect); | 1506 clipRectsToImageRect(FloatRect(FloatPoint(), imageSource->sourceSize()), &sr
cRect, &dstRect); |
| 1508 | 1507 |
| 1509 imageSource->adjustDrawRects(&srcRect, &dstRect); | 1508 imageSource->adjustDrawRects(&srcRect, &dstRect); |
| 1510 | 1509 |
| 1511 if (srcRect.isEmpty()) | 1510 if (srcRect.isEmpty()) |
| 1512 return; | 1511 return; |
| 1513 | 1512 |
| 1514 FloatRect dirtyRect = clipBounds; | 1513 FloatRect dirtyRect = clipBounds; |
| 1515 if (imageSource->isVideoElement()) { | 1514 if (rectContainsTransformedRect(dstRect, clipBounds)) { |
| 1516 // TODO(dshwang): unify video code into below code to composite correctl
y; crbug.com/407079 | 1515 c->drawImage(image.get(), dstRect, srcRect, op, blendMode); |
| 1517 drawVideo(static_cast<HTMLVideoElement*>(imageSource), srcRect, dstRect)
; | 1516 } else if (isFullCanvasCompositeMode(op)) { |
| 1517 fullCanvasCompositedDrawImage(image.get(), dstRect, srcRect, op); |
| 1518 } else if (op == CompositeCopy) { |
| 1519 clearCanvas(); |
| 1520 c->drawImage(image.get(), dstRect, srcRect, op, blendMode); |
| 1521 } else { |
| 1522 FloatRect dirtyRect; |
| 1518 computeDirtyRect(dstRect, clipBounds, &dirtyRect); | 1523 computeDirtyRect(dstRect, clipBounds, &dirtyRect); |
| 1519 } else { | 1524 c->drawImage(image.get(), dstRect, srcRect, op, blendMode); |
| 1520 if (rectContainsTransformedRect(dstRect, clipBounds)) { | 1525 } |
| 1521 c->drawImage(image.get(), dstRect, srcRect, op, blendMode); | |
| 1522 } else if (isFullCanvasCompositeMode(op)) { | |
| 1523 fullCanvasCompositedDrawImage(image.get(), dstRect, srcRect, op); | |
| 1524 } else if (op == CompositeCopy) { | |
| 1525 clearCanvas(); | |
| 1526 c->drawImage(image.get(), dstRect, srcRect, op, blendMode); | |
| 1527 } else { | |
| 1528 FloatRect dirtyRect; | |
| 1529 computeDirtyRect(dstRect, clipBounds, &dirtyRect); | |
| 1530 c->drawImage(image.get(), dstRect, srcRect, op, blendMode); | |
| 1531 } | |
| 1532 | 1526 |
| 1533 if (sourceImageStatus == ExternalSourceImageStatus && isAccelerated() &&
canvas()->buffer()) | 1527 if (sourceImageStatus == ExternalSourceImageStatus && isAccelerated() && can
vas()->buffer()) |
| 1534 canvas()->buffer()->flush(); | 1528 canvas()->buffer()->flush(); |
| 1535 } | |
| 1536 | 1529 |
| 1537 didDraw(dirtyRect); | 1530 didDraw(dirtyRect); |
| 1538 } | 1531 } |
| 1539 | 1532 |
| 1540 void CanvasRenderingContext2D::drawVideo(HTMLVideoElement* video, FloatRect srcR
ect, FloatRect dstRect) | |
| 1541 { | |
| 1542 GraphicsContext* c = drawingContext(); | |
| 1543 GraphicsContextStateSaver stateSaver(*c); | |
| 1544 c->clip(dstRect); | |
| 1545 c->translate(dstRect.x(), dstRect.y()); | |
| 1546 c->scale(dstRect.width() / srcRect.width(), dstRect.height() / srcRect.heigh
t()); | |
| 1547 c->translate(-srcRect.x(), -srcRect.y()); | |
| 1548 video->paintCurrentFrameInContext(c, IntRect(IntPoint(), IntSize(video->vide
oWidth(), video->videoHeight()))); | |
| 1549 stateSaver.restore(); | |
| 1550 validateStateStack(); | |
| 1551 } | |
| 1552 | |
| 1553 void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image, | 1533 void CanvasRenderingContext2D::drawImageFromRect(HTMLImageElement* image, |
| 1554 float sx, float sy, float sw, float sh, | 1534 float sx, float sy, float sw, float sh, |
| 1555 float dx, float dy, float dw, float dh, | 1535 float dx, float dy, float dw, float dh, |
| 1556 const String& compositeOperation) | 1536 const String& compositeOperation) |
| 1557 { | 1537 { |
| 1558 if (!image) | 1538 if (!image) |
| 1559 return; | 1539 return; |
| 1560 CompositeOperator op; | 1540 CompositeOperator op; |
| 1561 blink::WebBlendMode blendOp = blink::WebBlendModeNormal; | 1541 blink::WebBlendMode blendOp = blink::WebBlendModeNormal; |
| 1562 if (!parseCompositeAndBlendOperator(compositeOperation, op, blendOp) || blen
dOp != blink::WebBlendModeNormal) | 1542 if (!parseCompositeAndBlendOperator(compositeOperation, op, blendOp) || blen
dOp != blink::WebBlendModeNormal) |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 | 2463 |
| 2484 unsigned CanvasRenderingContext2D::hitRegionsCount() const | 2464 unsigned CanvasRenderingContext2D::hitRegionsCount() const |
| 2485 { | 2465 { |
| 2486 if (m_hitRegionManager) | 2466 if (m_hitRegionManager) |
| 2487 return m_hitRegionManager->getHitRegionsCount(); | 2467 return m_hitRegionManager->getHitRegionsCount(); |
| 2488 | 2468 |
| 2489 return 0; | 2469 return 0; |
| 2490 } | 2470 } |
| 2491 | 2471 |
| 2492 } // namespace blink | 2472 } // namespace blink |
| OLD | NEW |