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

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContextBase.cpp

Issue 766333003: canvas: fix bugs on HTMLCanvasElement::copiedImage() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: drop vector Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2009 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 if (!isContextLost()) 887 if (!isContextLost())
888 drawingBuffer()->setBufferClearNeeded(true); 888 drawingBuffer()->setBufferClearNeeded(true);
889 } 889 }
890 890
891 void WebGLRenderingContextBase::setIsHidden(bool hidden) 891 void WebGLRenderingContextBase::setIsHidden(bool hidden)
892 { 892 {
893 if (drawingBuffer()) 893 if (drawingBuffer())
894 drawingBuffer()->setIsHidden(hidden); 894 drawingBuffer()->setIsHidden(hidden);
895 } 895 }
896 896
897 void WebGLRenderingContextBase::paintRenderingResultsToCanvas(SourceDrawingBuffe r sourceBuffer) 897 bool WebGLRenderingContextBase::paintRenderingResultsToCanvas(SourceDrawingBuffe r sourceBuffer)
898 { 898 {
899 if (isContextLost()) 899 if (isContextLost())
900 return; 900 return false;
901 901
902 bool mustClearNow = clearIfComposited() != Skipped; 902 bool mustClearNow = clearIfComposited() != Skipped;
903 if (!m_markedCanvasDirty && !mustClearNow) 903 if (!m_markedCanvasDirty && !mustClearNow)
904 return; 904 return false;
905 905
906 canvas()->clearCopiedImage(); 906 canvas()->clearCopiedImage();
907 m_markedCanvasDirty = false; 907 m_markedCanvasDirty = false;
908 908
909 ScopedTexture2DRestorer restorer(this); 909 ScopedTexture2DRestorer restorer(this);
910 910
911 drawingBuffer()->commit(); 911 drawingBuffer()->commit();
912 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(drawingBuffer (), sourceBuffer)) { 912 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(drawingBuffer (), sourceBuffer)) {
913 canvas()->ensureUnacceleratedImageBuffer(); 913 canvas()->ensureUnacceleratedImageBuffer();
914 if (canvas()->hasImageBuffer()) 914 if (canvas()->hasImageBuffer())
915 drawingBuffer()->paintRenderingResultsToCanvas(canvas()->buffer()); 915 drawingBuffer()->paintRenderingResultsToCanvas(canvas()->buffer());
916 } 916 }
917 917
918 if (m_framebufferBinding) 918 restoreCurrentFramebuffer();
919 webContext()->bindFramebuffer(GL_FRAMEBUFFER, objectOrZero(m_framebuffer Binding.get())); 919 return true;
920 else
921 drawingBuffer()->bind();
922 } 920 }
923 921
924 PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResul tsToImageData(SourceDrawingBuffer sourceBuffer) 922 PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResul tsToImageData(SourceDrawingBuffer sourceBuffer)
925 { 923 {
926 if (isContextLost()) 924 if (isContextLost())
927 return nullptr; 925 return nullptr;
928 926
929 clearIfComposited(); 927 clearIfComposited();
930 drawingBuffer()->commit(); 928 drawingBuffer()->commit();
931 int width, height; 929 int width, height;
(...skipping 4931 matching lines...) Expand 10 before | Expand all | Expand 10 after
5863 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0; 5861 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB uffer() : 0;
5864 } 5862 }
5865 #else 5863 #else
5866 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 5864 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
5867 { 5865 {
5868 return m_drawingBuffer.get(); 5866 return m_drawingBuffer.get();
5869 } 5867 }
5870 #endif 5868 #endif
5871 5869
5872 } // namespace blink 5870 } // namespace blink
OLDNEW
« Source/core/html/HTMLCanvasElement.cpp ('K') | « Source/core/html/canvas/WebGLRenderingContextBase.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698