Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2D.cpp

Issue 214153006: Oilpan: move ImageData to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add ImageData 'explicit' Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 } 1660 }
1661 1661
1662 canvas()->didDraw(dirtyRect); 1662 canvas()->didDraw(dirtyRect);
1663 } 1663 }
1664 1664
1665 GraphicsContext* CanvasRenderingContext2D::drawingContext() const 1665 GraphicsContext* CanvasRenderingContext2D::drawingContext() const
1666 { 1666 {
1667 return canvas()->drawingContext(); 1667 return canvas()->drawingContext();
1668 } 1668 }
1669 1669
1670 static PassRefPtr<ImageData> createEmptyImageData(const IntSize& size) 1670 static PassRefPtrWillBeRawPtr<ImageData> createEmptyImageData(const IntSize& siz e)
1671 { 1671 {
1672 if (RefPtr<ImageData> data = ImageData::create(size)) { 1672 if (RefPtrWillBeRawPtr<ImageData> data = ImageData::create(size)) {
1673 data->data()->zeroFill(); 1673 data->data()->zeroFill();
1674 return data.release(); 1674 return data.release();
1675 } 1675 }
1676 1676
1677 return nullptr; 1677 return nullptr;
1678 } 1678 }
1679 1679
1680 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<Image Data> imageData, ExceptionState& exceptionState) const 1680 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(Pass RefPtrWillBeRawPtr<ImageData> imageData, ExceptionState& exceptionState) const
1681 { 1681 {
1682 if (!imageData) { 1682 if (!imageData) {
1683 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "ImageData")); 1683 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::a rgumentNullOrIncorrectType(1, "ImageData"));
1684 return nullptr; 1684 return nullptr;
1685 } 1685 }
1686 1686
1687 return createEmptyImageData(imageData->size()); 1687 return createEmptyImageData(imageData->size());
1688 } 1688 }
1689 1689
1690 PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(float sw, float sh, ExceptionState& exceptionState) const 1690 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(floa t sw, float sh, ExceptionState& exceptionState) const
1691 { 1691 {
1692 if (!sw || !sh) 1692 if (!sw || !sh)
1693 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1693 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1694 else if (!std::isfinite(sw)) 1694 else if (!std::isfinite(sw))
1695 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width")); 1695 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sw, "source width"));
1696 else if (!std::isfinite(sh)) 1696 else if (!std::isfinite(sh))
1697 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height")); 1697 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sh, "source height"));
1698 1698
1699 if (exceptionState.hadException()) 1699 if (exceptionState.hadException())
1700 return nullptr; 1700 return nullptr;
1701 1701
1702 FloatSize logicalSize(fabs(sw), fabs(sh)); 1702 FloatSize logicalSize(fabs(sw), fabs(sh));
1703 if (!logicalSize.isExpressibleAsIntSize()) 1703 if (!logicalSize.isExpressibleAsIntSize())
1704 return nullptr; 1704 return nullptr;
1705 1705
1706 IntSize size = expandedIntSize(logicalSize); 1706 IntSize size = expandedIntSize(logicalSize);
1707 if (size.width() < 1) 1707 if (size.width() < 1)
1708 size.setWidth(1); 1708 size.setWidth(1);
1709 if (size.height() < 1) 1709 if (size.height() < 1)
1710 size.setHeight(1); 1710 size.setHeight(1);
1711 1711
1712 return createEmptyImageData(size); 1712 return createEmptyImageData(size);
1713 } 1713 }
1714 1714
1715 PassRefPtr<ImageData> CanvasRenderingContext2D::getImageData(float sx, float sy, float sw, float sh, ExceptionState& exceptionState) const 1715 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::getImageData(float s x, float sy, float sw, float sh, ExceptionState& exceptionState) const
1716 { 1716 {
1717 if (!canvas()->originClean()) 1717 if (!canvas()->originClean())
1718 exceptionState.throwSecurityError("The canvas has been tainted by cross- origin data."); 1718 exceptionState.throwSecurityError("The canvas has been tainted by cross- origin data.");
1719 else if (!sw || !sh) 1719 else if (!sw || !sh)
1720 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1720 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1721 else if (!std::isfinite(sx)) 1721 else if (!std::isfinite(sx))
1722 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sx, "source X")); 1722 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sx, "source X"));
1723 else if (!std::isfinite(sy)) 1723 else if (!std::isfinite(sy))
1724 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sy, "source Y")); 1724 exceptionState.throwDOMException(NotSupportedError, ExceptionMessages::n otAFiniteNumber(sy, "source Y"));
1725 else if (!std::isfinite(sw)) 1725 else if (!std::isfinite(sw))
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
2296 c->setAlphaAsFloat(1.0); 2296 c->setAlphaAsFloat(1.0);
2297 c->clearShadow(); 2297 c->clearShadow();
2298 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal); 2298 c->setCompositeOperation(CompositeSourceOver, blink::WebBlendModeNormal);
2299 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2299 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2300 c->restore(); 2300 c->restore();
2301 2301
2302 didDraw(dirtyRect); 2302 didDraw(dirtyRect);
2303 } 2303 }
2304 2304
2305 } // namespace WebCore 2305 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/WebGLRenderingContextBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698