Bug 1573997 - Use correct stride when repainting, r=loganfsmyth.
authorBrian Hackett <bhackett1024@gmail.com>
Wed, 14 Aug 2019 22:47:51 +0000
changeset 488136 9b390150ec32771f276b47186e7467bc68d6fb5c
parent 488135 7710c9d9b6b0b2f8f51b0d3d4e9dea3753201b25
child 488137 16d99c5a8a550366c7785edaeadf67c14d7151f1
push id113900
push usercbrindusan@mozilla.com
push dateThu, 15 Aug 2019 09:53:50 +0000
treeherdermozilla-inbound@0db07ff50ab5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersloganfsmyth
bugs1573997
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1573997 - Use correct stride when repainting, r=loganfsmyth. Differential Revision: https://phabricator.services.mozilla.com/D42044
toolkit/recordreplay/ipc/ChildIPC.cpp
--- a/toolkit/recordreplay/ipc/ChildIPC.cpp
+++ b/toolkit/recordreplay/ipc/ChildIPC.cpp
@@ -564,20 +564,23 @@ bool Repaint(nsAString& aData) {
   if (!gDrawTargetBuffer) {
     return false;
   }
 
   // Get an image encoder for the media type.
   nsCString encoderCID("@mozilla.org/image/encoder;2?type=image/png");
   nsCOMPtr<imgIEncoder> encoder = do_CreateInstance(encoderCID.get());
 
+  size_t stride = layers::ImageDataSerializer::ComputeRGBStride(gSurfaceFormat,
+                                                                gPaintWidth);
+
   nsString options;
   nsresult rv = encoder->InitFromData(
-      (const uint8_t*)gDrawTargetBuffer, gPaintWidth * gPaintHeight * 4,
-      gPaintWidth, gPaintHeight, gPaintWidth * 4,
+      (const uint8_t*)gDrawTargetBuffer, stride * gPaintHeight,
+      gPaintWidth, gPaintHeight, stride,
       imgIEncoder::INPUT_FORMAT_HOSTARGB, options);
   if (NS_FAILED(rv)) {
     return false;
   }
 
   uint64_t count;
   rv = encoder->Available(&count);
   if (NS_FAILED(rv)) {