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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 | 287 |
288 void HTMLCanvasElement::didFinalizeFrame() | 288 void HTMLCanvasElement::didFinalizeFrame() |
289 { | 289 { |
290 if (m_dirtyRect.isEmpty()) | 290 if (m_dirtyRect.isEmpty()) |
291 return; | 291 return; |
292 | 292 |
293 // Propagate the m_dirtyRect accumulated so far to the compositor | 293 // Propagate the m_dirtyRect accumulated so far to the compositor |
294 // before restarting with a blank dirty rect. | 294 // before restarting with a blank dirty rect. |
295 FloatRect srcRect(0, 0, size().width(), size().height()); | 295 FloatRect srcRect(0, 0, size().width(), size().height()); |
296 m_dirtyRect.intersect(srcRect); | 296 m_dirtyRect.intersect(srcRect); |
297 if (RenderBox* ro = renderBox()) { | 297 if (LayoutBox* ro = layoutBox()) { |
298 FloatRect mappedDirtyRect = mapRect(m_dirtyRect, srcRect, ro->contentBox
Rect()); | 298 FloatRect mappedDirtyRect = mapRect(m_dirtyRect, srcRect, ro->contentBox
Rect()); |
299 // For querying Layer::compositingState() | 299 // For querying Layer::compositingState() |
300 // FIXME: is this invalidation using the correct compositing state? | 300 // FIXME: is this invalidation using the correct compositing state? |
301 DisableCompositingQueryAsserts disabler; | 301 DisableCompositingQueryAsserts disabler; |
302 ro->invalidatePaintRectangle(enclosingIntRect(mappedDirtyRect)); | 302 ro->invalidatePaintRectangle(enclosingIntRect(mappedDirtyRect)); |
303 } | 303 } |
304 notifyObserversCanvasChanged(m_dirtyRect); | 304 notifyObserversCanvasChanged(m_dirtyRect); |
305 m_dirtyRect = FloatRect(); | 305 m_dirtyRect = FloatRect(); |
306 } | 306 } |
307 | 307 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 | 372 |
373 setSurfaceSize(newSize); | 373 setSurfaceSize(newSize); |
374 | 374 |
375 if (m_context && m_context->is3d() && oldSize != size()) | 375 if (m_context && m_context->is3d() && oldSize != size()) |
376 toWebGLRenderingContext(m_context.get())->reshape(width(), height()); | 376 toWebGLRenderingContext(m_context.get())->reshape(width(), height()); |
377 | 377 |
378 if (LayoutObject* renderer = this->renderer()) { | 378 if (LayoutObject* renderer = this->renderer()) { |
379 if (renderer->isCanvas()) { | 379 if (renderer->isCanvas()) { |
380 if (oldSize != size()) { | 380 if (oldSize != size()) { |
381 toLayoutHTMLCanvas(renderer)->canvasSizeChanged(); | 381 toLayoutHTMLCanvas(renderer)->canvasSizeChanged(); |
382 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | 382 if (layoutBox() && layoutBox()->hasAcceleratedCompositing()) |
383 renderBox()->contentChanged(CanvasChanged); | 383 layoutBox()->contentChanged(CanvasChanged); |
384 } | 384 } |
385 if (hadImageBuffer) | 385 if (hadImageBuffer) |
386 renderer->setShouldDoFullPaintInvalidation(); | 386 renderer->setShouldDoFullPaintInvalidation(); |
387 } | 387 } |
388 } | 388 } |
389 | 389 |
390 for (CanvasObserver* canvasObserver : m_observers) | 390 for (CanvasObserver* canvasObserver : m_observers) |
391 canvasObserver->canvasResized(this); | 391 canvasObserver->canvasResized(this); |
392 } | 392 } |
393 | 393 |
394 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const | 394 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const |
395 { | 395 { |
396 ASSERT(m_context); | 396 ASSERT(m_context); |
397 | 397 |
398 if (!m_context->isAccelerated()) | 398 if (!m_context->isAccelerated()) |
399 return true; | 399 return true; |
400 | 400 |
401 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | 401 if (layoutBox() && layoutBox()->hasAcceleratedCompositing()) |
402 return false; | 402 return false; |
403 | 403 |
404 return true; | 404 return true; |
405 } | 405 } |
406 | 406 |
407 | 407 |
408 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r) | 408 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r) |
409 { | 409 { |
410 // FIXME: crbug.com/438240; there is a bug with the new CSS blending and com
positing feature. | 410 // FIXME: crbug.com/438240; there is a bug with the new CSS blending and com
positing feature. |
411 if (!m_context) | 411 if (!m_context) |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 { | 893 { |
894 return FloatSize(width(), height()); | 894 return FloatSize(width(), height()); |
895 } | 895 } |
896 | 896 |
897 bool HTMLCanvasElement::isOpaque() const | 897 bool HTMLCanvasElement::isOpaque() const |
898 { | 898 { |
899 return m_context && !m_context->hasAlpha(); | 899 return m_context && !m_context->hasAlpha(); |
900 } | 900 } |
901 | 901 |
902 } // blink | 902 } // blink |
OLD | NEW |