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

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

Issue 1170523002: Removing GraphicsContext from ImageBuffer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix for shape bug 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 | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/layout/shapes/Shape.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 3730 matching lines...) Expand 10 before | Expand all | Expand 10 after
3741 { 3741 {
3742 IntSize size(width, height); 3742 IntSize size(width, height);
3743 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size); 3743 ImageBuffer* buf = m_generatedImageCache.imageBuffer(size);
3744 if (!buf) { 3744 if (!buf) {
3745 synthesizeGLError(GL_OUT_OF_MEMORY, functionName, "out of memory"); 3745 synthesizeGLError(GL_OUT_OF_MEMORY, functionName, "out of memory");
3746 return nullptr; 3746 return nullptr;
3747 } 3747 }
3748 3748
3749 IntRect srcRect(IntPoint(), image->size()); 3749 IntRect srcRect(IntPoint(), image->size());
3750 IntRect destRect(0, 0, size.width(), size.height()); 3750 IntRect destRect(0, 0, size.width(), size.height());
3751 buf->context()->drawImage(image, destRect, srcRect); 3751 SkPaint paint;
3752 image->draw(buf->canvas(), paint, destRect, srcRect, DoNotRespectImageOrient ation, Image::DoNotClampImageToSourceRect);
3752 return buf->copyImage(ImageBuffer::fastCopyImageMode()); 3753 return buf->copyImage(ImageBuffer::fastCopyImageMode());
3753 } 3754 }
3754 3755
3755 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in ternalformat, 3756 void WebGLRenderingContextBase::texImage2D(GLenum target, GLint level, GLenum in ternalformat,
3756 GLsizei width, GLsizei height, GLint border, 3757 GLsizei width, GLsizei height, GLint border,
3757 GLenum format, GLenum type, DOMArrayBufferView* pixels, ExceptionState& exce ptionState) 3758 GLenum format, GLenum type, DOMArrayBufferView* pixels, ExceptionState& exce ptionState)
3758 { 3759 {
3759 if (isContextLost() || !validateTexFuncData("texImage2D", level, width, heig ht, format, type, pixels, NullAllowed) 3760 if (isContextLost() || !validateTexFuncData("texImage2D", level, width, heig ht, format, type, pixels, NullAllowed)
3760 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferVie w, target, level, internalformat, width, height, border, format, type, 0, 0)) 3761 || !validateTexFunc("texImage2D", NotTexSubImage2D, SourceArrayBufferVie w, target, level, internalformat, width, height, border, format, type, 0, 0))
3761 return; 3762 return;
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
3931 3932
3932 // Try using an accelerated image buffer, this allows YUV conversion to be done on the GPU. 3933 // 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()))); 3934 OwnPtr<ImageBufferSurface> surface = adoptPtr(new AcceleratedImageBuffer Surface(IntSize(video->videoWidth(), video->videoHeight())));
3934 if (surface->isValid()) { 3935 if (surface->isValid()) {
3935 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( ))); 3936 OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(surface.release( )));
3936 if (imageBuffer) { 3937 if (imageBuffer) {
3937 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface, 3938 // The video element paints an RGBA frame into our surface here. By using an AcceleratedImageBufferSurface,
3938 // we enable the WebMediaPlayer implementation to do any necessa ry color space conversion on the GPU (though it 3939 // we enable the WebMediaPlayer implementation to do any necessa ry color space conversion on the GPU (though it
3939 // may still do a CPU conversion and upload the results). 3940 // may still do a CPU conversion and upload the results).
3940 video->paintCurrentFrame(imageBuffer->canvas(), IntRect(0, 0, vi deo->videoWidth(), video->videoHeight()), nullptr); 3941 video->paintCurrentFrame(imageBuffer->canvas(), IntRect(0, 0, vi deo->videoWidth(), video->videoHeight()), nullptr);
3941 imageBuffer->context()->canvas()->flush(); 3942 imageBuffer->canvas()->flush();
3942 3943
3943 // This is a straight GPU-GPU copy, any necessary color space co nversion was handled in the paintCurrentFrameInContext() call. 3944 // This is a straight GPU-GPU copy, any necessary color space co nversion was handled in the paintCurrentFrameInContext() call.
3944 if (imageBuffer->copyToPlatformTexture(webContext(), texture->ob ject(), internalformat, type, 3945 if (imageBuffer->copyToPlatformTexture(webContext(), texture->ob ject(), internalformat, type,
3945 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) { 3946 level, m_unpackPremultiplyAlpha, m_unpackFlipY)) {
3946 texture->setLevelInfo(target, level, internalformat, video-> videoWidth(), video->videoHeight(), 1, type); 3947 texture->setLevelInfo(target, level, internalformat, video-> videoWidth(), video->videoHeight(), 1, type);
3947 return; 3948 return;
3948 } 3949 }
3949 } 3950 }
3950 } 3951 }
3951 } 3952 }
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
6211 6212
6212 return totalBytesPerPixel; 6213 return totalBytesPerPixel;
6213 } 6214 }
6214 6215
6215 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6216 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6216 { 6217 {
6217 return m_drawingBuffer.get(); 6218 return m_drawingBuffer.get();
6218 } 6219 }
6219 6220
6220 } // namespace blink 6221 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/frame/LocalFrame.cpp ('k') | Source/core/layout/shapes/Shape.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698