Bug 1440559 - don't multiply DataSourceSurfaceRecording stride by bpp. r=jrmuizel
authorLee Salzman <lsalzman@mozilla.com>
Fri, 23 Feb 2018 10:37:32 -0500
changeset 759066 9140f4e82b3b065098217ec7f756bbc6539ef07a
parent 759040 99f373203aea5c8de21c7672169f128a5d4ea601
child 759067 9d8357f7a1cbd3d0d37a83636f2b99b124b57ad0
push id100272
push userrwood@mozilla.com
push dateFri, 23 Feb 2018 18:27:33 +0000
reviewersjrmuizel
bugs1440559
milestone60.0a1
Bug 1440559 - don't multiply DataSourceSurfaceRecording stride by bpp. r=jrmuizel MozReview-Commit-ID: LvvB9HlF01h
gfx/2d/DrawTargetRecording.cpp
--- a/gfx/2d/DrawTargetRecording.cpp
+++ b/gfx/2d/DrawTargetRecording.cpp
@@ -120,19 +120,19 @@ public:
   ~DataSourceSurfaceRecording()
   {
   }
 
   static already_AddRefed<DataSourceSurface>
   Init(uint8_t *aData, IntSize aSize, int32_t aStride, SurfaceFormat aFormat)
   {
     //XXX: do we need to ensure any alignment here?
-    auto data = MakeUnique<uint8_t[]>(aStride * aSize.height * BytesPerPixel(aFormat));
+    auto data = MakeUnique<uint8_t[]>(aStride * aSize.height);
     if (data) {
-      memcpy(data.get(), aData, aStride * aSize.height * BytesPerPixel(aFormat));
+      memcpy(data.get(), aData, aStride * aSize.height);
       RefPtr<DataSourceSurfaceRecording> surf = new DataSourceSurfaceRecording(Move(data), aSize, aStride, aFormat);
       return surf.forget();
     }
     return nullptr;
   }
 
   virtual SurfaceType GetType() const override { return SurfaceType::RECORDING; }
   virtual IntSize GetSize() const override { return mSize; }