Chromium Code Reviews| 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 672 void HTMLCanvasElement::ensureUnacceleratedImageBuffer() | 672 void HTMLCanvasElement::ensureUnacceleratedImageBuffer() |
| 673 { | 673 { |
| 674 if ((hasImageBuffer() && !m_imageBuffer->isAccelerated()) || m_didFailToCrea teImageBuffer) | 674 if ((hasImageBuffer() && !m_imageBuffer->isAccelerated()) || m_didFailToCrea teImageBuffer) |
| 675 return; | 675 return; |
| 676 discardImageBuffer(); | 676 discardImageBuffer(); |
| 677 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; | 677 OpacityMode opacityMode = !m_context || m_context->hasAlpha() ? NonOpaque : Opaque; |
| 678 m_imageBuffer = ImageBuffer::create(size(), opacityMode); | 678 m_imageBuffer = ImageBuffer::create(size(), opacityMode); |
| 679 m_didFailToCreateImageBuffer = !m_imageBuffer; | 679 m_didFailToCreateImageBuffer = !m_imageBuffer; |
| 680 } | 680 } |
| 681 | 681 |
| 682 Image* HTMLCanvasElement::copiedImage(SourceDrawingBuffer sourceBuffer) const | 682 Image* HTMLCanvasElement::copiedImage() const |
|
dshwang
2014/11/27 21:31:10
@junov, now it's fixed, as you mentioned in https:
dshwang
2014/12/08 14:09:24
I drop this fix because ImageBitmap still use copi
| |
| 683 { | 683 { |
| 684 if (!m_copiedImage && buffer()) { | 684 if (!m_copiedImage && buffer()) { |
| 685 if (m_context && m_context->is3d()) | 685 if (m_context && m_context->is3d()) |
| 686 m_context->paintRenderingResultsToCanvas(sourceBuffer); | 686 m_context->paintRenderingResultsToCanvas(FrontBuffer); |
| 687 m_copiedImage = buffer()->copyImage(CopyBackingStore, Unscaled); | 687 m_copiedImage = buffer()->copyImage(CopyBackingStore, Unscaled); |
| 688 updateExternallyAllocatedMemory(); | 688 updateExternallyAllocatedMemory(); |
| 689 } | 689 } |
| 690 return m_copiedImage.get(); | 690 return m_copiedImage.get(); |
| 691 } | 691 } |
| 692 | 692 |
| 693 void HTMLCanvasElement::discardImageBuffer() | 693 void HTMLCanvasElement::discardImageBuffer() |
| 694 { | 694 { |
| 695 m_contextStateSaver.clear(); // uses context owned by m_imageBuffer | 695 m_contextStateSaver.clear(); // uses context owned by m_imageBuffer |
| 696 m_imageBuffer.clear(); | 696 m_imageBuffer.clear(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 774 { | 774 { |
| 775 return !originClean(); | 775 return !originClean(); |
| 776 } | 776 } |
| 777 | 777 |
| 778 FloatSize HTMLCanvasElement::sourceSize() const | 778 FloatSize HTMLCanvasElement::sourceSize() const |
| 779 { | 779 { |
| 780 return FloatSize(width(), height()); | 780 return FloatSize(width(), height()); |
| 781 } | 781 } |
| 782 | 782 |
| 783 } | 783 } |
| OLD | NEW |