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

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

Issue 1192283002: Fix WebGL tex-image-and-sub-image-2d-with-video-rgb{565,4444,5551} tests on Android. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« 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) 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 3909 matching lines...) Expand 10 before | Expand all | Expand 10 after
3920 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti onState) 3920 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti onState)
3921 { 3921 {
3922 if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, except ionState) 3922 if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, except ionState)
3923 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoEleme nt, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0)) 3923 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoEleme nt, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0))
3924 return; 3924 return;
3925 3925
3926 // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible. 3926 // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible.
3927 // Otherwise, it will fall back to the normal SW path. 3927 // Otherwise, it will fall back to the normal SW path.
3928 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); 3928 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
3929 ASSERT(texture); 3929 ASSERT(texture);
3930 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type , level)) { 3930 if (GL_TEXTURE_2D == target) {
Sami 2015/06/19 06:15:58 I assume the intention is that we want to try usin
3931 if (video->copyVideoTextureToPlatformTexture(webContext(), texture->obje ct(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 3931 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type, level)
3932 && video->copyVideoTextureToPlatformTexture(webContext(), texture->o bject(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
3932 texture->setLevelInfo(target, level, internalformat, video->videoWid th(), video->videoHeight(), 1, type); 3933 texture->setLevelInfo(target, level, internalformat, video->videoWid th(), video->videoHeight(), 1, type);
3933 return; 3934 return;
3934 } 3935 }
3935 3936
3936 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU. 3937 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU.
3937 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight()))); 3938 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight())));
3938 if (surface->isValid()) { 3939 if (surface->isValid()) {
3939 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( ))); 3940 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( )));
3940 if (imageBuffer) { 3941 if (imageBuffer) {
3941 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface, 3942 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface,
3942 // we enable the WebMediaPlayer implementation to do any necessa ry color space conversion on the GPU (though it 3943 // we enable the WebMediaPlayer implementation to do any necessa ry color space conversion on the GPU (though it
3943 // may still do a CPU conversion and upload the results). 3944 // may still do a CPU conversion and upload the results).
3944 video->paintCurrentFrame(imageBuffer->canvas(), IntRect(0, 0, vi deo->videoWidth(), video->videoHeight()), nullptr); 3945 video->paintCurrentFrame(imageBuffer->canvas(), IntRect(0, 0, vi deo->videoWidth(), video->videoHeight()), nullptr);
3945 imageBuffer->canvas()->flush(); 3946 imageBuffer->canvas()->flush();
3946 3947
3947 // This is a straight GPU-GPU copy, any necessary color space co nversion was handled in the paintCurrentFrameInContext() call. 3948 // This is a straight GPU-GPU copy, any necessary color space co nversion was handled in the paintCurrentFrameInContext() call.
3948 if (imageBuffer->copyToPlatformTexture(webContext(), texture->ob ject(), internalformat, type, 3949 if (imageBuffer->copyToPlatformTexture(webContext(), texture->ob ject(), internalformat, type,
dshwang 2015/06/22 11:44:17 Thank you for fixing the bug I created. I couldn't
3949 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 3950 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
3950 texture->setLevelInfo(target, level, internalformat, video-> videoWidth(), video->videoHeight(), 1, type); 3951 texture->setLevelInfo(target, level, internalformat, video-> videoWidth(), video->videoHeight(), 1, type);
3951 return; 3952 return;
3952 } 3953 }
3953 } 3954 }
3954 } 3955 }
3955 } 3956 }
3956 3957
3957 // Normal pure SW path. 3958 // Normal pure SW path.
3958 RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMod e()); 3959 RefPtr<Image> image = videoFrameToImage(video, ImageBuffer::fastCopyImageMod e());
(...skipping 2256 matching lines...) Expand 10 before | Expand all | Expand 10 after
6215 6216
6216 return totalBytesPerPixel; 6217 return totalBytesPerPixel;
6217 } 6218 }
6218 6219
6219 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6220 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6220 { 6221 {
6221 return m_drawingBuffer.get(); 6222 return m_drawingBuffer.get();
6222 } 6223 }
6223 6224
6224 } // namespace blink 6225 } // namespace blink
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