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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp

Issue 2495953002: Support uploads of sub-rectangles of canvases to 2D and 3D textures. (Closed)
Patch Set: Fixed regression in accelerated video-to-texture uploads. Marked Mac Intel failures. Created 4 years, 1 month 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
Index: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
index 378f932b67c93e6c9052bfff6bef2f40fc79368f..8a959919052273ddf1112460b0821cd8c9773761 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -214,7 +214,9 @@ bool ImageBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl,
GLenum destType,
GLint level,
bool premultiplyAlpha,
- bool flipY) {
+ bool flipY,
+ const IntPoint& destPoint,
+ const IntRect& sourceSubRectangle) {
if (!Extensions3DUtil::canUseCopyTextureCHROMIUM(
GL_TEXTURE_2D, internalFormat, destType, level))
return false;
@@ -264,9 +266,14 @@ bool ImageBuffer::copyToPlatformTexture(gpu::gles2::GLES2Interface* gl,
// The canvas is stored in a premultiplied format, so unpremultiply if
// necessary. The canvas is also stored in an inverted position, so the flip
// semantics are reversed.
- gl->CopyTextureCHROMIUM(sourceTexture, texture, internalFormat, destType,
- flipY ? GL_FALSE : GL_TRUE, GL_FALSE,
- premultiplyAlpha ? GL_FALSE : GL_TRUE);
+ // It is expected that callers of this method have already allocated
+ // the platform texture with the appropriate size.
+ gl->CopySubTextureCHROMIUM(sourceTexture, texture, destPoint.x(),
+ destPoint.y(), sourceSubRectangle.x(),
+ sourceSubRectangle.y(), sourceSubRectangle.width(),
+ sourceSubRectangle.height(),
+ flipY ? GL_FALSE : GL_TRUE, GL_FALSE,
+ premultiplyAlpha ? GL_FALSE : GL_TRUE);
gl->DeleteTextures(1, &sourceTexture);
@@ -306,7 +313,8 @@ bool ImageBuffer::copyRenderingResultsFromDrawingBuffer(
gl->Flush();
return drawingBuffer->copyToPlatformTexture(
- gl, textureId, GL_RGBA, GL_UNSIGNED_BYTE, 0, true, false, sourceBuffer);
+ gl, textureId, GL_RGBA, GL_UNSIGNED_BYTE, 0, true, false, IntPoint(0, 0),
+ IntRect(IntPoint(0, 0), drawingBuffer->size()), sourceBuffer);
}
void ImageBuffer::draw(GraphicsContext& context,

Powered by Google App Engine
This is Rietveld 408576698