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

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

Issue 19393004: Allow eviction of ImageBitmaps that are created from ImageElements. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 Intel Corporation. All rights reserved. 8 * Copyright (C) 2012 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 1257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 actualDstRect.moveBy(normalizedDstRect.location()); 1268 actualDstRect.moveBy(normalizedDstRect.location());
1269 1269
1270 FloatRect imageRect = FloatRect(FloatPoint(), bitmap->bitmapSize()); 1270 FloatRect imageRect = FloatRect(FloatPoint(), bitmap->bitmapSize());
1271 if (!srcRect.width() || !srcRect.height()) { 1271 if (!srcRect.width() || !srcRect.height()) {
1272 ec = IndexSizeError; 1272 ec = IndexSizeError;
1273 return; 1273 return;
1274 } 1274 }
1275 if (!imageRect.contains(normalizedSrcRect)) 1275 if (!imageRect.contains(normalizedSrcRect))
1276 return; 1276 return;
1277 1277
1278 Image* imageForRendering = bitmap->bitmapImage(); 1278 RefPtr<Image> imageForRendering = bitmap->bitmapImage();
1279 1279
1280 drawImageInternal(imageForRendering, normalizedSrcRect, actualDstRect, state ().m_globalComposite, state().m_globalBlend); 1280 drawImageInternal(imageForRendering.get(), normalizedSrcRect, actualDstRect, state().m_globalComposite, state().m_globalBlend);
1281 } 1281 }
1282 1282
1283 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y, ExceptionCode& ec) 1283 void CanvasRenderingContext2D::drawImage(HTMLImageElement* image, float x, float y, ExceptionCode& ec)
1284 { 1284 {
1285 if (!image) { 1285 if (!image) {
1286 ec = TypeMismatchError; 1286 ec = TypeMismatchError;
1287 return; 1287 return;
1288 } 1288 }
1289 LayoutSize s = size(image); 1289 LayoutSize s = size(image);
1290 drawImage(image, x, y, s.width(), s.height(), ec); 1290 drawImage(image, x, y, s.width(), s.height(), ec);
(...skipping 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 } 2301 }
2302 2302
2303 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const 2303 PassRefPtr<Canvas2DContextAttributes> CanvasRenderingContext2D::getContextAttrib utes() const
2304 { 2304 {
2305 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate(); 2305 RefPtr<Canvas2DContextAttributes> attributes = Canvas2DContextAttributes::cr eate();
2306 attributes->setAlpha(m_hasAlpha); 2306 attributes->setAlpha(m_hasAlpha);
2307 return attributes.release(); 2307 return attributes.release();
2308 } 2308 }
2309 2309
2310 } // namespace WebCore 2310 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/loader/cache/CachedImage.cpp » ('j') | Source/core/loader/cache/CachedImage.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698