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

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

Issue 1084313004: Oilpan: keep ImageData on the heap by default. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ensure timely disposal of temporary ImageData buffers Created 5 years, 7 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 | Annotate | Revision Log
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 1535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1546 return canvas()->drawingCanvas(); 1546 return canvas()->drawingCanvas();
1547 } 1547 }
1548 1548
1549 GraphicsContext* CanvasRenderingContext2D::drawingContext() const 1549 GraphicsContext* CanvasRenderingContext2D::drawingContext() const
1550 { 1550 {
1551 if (isContextLost()) 1551 if (isContextLost())
1552 return nullptr; 1552 return nullptr;
1553 return canvas()->drawingContext(); 1553 return canvas()->drawingContext();
1554 } 1554 }
1555 1555
1556 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(Pass RefPtrWillBeRawPtr<ImageData> imageData) const 1556 ImageData* CanvasRenderingContext2D::createImageData(ImageData* imageData) const
1557 { 1557 {
1558 return ImageData::create(imageData->size()); 1558 return ImageData::create(imageData->size());
1559 } 1559 }
1560 1560
1561 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::createImageData(floa t sw, float sh, ExceptionState& exceptionState) const 1561 ImageData* CanvasRenderingContext2D::createImageData(float sw, float sh, Excepti onState& exceptionState) const
1562 { 1562 {
1563 if (!sw || !sh) { 1563 if (!sw || !sh) {
1564 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1564 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1565 return nullptr; 1565 return nullptr;
1566 } 1566 }
1567 1567
1568 FloatSize logicalSize(fabs(sw), fabs(sh)); 1568 FloatSize logicalSize(fabs(sw), fabs(sh));
1569 if (!logicalSize.isExpressibleAsIntSize()) 1569 if (!logicalSize.isExpressibleAsIntSize())
1570 return nullptr; 1570 return nullptr;
1571 1571
1572 IntSize size = expandedIntSize(logicalSize); 1572 IntSize size = expandedIntSize(logicalSize);
1573 if (size.width() < 1) 1573 if (size.width() < 1)
1574 size.setWidth(1); 1574 size.setWidth(1);
1575 if (size.height() < 1) 1575 if (size.height() < 1)
1576 size.setHeight(1); 1576 size.setHeight(1);
1577 1577
1578 return ImageData::create(size); 1578 return ImageData::create(size);
1579 } 1579 }
1580 1580
1581 PassRefPtrWillBeRawPtr<ImageData> CanvasRenderingContext2D::getImageData(float s x, float sy, float sw, float sh, ExceptionState& exceptionState) const 1581 ImageData* CanvasRenderingContext2D::getImageData(float sx, float sy, float sw, float sh, ExceptionState& exceptionState) const
1582 { 1582 {
1583 if (!canvas()->originClean()) 1583 if (!canvas()->originClean())
1584 exceptionState.throwSecurityError("The canvas has been tainted by cross- origin data."); 1584 exceptionState.throwSecurityError("The canvas has been tainted by cross- origin data.");
1585 else if (!sw || !sh) 1585 else if (!sw || !sh)
1586 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width")); 1586 exceptionState.throwDOMException(IndexSizeError, String::format("The sou rce %s is 0.", sw ? "height" : "width"));
1587 1587
1588 if (exceptionState.hadException()) 1588 if (exceptionState.hadException())
1589 return nullptr; 1589 return nullptr;
1590 1590
1591 if (sw < 0) { 1591 if (sw < 0) {
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
2291 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage) 2291 if (imageType == CanvasRenderingContext2DState::NonOpaqueImage)
2292 return; 2292 return;
2293 if (alpha < 0xFF) 2293 if (alpha < 0xFF)
2294 return; 2294 return;
2295 } 2295 }
2296 2296
2297 canvas()->buffer()->willOverwriteCanvas(); 2297 canvas()->buffer()->willOverwriteCanvas();
2298 } 2298 }
2299 2299
2300 } // namespace blink 2300 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.h ('k') | Source/core/html/canvas/CanvasRenderingContext2DAPITest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698