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

Unified Diff: Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 409483002: Cleanup DrawingBuffer::paintCompositingResultsToCanvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove unnecessary copyTexture Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp
index 796ba7ce1ca674afdda04b83722a55bae88ec02d..dbb37adddf73ace6306c8ffc0660a46d0c543a39 100644
--- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -547,29 +547,15 @@ void DrawingBuffer::paintCompositedResultsToCanvas(ImageBuffer* imageBuffer)
return;
}
- // Since the m_frontColorBuffer was produced and sent to the compositor, it cannot be bound to an fbo.
- // We have to make a copy of it here and bind that copy instead.
- // FIXME: That's not true any more, provided we don't change texture
- // parameters.
- unsigned sourceTexture = createColorTexture();
- texImage2DResourceSafe(GL_TEXTURE_2D, 0, m_internalColorFormat, m_size.width(), m_size.height(), 0, m_colorFormat, GL_UNSIGNED_BYTE);
- m_context->copyTextureCHROMIUM(GL_TEXTURE_2D, m_frontColorBuffer.textureId, sourceTexture, 0, GL_RGBA, GL_UNSIGNED_BYTE);
-
- // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding).
- // FIXME: The WebGLRenderingContext tracks the current framebuffer binding, it would be slightly more efficient to use this value
- // rather than querying it off of the context.
- GLint previousFramebuffer = 0;
- m_context->getIntegerv(GL_FRAMEBUFFER_BINDING, &previousFramebuffer);
-
Platform3DObject framebuffer = m_context->createFramebuffer();
m_context->bindFramebuffer(GL_FRAMEBUFFER, framebuffer);
- m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, sourceTexture, 0);
+ // We don't need to bind a copy of m_frontColorBuffer since the texture parameters are untouched.
+ m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_frontColorBuffer.textureId, 0);
paintFramebufferToCanvas(framebuffer, size().width(), size().height(), !m_actualAttributes.premultipliedAlpha, imageBuffer);
m_context->deleteFramebuffer(framebuffer);
- m_context->deleteTexture(sourceTexture);
-
- m_context->bindFramebuffer(GL_FRAMEBUFFER, previousFramebuffer);
+ // Since we're using the same context as WebGL, we have to restore any state we change (in this case, just the framebuffer binding).
+ restoreFramebufferBinding();
}
void DrawingBuffer::clearPlatformLayer()
« 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