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

Side by Side 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 unified diff | 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 »
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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 void HTMLCanvasElement::doDeferredPaintInvalidation() 324 void HTMLCanvasElement::doDeferredPaintInvalidation()
325 { 325 {
326 ASSERT(!m_dirtyRect.isEmpty()); 326 ASSERT(!m_dirtyRect.isEmpty());
327 if (is3D()) { 327 if (is3D()) {
328 didFinalizeFrame(); 328 didFinalizeFrame();
329 } else { 329 } else {
330 ASSERT(hasImageBuffer()); 330 ASSERT(hasImageBuffer());
331 FloatRect srcRect(0, 0, size().width(), size().height()); 331 FloatRect srcRect(0, 0, size().width(), size().height());
332 m_dirtyRect.intersect(srcRect); 332 m_dirtyRect.intersect(srcRect);
333 LayoutBox* ro = layoutBox(); 333 LayoutBox* lb = layoutBox();
334 if (ro) { 334 if (lb) {
335 m_imageBuffer->finalizeFrame(mapRect(m_dirtyRect, srcRect, ro->conte ntBoxRect())); 335 FloatRect mappedDirtyRect = mapRect(m_dirtyRect, srcRect, lb->conten tBoxRect());
336 if (m_context->isAccelerated()) {
337 // Accelerated 2D canvases need the dirty rect to be expressed r elative to the
338 // content box, as opposed to the layout box.
339 mappedDirtyRect.move(-lb->contentBoxOffset());
340 }
341 m_imageBuffer->finalizeFrame(mappedDirtyRect);
336 } else { 342 } else {
337 m_imageBuffer->finalizeFrame(m_dirtyRect); 343 m_imageBuffer->finalizeFrame(m_dirtyRect);
338 } 344 }
339 } 345 }
340 ASSERT(m_dirtyRect.isEmpty()); 346 ASSERT(m_dirtyRect.isEmpty());
341 } 347 }
342 348
343 void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect) 349 void HTMLCanvasElement::notifyObserversCanvasChanged(const FloatRect& rect)
344 { 350 {
345 for (CanvasObserver* canvasObserver : m_observers) 351 for (CanvasObserver* canvasObserver : m_observers)
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 { 893 {
888 return FloatSize(width(), height()); 894 return FloatSize(width(), height());
889 } 895 }
890 896
891 bool HTMLCanvasElement::isOpaque() const 897 bool HTMLCanvasElement::isOpaque() const
892 { 898 {
893 return m_context && !m_context->hasAlpha(); 899 return m_context && !m_context->hasAlpha();
894 } 900 }
895 901
896 } // blink 902 } // blink
OLDNEW
« 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