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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 1991563003: Inflate rect instead of m_dirtyRect in HTMLCanvasElement::didDraw (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | 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, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved. 4 * Copyright (C) 2010 Torch Mobile (Beijing) Co. Ltd. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 263
264 void HTMLCanvasElement::didDraw(const FloatRect& rect) 264 void HTMLCanvasElement::didDraw(const FloatRect& rect)
265 { 265 {
266 if (rect.isEmpty()) 266 if (rect.isEmpty())
267 return; 267 return;
268 m_imageBufferIsClear = false; 268 m_imageBufferIsClear = false;
269 clearCopiedImage(); 269 clearCopiedImage();
270 if (layoutObject()) 270 if (layoutObject())
271 layoutObject()->setMayNeedPaintInvalidation(); 271 layoutObject()->setMayNeedPaintInvalidation();
272 m_dirtyRect.unite(rect); 272 if (m_context && m_context->is2d() && m_context->shouldAntialias() && page() && page()->deviceScaleFactor() > 1.0f) {
273 if (m_context && m_context->is2d() && m_context->shouldAntialias() && page() && page()->deviceScaleFactor() > 1.0f) 273 FloatRect inflatedRect = rect;
274 m_dirtyRect.inflate(1); 274 inflatedRect.inflate(1);
275 m_dirtyRect.unite(inflatedRect);
276 } else {
277 m_dirtyRect.unite(rect);
278 }
275 if (m_context && m_context->is2d() && hasImageBuffer()) 279 if (m_context && m_context->is2d() && hasImageBuffer())
276 buffer()->didDraw(rect); 280 buffer()->didDraw(rect);
277 } 281 }
278 282
279 void HTMLCanvasElement::didFinalizeFrame() 283 void HTMLCanvasElement::didFinalizeFrame()
280 { 284 {
281 notifyListenersCanvasChanged(); 285 notifyListenersCanvasChanged();
282 286
283 if (m_dirtyRect.isEmpty()) 287 if (m_dirtyRect.isEmpty())
284 return; 288 return;
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 } 1130 }
1127 1131
1128 String HTMLCanvasElement::getIdFromControl(const Element* element) 1132 String HTMLCanvasElement::getIdFromControl(const Element* element)
1129 { 1133 {
1130 if (m_context) 1134 if (m_context)
1131 return m_context->getIdFromControl(element); 1135 return m_context->getIdFromControl(element);
1132 return String(); 1136 return String();
1133 } 1137 }
1134 1138
1135 } // namespace blink 1139 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698