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 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 *status = InvalidSourceImageStatus; | 731 *status = InvalidSourceImageStatus; |
732 return nullptr; | 732 return nullptr; |
733 } | 733 } |
734 | 734 |
735 if (m_context && m_context->is3d()) { | 735 if (m_context && m_context->is3d()) { |
736 m_context->paintRenderingResultsToCanvas(); | 736 m_context->paintRenderingResultsToCanvas(); |
737 *status = ExternalSourceImageStatus; | 737 *status = ExternalSourceImageStatus; |
738 | 738 |
739 // can't create SkImage from WebGLImageBufferSurface (contains only SkBi
tmap) | 739 // can't create SkImage from WebGLImageBufferSurface (contains only SkBi
tmap) |
740 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); | 740 return m_imageBuffer->copyImage(DontCopyBackingStore, Unscaled); |
741 } else { | |
742 *status = NormalSourceImageStatus; | |
743 } | 741 } |
744 | 742 |
745 return StaticBitmapImage::create(m_imageBuffer->newImageSnapshot()); | 743 RefPtr<SkImage> image = m_imageBuffer->newImageSnapshot(); |
| 744 if (image) { |
| 745 *status = NormalSourceImageStatus; |
| 746 |
| 747 return StaticBitmapImage::create(image.release()); |
| 748 } |
| 749 |
| 750 |
| 751 *status = InvalidSourceImageStatus; |
| 752 |
| 753 return nullptr; |
746 } | 754 } |
747 | 755 |
748 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const | 756 bool HTMLCanvasElement::wouldTaintOrigin(SecurityOrigin*) const |
749 { | 757 { |
750 return !originClean(); | 758 return !originClean(); |
751 } | 759 } |
752 | 760 |
753 FloatSize HTMLCanvasElement::sourceSize() const | 761 FloatSize HTMLCanvasElement::sourceSize() const |
754 { | 762 { |
755 return FloatSize(width(), height()); | 763 return FloatSize(width(), height()); |
756 } | 764 } |
757 | 765 |
758 } | 766 } |
OLD | NEW |