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

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 402613006: Fixing 2D canvas invalidation region tracking. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixups and baselines Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index a8da6d7bd3d426c8ac8151fbf8e95ada0009ebc2..2402c38c720413af67e5f7ef54ead5eb40ff9f05 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -195,19 +195,26 @@ void HTMLCanvasElement::didDraw(const FloatRect& rect)
clearCopiedImage();
if (RenderBox* ro = renderBox()) {
- FloatRect destRect = ro->contentBoxRect();
- FloatRect r = mapRect(rect, FloatRect(0, 0, size().width(), size().height()), destRect);
- r.intersect(destRect);
+ FloatRect srcRect(0, 0, size().width(), size().height());
+ FloatRect r = rect;
+ r.intersect(srcRect);
if (r.isEmpty() || m_dirtyRect.contains(r))
return;
-
m_dirtyRect.unite(r);
- ro->invalidatePaintRectangle(enclosingIntRect(m_dirtyRect));
+ FloatRect mappedDirtyRect = mapRect(r, srcRect, ro->contentBoxRect());
+
+ ro->invalidatePaintRectangle(enclosingIntRect(mappedDirtyRect));
}
notifyObserversCanvasChanged(rect);
}
+void HTMLCanvasElement::didPresent()
+{
+ // Canvas was presented externally (without going through paint())
+ m_dirtyRect = FloatRect();
+}
+
void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect)
{
WillBeHeapHashSet<RawPtrWillBeWeakMember<CanvasObserver> >::iterator end = m_observers.end();
@@ -220,6 +227,8 @@ void HTMLCanvasElement::reset()
if (m_ignoreReset)
return;
+ m_dirtyRect = FloatRect();
+
bool ok;
bool hadImageBuffer = hasImageBuffer();
« no previous file with comments | « Source/core/html/HTMLCanvasElement.h ('k') | Source/core/html/canvas/CanvasRenderingContext2D.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698