Bug 1481385 - Calculate bitmap mask size with stride. r=lsalzman
authorMartin Stransky <stransky@redhat.com>
Thu, 09 Aug 2018 12:10:18 +0300
changeset 485915 f60a7c1ec1efb3312ae1ec49b9fbac22ba3a1b2f
parent 485914 39b075bd9b5e6827ece8a189863717abffc88300
child 485916 19e2b100fdb90a7962d0a46d05af48f7df8635b4
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslsalzman
bugs1481385
milestone63.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 1481385 - Calculate bitmap mask size with stride. r=lsalzman
widget/gtk/WindowSurfaceX11Image.cpp
--- a/widget/gtk/WindowSurfaceX11Image.cpp
+++ b/widget/gtk/WindowSurfaceX11Image.cpp
@@ -169,21 +169,23 @@ UpdateMaskBits(gchar* aMaskBits, int32_t
       }
       aImageData += stride;
   }
 }
 
 void
 WindowSurfaceX11Image::ResizeTransparencyBitmap(int aWidth, int aHeight)
 {
-  if (mTransparencyBitmapWidth*mTransparencyBitmapHeight < aWidth*aHeight) {
-    delete[] mTransparencyBitmap;
+  int32_t actualSize =
+    GetBitmapStride(mTransparencyBitmapWidth)*mTransparencyBitmapHeight;
+  int32_t newSize = GetBitmapStride(aWidth)*aHeight;
 
-    int32_t byteSize = GetBitmapStride(aWidth)*aHeight;
-    mTransparencyBitmap = new gchar[byteSize];
+  if (actualSize < newSize) {
+    delete[] mTransparencyBitmap;
+    mTransparencyBitmap = new gchar[newSize];
   }
 
   mTransparencyBitmapWidth = aWidth;
   mTransparencyBitmapHeight = aHeight;
 }
 
 void
 WindowSurfaceX11Image::ApplyTransparencyBitmap()