Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 633093002: Returns nullptr in getImageSourceForCanvas when imageSnapshot is null (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698