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

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

Issue 1152733008: remove |level| in copyVideoTextureToPlatformTexture(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add TODO 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
« no previous file with comments | « Source/core/html/HTMLVideoElement.cpp ('k') | Source/platform/graphics/ImageBuffer.cpp » ('j') | 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 3808 matching lines...) Expand 10 before | Expand all | Expand 10 after
3819 GLint level, GLenum internalformat, GLenum type, GLint xoffset, GLint yoffse t, HTMLCanvasElement* canvas) 3819 GLint level, GLenum internalformat, GLenum type, GLint xoffset, GLint yoffse t, HTMLCanvasElement* canvas)
3820 { 3820 {
3821 ScopedTexture2DRestorer restorer(this); 3821 ScopedTexture2DRestorer restorer(this);
3822 3822
3823 Platform3DObject targetTexture = texture->object(); 3823 Platform3DObject targetTexture = texture->object();
3824 GLenum targetType = type; 3824 GLenum targetType = type;
3825 GLenum targetInternalformat = internalformat; 3825 GLenum targetInternalformat = internalformat;
3826 GLint targetLevel = level; 3826 GLint targetLevel = level;
3827 bool possibleDirectCopy = false; 3827 bool possibleDirectCopy = false;
3828 if (functionType == NotTexSubImage2D) { 3828 if (functionType == NotTexSubImage2D) {
3829 possibleDirectCopy = GL_TEXTURE_2D == target && Extensions3DUtil::canUse CopyTextureCHROMIUM(internalformat, type, level); 3829 possibleDirectCopy = Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type, level);
3830 } else if (functionType == TexSubImage2D) { 3830 } else if (functionType == TexSubImage2D) {
3831 possibleDirectCopy = false; 3831 possibleDirectCopy = false;
3832 } 3832 }
3833 // if direct copy is not possible, create a temporary texture and then copy from canvas to temporary texture to target texture. 3833 // if direct copy is not possible, create a temporary texture and then copy from canvas to temporary texture to target texture.
3834 if (!possibleDirectCopy) { 3834 if (!possibleDirectCopy) {
3835 targetLevel = 0; 3835 targetLevel = 0;
3836 targetInternalformat = GL_RGBA; 3836 targetInternalformat = GL_RGBA;
3837 targetType = GL_UNSIGNED_BYTE; 3837 targetType = GL_UNSIGNED_BYTE;
3838 targetTexture = webContext()->createTexture(); 3838 targetTexture = webContext()->createTexture();
3839 webContext()->bindTexture(GL_TEXTURE_2D, targetTexture); 3839 webContext()->bindTexture(GL_TEXTURE_2D, targetTexture);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
3916 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti onState) 3916 GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& excepti onState)
3917 { 3917 {
3918 if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, except ionState) 3918 if (isContextLost() || !validateHTMLVideoElement("texImage2D", video, except ionState)
3919 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoEleme nt, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0)) 3919 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceHTMLVideoEleme nt, target, level, internalformat, video->videoWidth(), video->videoHeight(), 0, format, type, 0, 0))
3920 return; 3920 return;
3921 3921
3922 // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible. 3922 // Go through the fast path doing a GPU-GPU textures copy without a readback to system memory if possible.
3923 // Otherwise, it will fall back to the normal SW path. 3923 // Otherwise, it will fall back to the normal SW path.
3924 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true); 3924 WebGLTexture* texture = validateTextureBinding("texImage2D", target, true);
3925 ASSERT(texture); 3925 ASSERT(texture);
3926 if (GL_TEXTURE_2D == target) { 3926 if (Extensions3DUtil::canUseCopyTextureCHROMIUM(target, internalformat, type , level)) {
3927 if (video->copyVideoTextureToPlatformTexture(webContext(), texture->obje ct(), level, internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 3927 if (video->copyVideoTextureToPlatformTexture(webContext(), texture->obje ct(), internalformat, type, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
3928 texture->setLevelInfo(target, level, internalformat, video->videoWid th(), video->videoHeight(), 1, type); 3928 texture->setLevelInfo(target, level, internalformat, video->videoWid th(), video->videoHeight(), 1, type);
3929 return; 3929 return;
3930 } 3930 }
3931 3931
3932 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU. 3932 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU.
3933 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight()))); 3933 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight())));
3934 if (surface->isValid()) { 3934 if (surface->isValid()) {
3935 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( ))); 3935 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( )));
3936 if (imageBuffer) { 3936 if (imageBuffer) {
3937 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface, 3937 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface,
(...skipping 2273 matching lines...) Expand 10 before | Expand all | Expand 10 after
6211 6211
6212 return totalBytesPerPixel; 6212 return totalBytesPerPixel;
6213 } 6213 }
6214 6214
6215 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6215 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6216 { 6216 {
6217 return m_drawingBuffer.get(); 6217 return m_drawingBuffer.get();
6218 } 6218 }
6219 6219
6220 } // namespace blink 6220 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/HTMLVideoElement.cpp ('k') | Source/platform/graphics/ImageBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698