| OLD | NEW |
| 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 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 if (!isContextLost()) | 893 if (!isContextLost()) |
| 894 drawingBuffer()->setBufferClearNeeded(true); | 894 drawingBuffer()->setBufferClearNeeded(true); |
| 895 } | 895 } |
| 896 | 896 |
| 897 void WebGLRenderingContextBase::setIsHidden(bool hidden) | 897 void WebGLRenderingContextBase::setIsHidden(bool hidden) |
| 898 { | 898 { |
| 899 if (drawingBuffer()) | 899 if (drawingBuffer()) |
| 900 drawingBuffer()->setIsHidden(hidden); | 900 drawingBuffer()->setIsHidden(hidden); |
| 901 } | 901 } |
| 902 | 902 |
| 903 void WebGLRenderingContextBase::paintRenderingResultsToCanvas(SourceDrawingBuffe
r sourceBuffer) | 903 bool WebGLRenderingContextBase::paintRenderingResultsToCanvas(SourceDrawingBuffe
r sourceBuffer) |
| 904 { | 904 { |
| 905 if (isContextLost()) | 905 if (isContextLost()) |
| 906 return; | 906 return false; |
| 907 | 907 |
| 908 bool mustClearNow = clearIfComposited() != Skipped; | 908 bool mustClearNow = clearIfComposited() != Skipped; |
| 909 if (!m_markedCanvasDirty && !mustClearNow) | 909 if (!m_markedCanvasDirty && !mustClearNow) |
| 910 return; | 910 return false; |
| 911 | 911 |
| 912 canvas()->clearCopiedImage(); | 912 canvas()->clearCopiedImage(); |
| 913 m_markedCanvasDirty = false; | 913 m_markedCanvasDirty = false; |
| 914 | 914 |
| 915 ScopedTexture2DRestorer restorer(this); | 915 ScopedTexture2DRestorer restorer(this); |
| 916 | 916 |
| 917 drawingBuffer()->commit(); | 917 drawingBuffer()->commit(); |
| 918 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(drawingBuffer
(), sourceBuffer)) { | 918 if (!canvas()->buffer()->copyRenderingResultsFromDrawingBuffer(drawingBuffer
(), sourceBuffer)) { |
| 919 canvas()->ensureUnacceleratedImageBuffer(); | 919 canvas()->ensureUnacceleratedImageBuffer(); |
| 920 if (canvas()->hasImageBuffer()) | 920 if (canvas()->hasImageBuffer()) |
| 921 drawingBuffer()->paintRenderingResultsToCanvas(canvas()->buffer()); | 921 drawingBuffer()->paintRenderingResultsToCanvas(canvas()->buffer()); |
| 922 } | 922 } |
| 923 | 923 |
| 924 if (m_framebufferBinding) | 924 restoreCurrentFramebuffer(); |
| 925 webContext()->bindFramebuffer(GL_FRAMEBUFFER, objectOrZero(m_framebuffer
Binding.get())); | 925 return true; |
| 926 else | |
| 927 drawingBuffer()->bind(); | |
| 928 } | 926 } |
| 929 | 927 |
| 930 PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResul
tsToImageData(SourceDrawingBuffer sourceBuffer) | 928 PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResul
tsToImageData(SourceDrawingBuffer sourceBuffer) |
| 931 { | 929 { |
| 932 if (isContextLost()) | 930 if (isContextLost()) |
| 933 return nullptr; | 931 return nullptr; |
| 934 | 932 |
| 935 clearIfComposited(); | 933 clearIfComposited(); |
| 936 drawingBuffer()->commit(); | 934 drawingBuffer()->commit(); |
| 937 int width, height; | 935 int width, height; |
| (...skipping 4996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5934 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; | 5932 return m_sharedWebGraphicsContext3D ? m_sharedWebGraphicsContext3D->drawingB
uffer() : 0; |
| 5935 } | 5933 } |
| 5936 #else | 5934 #else |
| 5937 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const | 5935 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const |
| 5938 { | 5936 { |
| 5939 return m_drawingBuffer.get(); | 5937 return m_drawingBuffer.get(); |
| 5940 } | 5938 } |
| 5941 #endif | 5939 #endif |
| 5942 | 5940 |
| 5943 } // namespace blink | 5941 } // namespace blink |
| OLD | NEW |