| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |