Bug 1328539 - writeX/Y should be relative to x/yOffset. - r=daoshengmu
MozReview-Commit-ID: KKstUheoSrJ
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -2011,16 +2011,19 @@ DoCopyTexOrSubImage(WebGLContext* webgl,
////
uint32_t readX, readY;
uint32_t writeX, writeY;
uint32_t rwWidth, rwHeight;
Intersect(srcTotalWidth, xWithinSrc, dstWidth, &readX, &writeX, &rwWidth);
Intersect(srcTotalHeight, yWithinSrc, dstHeight, &readY, &writeY, &rwHeight);
+ writeX += xOffset;
+ writeY += yOffset;
+
////
GLenum error = 0;
do {
const auto& idealUnpack = dstUsage->idealUnpack;
if (!isSubImage) {
UniqueBuffer buffer;
@@ -2053,17 +2056,16 @@ DoCopyTexOrSubImage(WebGLContext* webgl,
// There aren't any pixels to copy, so we're 'done'.
return true;
}
const auto& srcFormat = srcUsage->format;
ScopedCopyTexImageSource maybeSwizzle(webgl, funcName, srcTotalWidth,
srcTotalHeight, srcFormat, dstUsage);
- const uint8_t zOffset = 0;
error = DoCopyTexSubImage(gl, target, level, writeX, writeY, zOffset, readX,
readY, rwWidth, rwHeight);
if (error)
break;
return true;
} while (false);