Bug 1323617 - Don't assert for performance trap when srcPremult == dstPremult, even if the formats allow us to skip premult. - r=ethlin
MozReview-Commit-ID: 4OIdz48KhfH
--- a/dom/canvas/WebGLTexelConversions.cpp
+++ b/dom/canvas/WebGLTexelConversions.cpp
@@ -394,17 +394,21 @@ ConvertImage(size_t width, size_t height
//
// The case where absolutely nothing needs to be done is supposed to have
// been handled earlier (in TexImage2D_base, etc).
//
// So the case we're handling here is when even though no format conversion is
// needed, we still might have to flip vertically and/or to adjust to a different
// stride.
- MOZ_ASSERT(shouldYFlip || srcStride != dstStride,
+ // We ignore canSkipPremult for this perf trap, since it's an avoidable perf cliff
+ // under the WebGL API user's control.
+ MOZ_ASSERT((srcPremultiplied != dstPremultiplied ||
+ shouldYFlip ||
+ srcStride != dstStride),
"Performance trap -- should handle this case earlier to avoid memcpy");
const auto bytesPerPixel = TexelBytesForFormat(srcFormat);
const size_t bytesPerRow = bytesPerPixel * width;
while (srcItr != srcEnd) {
memcpy(dstItr, srcItr, bytesPerRow);
srcItr += srcStride;