| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 } | 283 } |
| 284 | 284 |
| 285 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end(); | 285 HashSet<RawPtr<CanvasObserver> >::iterator end = m_observers.end(); |
| 286 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it
!= end; ++it) | 286 for (HashSet<RawPtr<CanvasObserver> >::iterator it = m_observers.begin(); it
!= end; ++it) |
| 287 (*it)->canvasResized(this); | 287 (*it)->canvasResized(this); |
| 288 } | 288 } |
| 289 | 289 |
| 290 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const | 290 bool HTMLCanvasElement::paintsIntoCanvasBuffer() const |
| 291 { | 291 { |
| 292 ASSERT(m_context); | 292 ASSERT(m_context); |
| 293 | |
| 294 if (!m_context->isAccelerated()) | |
| 295 return true; | |
| 296 | |
| 297 if (renderBox() && renderBox()->hasAcceleratedCompositing()) | |
| 298 return false; | |
| 299 | |
| 300 return true; | 293 return true; |
| 301 } | 294 } |
| 302 | 295 |
| 303 | |
| 304 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r) | 296 void HTMLCanvasElement::paint(GraphicsContext* context, const LayoutRect& r) |
| 305 { | 297 { |
| 306 if (m_context) { | 298 if (m_context) { |
| 307 if (!paintsIntoCanvasBuffer()) | 299 if (!paintsIntoCanvasBuffer()) |
| 308 return; | 300 return; |
| 309 m_context->paintRenderingResultsToCanvas(); | 301 m_context->paintRenderingResultsToCanvas(); |
| 310 } | 302 } |
| 311 | 303 |
| 312 if (hasImageBuffer()) { | 304 if (hasImageBuffer()) { |
| 313 ImageBuffer* imageBuffer = buffer(); | 305 ImageBuffer* imageBuffer = buffer(); |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 } | 650 } |
| 659 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); | 651 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); |
| 660 } | 652 } |
| 661 | 653 |
| 662 FloatSize HTMLCanvasElement::sourceSize() const | 654 FloatSize HTMLCanvasElement::sourceSize() const |
| 663 { | 655 { |
| 664 return FloatSize(width(), height()); | 656 return FloatSize(width(), height()); |
| 665 } | 657 } |
| 666 | 658 |
| 667 } | 659 } |
| OLD | NEW |