| 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 if (canvas()->hasImageBuffer()) | 854 if (canvas()->hasImageBuffer()) |
| 855 m_drawingBuffer->paintRenderingResultsToCanvas(canvas()->buffer()); | 855 m_drawingBuffer->paintRenderingResultsToCanvas(canvas()->buffer()); |
| 856 } | 856 } |
| 857 | 857 |
| 858 if (m_framebufferBinding) | 858 if (m_framebufferBinding) |
| 859 m_context->bindFramebuffer(GL_FRAMEBUFFER, objectOrZero(m_framebufferBin
ding.get())); | 859 m_context->bindFramebuffer(GL_FRAMEBUFFER, objectOrZero(m_framebufferBin
ding.get())); |
| 860 else | 860 else |
| 861 m_drawingBuffer->bind(); | 861 m_drawingBuffer->bind(); |
| 862 } | 862 } |
| 863 | 863 |
| 864 PassRefPtr<ImageData> WebGLRenderingContextBase::paintRenderingResultsToImageDat
a() | 864 PassRefPtrWillBeRawPtr<ImageData> WebGLRenderingContextBase::paintRenderingResul
tsToImageData() |
| 865 { | 865 { |
| 866 if (isContextLost()) | 866 if (isContextLost()) |
| 867 return nullptr; | 867 return nullptr; |
| 868 | 868 |
| 869 clearIfComposited(); | 869 clearIfComposited(); |
| 870 m_drawingBuffer->commit(); | 870 m_drawingBuffer->commit(); |
| 871 int width, height; | 871 int width, height; |
| 872 RefPtr<Uint8ClampedArray> imageDataPixels = m_drawingBuffer->paintRenderingR
esultsToImageData(width, height); | 872 RefPtr<Uint8ClampedArray> imageDataPixels = m_drawingBuffer->paintRenderingR
esultsToImageData(width, height); |
| 873 if (!imageDataPixels) | 873 if (!imageDataPixels) |
| 874 return nullptr; | 874 return nullptr; |
| (...skipping 2576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3451 WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->
renderingContext()); | 3451 WebGLRenderingContextBase* gl = toWebGLRenderingContextBase(canvas->
renderingContext()); |
| 3452 ScopedTexture2DRestorer restorer(gl); | 3452 ScopedTexture2DRestorer restorer(gl); |
| 3453 if (gl && gl->m_drawingBuffer->copyToPlatformTexture(m_context.get()
, texture->object(), internalformat, type, | 3453 if (gl && gl->m_drawingBuffer->copyToPlatformTexture(m_context.get()
, texture->object(), internalformat, type, |
| 3454 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { | 3454 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { |
| 3455 texture->setLevelInfo(target, level, internalformat, canvas->wid
th(), canvas->height(), type); | 3455 texture->setLevelInfo(target, level, internalformat, canvas->wid
th(), canvas->height(), type); |
| 3456 return; | 3456 return; |
| 3457 } | 3457 } |
| 3458 } | 3458 } |
| 3459 } | 3459 } |
| 3460 | 3460 |
| 3461 RefPtr<ImageData> imageData = canvas->getImageData(); | 3461 RefPtrWillBeRawPtr<ImageData> imageData = canvas->getImageData(); |
| 3462 if (imageData) | 3462 if (imageData) |
| 3463 texImage2D(target, level, internalformat, format, type, imageData.get(),
exceptionState); | 3463 texImage2D(target, level, internalformat, format, type, imageData.get(),
exceptionState); |
| 3464 else | 3464 else |
| 3465 texImage2DImpl(target, level, internalformat, format, type, canvas->copi
edImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultip
lyAlpha, exceptionState); | 3465 texImage2DImpl(target, level, internalformat, format, type, canvas->copi
edImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPremultip
lyAlpha, exceptionState); |
| 3466 } | 3466 } |
| 3467 | 3467 |
| 3468 PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement*
video, BackingStoreCopy backingStoreCopy) | 3468 PassRefPtr<Image> WebGLRenderingContextBase::videoFrameToImage(HTMLVideoElement*
video, BackingStoreCopy backingStoreCopy) |
| 3469 { | 3469 { |
| 3470 IntSize size(video->videoWidth(), video->videoHeight()); | 3470 IntSize size(video->videoWidth(), video->videoHeight()); |
| 3471 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); | 3471 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen
der.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultipl
yAlpha, exceptionState); | 3670 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, imageForRen
der.get(), WebGLImageConversion::HtmlDomImage, m_unpackFlipY, m_unpackPremultipl
yAlpha, exceptionState); |
| 3671 } | 3671 } |
| 3672 | 3672 |
| 3673 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, | 3673 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, |
| 3674 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep
tionState) | 3674 GLenum format, GLenum type, HTMLCanvasElement* canvas, ExceptionState& excep
tionState) |
| 3675 { | 3675 { |
| 3676 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, e
xceptionState) | 3676 if (isContextLost() || !validateHTMLCanvasElement("texSubImage2D", canvas, e
xceptionState) |
| 3677 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElem
ent, target, level, format, canvas->width(), canvas->height(), 0, format, type,
xoffset, yoffset)) | 3677 || !validateTexFunc("texSubImage2D", TexSubImage2D, SourceHTMLCanvasElem
ent, target, level, format, canvas->width(), canvas->height(), 0, format, type,
xoffset, yoffset)) |
| 3678 return; | 3678 return; |
| 3679 | 3679 |
| 3680 RefPtr<ImageData> imageData = canvas->getImageData(); | 3680 RefPtrWillBeRawPtr<ImageData> imageData = canvas->getImageData(); |
| 3681 if (imageData) | 3681 if (imageData) |
| 3682 texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.g
et(), exceptionState); | 3682 texSubImage2D(target, level, xoffset, yoffset, format, type, imageData.g
et(), exceptionState); |
| 3683 else | 3683 else |
| 3684 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas-
>copiedImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPrem
ultiplyAlpha, exceptionState); | 3684 texSubImage2DImpl(target, level, xoffset, yoffset, format, type, canvas-
>copiedImage(), WebGLImageConversion::HtmlDomCanvas, m_unpackFlipY, m_unpackPrem
ultiplyAlpha, exceptionState); |
| 3685 } | 3685 } |
| 3686 | 3686 |
| 3687 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, | 3687 void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint
xoffset, GLint yoffset, |
| 3688 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti
onState) | 3688 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti
onState) |
| 3689 { | 3689 { |
| 3690 if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, exc
eptionState) | 3690 if (isContextLost() || !validateHTMLVideoElement("texSubImage2D", video, exc
eptionState) |
| (...skipping 1900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5591 if (m_textureUnits[i].m_texture2DBinding | 5591 if (m_textureUnits[i].m_texture2DBinding |
| 5592 || m_textureUnits[i].m_textureCubeMapBinding) { | 5592 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 5593 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 5593 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 5594 return; | 5594 return; |
| 5595 } | 5595 } |
| 5596 } | 5596 } |
| 5597 m_onePlusMaxNonDefaultTextureUnit = 0; | 5597 m_onePlusMaxNonDefaultTextureUnit = 0; |
| 5598 } | 5598 } |
| 5599 | 5599 |
| 5600 } // namespace WebCore | 5600 } // namespace WebCore |
| OLD | NEW |