Fix DataSourceSurface mapping in ImageUtils.cpp. (bug 1405390 part 5, r=bas)
authorDavid Anderson <danderson@mozilla.com>
Thu, 09 Nov 2017 00:43:31 -0800
changeset 391067 7fbad8fbfd1d9d42ddbddce757751fdd45755785
parent 391066 074d85a019df6bf4014f16351629a7975f8a6cf9
child 391068 9ae742527820a5c0735dd17b0a2bbade6cc593ef
push id32860
push userebalazs@mozilla.com
push dateFri, 10 Nov 2017 09:56:38 +0000
treeherdermozilla-central@864174ac0707 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbas
bugs1405390
milestone58.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
Fix DataSourceSurface mapping in ImageUtils.cpp. (bug 1405390 part 5, r=bas)
dom/canvas/ImageUtils.cpp
--- a/dom/canvas/ImageUtils.cpp
+++ b/dom/canvas/ImageUtils.cpp
@@ -112,17 +112,18 @@ public:
   GetFormat() const
   {
     return GetImageBitmapFormatFromSurfaceFromat(Surface()->GetFormat());
   }
 
   virtual uint32_t
   GetBufferLength() const
   {
-    const uint32_t stride = Surface()->Stride();
+    DataSourceSurface::ScopedMap map(Surface(), DataSourceSurface::READ);
+    const uint32_t stride = map.GetStride();
     const IntSize size = Surface()->GetSize();
     return (uint32_t)(size.height * stride);
   }
 
   virtual UniquePtr<ImagePixelLayout>
   MapDataInto(uint8_t* aBuffer,
               uint32_t aOffset,
               uint32_t aBufferLength,