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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 return; | 585 return; |
586 discardImageBuffer(); | 586 discardImageBuffer(); |
587 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque :
Opaque; | 587 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque :
Opaque; |
588 m_imageBuffer = ImageBuffer::create(size(), opacityMode); | 588 m_imageBuffer = ImageBuffer::create(size(), opacityMode); |
589 m_didFailToCreateImageBuffer = !m_imageBuffer; | 589 m_didFailToCreateImageBuffer = !m_imageBuffer; |
590 } | 590 } |
591 | 591 |
592 Image* HTMLCanvasElement::copiedImage() const | 592 Image* HTMLCanvasElement::copiedImage() const |
593 { | 593 { |
594 if (!m_copiedImage && buffer()) { | 594 if (!m_copiedImage && buffer()) { |
595 if (m_context) | 595 if (m_context && m_context->is3d()) { |
| 596 toWebGLRenderingContext(m_context.get())->setSavingImage(true); |
596 m_context->paintRenderingResultsToCanvas(); | 597 m_context->paintRenderingResultsToCanvas(); |
| 598 toWebGLRenderingContext(m_context.get())->setSavingImage(false); |
| 599 } |
597 m_copiedImage = buffer()->copyImage(CopyBackingStore, Unscaled); | 600 m_copiedImage = buffer()->copyImage(CopyBackingStore, Unscaled); |
598 updateExternallyAllocatedMemory(); | 601 updateExternallyAllocatedMemory(); |
599 } | 602 } |
600 return m_copiedImage.get(); | 603 return m_copiedImage.get(); |
601 } | 604 } |
602 | 605 |
603 void HTMLCanvasElement::clearImageBuffer() | 606 void HTMLCanvasElement::clearImageBuffer() |
604 { | 607 { |
605 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); | 608 ASSERT(hasImageBuffer() && !m_didFailToCreateImageBuffer); |
606 ASSERT(!m_didClearImageBuffer); | 609 ASSERT(!m_didClearImageBuffer); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 { | 695 { |
693 return !originClean(); | 696 return !originClean(); |
694 } | 697 } |
695 | 698 |
696 FloatSize HTMLCanvasElement::sourceSize() const | 699 FloatSize HTMLCanvasElement::sourceSize() const |
697 { | 700 { |
698 return FloatSize(width(), height()); | 701 return FloatSize(width(), height()); |
699 } | 702 } |
700 | 703 |
701 } | 704 } |
OLD | NEW |