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

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

Issue 22613002: Allow ImageBitmaps derived from HTMLImageElements to be evicted from RAM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make destructor virtual. Created 7 years, 4 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/page/ImageBitmap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 1287
1288 ASSERT(bitmap->height() && bitmap->width()); 1288 ASSERT(bitmap->height() && bitmap->width());
1289 FloatRect normalizedSrcRect = normalizeRect(srcRect); 1289 FloatRect normalizedSrcRect = normalizeRect(srcRect);
1290 FloatRect normalizedDstRect = normalizeRect(dstRect); 1290 FloatRect normalizedDstRect = normalizeRect(dstRect);
1291 1291
1292 // Clip the rects to where the user thinks that the image is situated. 1292 // Clip the rects to where the user thinks that the image is situated.
1293 clipRectsToImageRect(IntRect(IntPoint(), bitmap->size()), &normalizedSrcRect , &normalizedDstRect); 1293 clipRectsToImageRect(IntRect(IntPoint(), bitmap->size()), &normalizedSrcRect , &normalizedDstRect);
1294 1294
1295 FloatRect intersectRect = intersection(bitmapRect, normalizedSrcRect); 1295 FloatRect intersectRect = intersection(bitmapRect, normalizedSrcRect);
1296 FloatRect actualSrcRect(intersectRect); 1296 FloatRect actualSrcRect(intersectRect);
1297 actualSrcRect.move(-bitmapRect.x(), -bitmapRect.y());
1298 1297
1299 FloatRect imageRect = FloatRect(FloatPoint(), bitmapRect.size()); 1298 IntPoint bitmapOffset = bitmap->bitmapOffset();
1299 actualSrcRect.move(bitmapOffset - bitmapRect.location());
1300 FloatRect imageRect = FloatRect(bitmapOffset, bitmapRect.size());
1300 1301
1301 FloatRect actualDstRect(FloatPoint(intersectRect.location() - normalizedSrcR ect.location()), bitmapRect.size()); 1302 FloatRect actualDstRect(FloatPoint(intersectRect.location() - normalizedSrcR ect.location()), bitmapRect.size());
1302 actualDstRect.scale(normalizedDstRect.width() / normalizedSrcRect.width() * intersectRect.width() / bitmapRect.width(), 1303 actualDstRect.scale(normalizedDstRect.width() / normalizedSrcRect.width() * intersectRect.width() / bitmapRect.width(),
1303 normalizedDstRect.height() / normalizedSrcRect.height() * intersectRect. height() / bitmapRect.height()); 1304 normalizedDstRect.height() / normalizedSrcRect.height() * intersectRect. height() / bitmapRect.height());
1304 actualDstRect.moveBy(normalizedDstRect.location()); 1305 actualDstRect.moveBy(normalizedDstRect.location());
1305 1306
1306 if (!imageRect.intersects(actualSrcRect)) 1307 if (!imageRect.intersects(actualSrcRect))
1307 return; 1308 return;
1308 1309
1309 RefPtr<Image> imageForRendering = bitmap->bitmapImage(); 1310 RefPtr<Image> imageForRendering = bitmap->bitmapImage();
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2410 Color focusRingColor = RenderTheme::focusRingColor(); 2411 Color focusRingColor = RenderTheme::focusRingColor();
2411 const int focusRingWidth = 5; 2412 const int focusRingWidth = 5;
2412 const int focusRingOutline = 0; 2413 const int focusRingOutline = 0;
2413 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor); 2414 c->drawFocusRing(path, focusRingWidth, focusRingOutline, focusRingColor);
2414 didDraw(path.boundingRect()); 2415 didDraw(path.boundingRect());
2415 2416
2416 c->restore(); 2417 c->restore();
2417 } 2418 }
2418 2419
2419 } // namespace WebCore 2420 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/page/ImageBitmap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698