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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 // Propagate the m_dirtyRect accumulated so far to the compositor | 292 // Propagate the m_dirtyRect accumulated so far to the compositor |
293 // before restarting with a blank dirty rect. | 293 // before restarting with a blank dirty rect. |
294 FloatRect srcRect(0, 0, size().width(), size().height()); | 294 FloatRect srcRect(0, 0, size().width(), size().height()); |
295 m_dirtyRect.intersect(srcRect); | 295 m_dirtyRect.intersect(srcRect); |
296 LayoutBox* ro = layoutBox(); | 296 LayoutBox* ro = layoutBox(); |
297 // Canvas content updates do not need to be propagated as | 297 // Canvas content updates do not need to be propagated as |
298 // paint invalidations if the canvas is accelerated, since | 298 // paint invalidations if the canvas is accelerated, since |
299 // the canvas contents are sent separately through a texture layer. | 299 // the canvas contents are sent separately through a texture layer. |
300 if (ro && (!m_context || !m_context->isAccelerated())) { | 300 if (ro && (!m_context || !m_context->isAccelerated())) { |
301 LayoutRect mappedDirtyRect(enclosingIntRect(mapRect(m_dirtyRect, srcRect
, ro->contentBoxRect()))); | 301 LayoutRect mappedDirtyRect(enclosingIntRect(mapRect(m_dirtyRect, srcRect
, FloatRect(ro->contentBoxRect())))); |
302 // For querying DeprecatedPaintLayer::compositingState() | 302 // For querying DeprecatedPaintLayer::compositingState() |
303 // FIXME: is this invalidation using the correct compositing state? | 303 // FIXME: is this invalidation using the correct compositing state? |
304 DisableCompositingQueryAsserts disabler; | 304 DisableCompositingQueryAsserts disabler; |
305 ro->invalidatePaintRectangle(mappedDirtyRect); | 305 ro->invalidatePaintRectangle(mappedDirtyRect); |
306 } | 306 } |
307 m_dirtyRect = FloatRect(); | 307 m_dirtyRect = FloatRect(); |
308 } | 308 } |
309 | 309 |
310 void HTMLCanvasElement::restoreCanvasMatrixClipStack(SkCanvas* canvas) const | 310 void HTMLCanvasElement::restoreCanvasMatrixClipStack(SkCanvas* canvas) const |
311 { | 311 { |
312 if (m_context) | 312 if (m_context) |
313 m_context->restoreCanvasMatrixClipStack(canvas); | 313 m_context->restoreCanvasMatrixClipStack(canvas); |
314 } | 314 } |
315 | 315 |
316 void HTMLCanvasElement::doDeferredPaintInvalidation() | 316 void HTMLCanvasElement::doDeferredPaintInvalidation() |
317 { | 317 { |
318 ASSERT(!m_dirtyRect.isEmpty()); | 318 ASSERT(!m_dirtyRect.isEmpty()); |
319 if (is3D()) { | 319 if (is3D()) { |
320 didFinalizeFrame(); | 320 didFinalizeFrame(); |
321 } else { | 321 } else { |
322 ASSERT(hasImageBuffer()); | 322 ASSERT(hasImageBuffer()); |
323 FloatRect srcRect(0, 0, size().width(), size().height()); | 323 FloatRect srcRect(0, 0, size().width(), size().height()); |
324 m_dirtyRect.intersect(srcRect); | 324 m_dirtyRect.intersect(srcRect); |
325 LayoutBox* lb = layoutBox(); | 325 LayoutBox* lb = layoutBox(); |
326 if (lb) { | 326 if (lb) { |
327 FloatRect mappedDirtyRect = mapRect(m_dirtyRect, srcRect, lb->conten
tBoxRect()); | 327 FloatRect mappedDirtyRect = mapRect(m_dirtyRect, srcRect, FloatRect(
lb->contentBoxRect())); |
328 if (m_context->isAccelerated()) { | 328 if (m_context->isAccelerated()) { |
329 // Accelerated 2D canvases need the dirty rect to be expressed r
elative to the | 329 // Accelerated 2D canvases need the dirty rect to be expressed r
elative to the |
330 // content box, as opposed to the layout box. | 330 // content box, as opposed to the layout box. |
331 mappedDirtyRect.move(-lb->contentBoxOffset()); | 331 mappedDirtyRect.move(-lb->contentBoxOffset()); |
332 } | 332 } |
333 m_imageBuffer->finalizeFrame(mappedDirtyRect); | 333 m_imageBuffer->finalizeFrame(mappedDirtyRect); |
334 } else { | 334 } else { |
335 m_imageBuffer->finalizeFrame(m_dirtyRect); | 335 m_imageBuffer->finalizeFrame(m_dirtyRect); |
336 } | 336 } |
337 } | 337 } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 { | 904 { |
905 return FloatSize(width(), height()); | 905 return FloatSize(width(), height()); |
906 } | 906 } |
907 | 907 |
908 bool HTMLCanvasElement::isOpaque() const | 908 bool HTMLCanvasElement::isOpaque() const |
909 { | 909 { |
910 return m_context && !m_context->hasAlpha(); | 910 return m_context && !m_context->hasAlpha(); |
911 } | 911 } |
912 | 912 |
913 } // blink | 913 } // blink |
OLD | NEW |