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

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

Issue 1149973006: Fix incorrect paint invalidations with accelerated 2D canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: using similarity 100 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/canvas/canvas-incremental-repaint-3-expected.html ('k') | no next file » | 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 1d67f88bbab316c5776e741edaeada4500e0bbc7..dcea2ec816f4b30b6a59163554175229f280a5d5 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -330,9 +330,15 @@ void HTMLCanvasElement::doDeferredPaintInvalidation()
ASSERT(hasImageBuffer());
FloatRect srcRect(0, 0, size().width(), size().height());
m_dirtyRect.intersect(srcRect);
- LayoutBox* ro = layoutBox();
- if (ro) {
- m_imageBuffer->finalizeFrame(mapRect(m_dirtyRect, srcRect, ro->contentBoxRect()));
+ LayoutBox* lb = layoutBox();
+ if (lb) {
+ FloatRect mappedDirtyRect = mapRect(m_dirtyRect, srcRect, lb->contentBoxRect());
+ if (m_context->isAccelerated()) {
+ // Accelerated 2D canvases need the dirty rect to be expressed relative to the
+ // content box, as opposed to the layout box.
+ mappedDirtyRect.move(-lb->contentBoxOffset());
+ }
+ m_imageBuffer->finalizeFrame(mappedDirtyRect);
} else {
m_imageBuffer->finalizeFrame(m_dirtyRect);
}
« no previous file with comments | « LayoutTests/fast/canvas/canvas-incremental-repaint-3-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698