Browse Source

fix: copy pixels in AddImageSkiaRepFromBuffer (#17843)

Milan Burda 6 years ago
parent
commit
5e7c828c9e
1 changed files with 1 additions and 1 deletions
  1. 1 1
      atom/common/api/atom_api_native_image.cc

+ 1 - 1
atom/common/api/atom_api_native_image.cc

@@ -136,7 +136,7 @@ bool AddImageSkiaRepFromBuffer(gfx::ImageSkia* image,
 
   SkBitmap bitmap;
   bitmap.allocN32Pixels(width, height, false);
-  bitmap.setPixels(const_cast<void*>(reinterpret_cast<const void*>(data)));
+  bitmap.writePixels({info, data, bitmap.rowBytes()});
 
   image->AddRepresentation(gfx::ImageSkiaRep(bitmap, scale_factor));
   return true;