Bug 1527235 - Fix how the alpha channel was missing from pasted clipboard images. r=tnikkel, a=lizzard
authorAndrew Osmond <aosmond@mozilla.com>
Thu, 14 Feb 2019 13:01:40 -0500
changeset 516004 c341768d99a4889091c5322e84ef5382302d3b7f
parent 516003 1a21b29fb4bc5118d4d62e97364f41ec72c58001
child 516005 e0e4b872648840352e81400e823a8b146f8780e3
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel, lizzard
bugs1527235
milestone66.0
Bug 1527235 - Fix how the alpha channel was missing from pasted clipboard images. r=tnikkel, a=lizzard In order to get the alpha channel when encoding BMP images from a surface, we need to supply bmp=32 in the encoder options. Differential Revision: https://phabricator.services.mozilla.com/D19835
widget/windows/nsDataObj.cpp
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -819,17 +819,17 @@ nsDataObj::GetDib(const nsACString& inFl
   nsCOMPtr<imgIContainer> image = do_QueryInterface(genericDataWrapper);
   if (!image) {
     return E_FAIL;
   }
 
   nsCOMPtr<imgITools> imgTools =
       do_CreateInstance("@mozilla.org/image/tools;1");
 
-  nsAutoString options;
+  nsAutoString options(NS_LITERAL_STRING("bpp=32;"));
   if (aFormat.cfFormat == CF_DIBV5) {
     options.AppendLiteral("version=5");
   } else {
     options.AppendLiteral("version=3");
   }
 
   nsCOMPtr<nsIInputStream> inputStream;
   nsresult rv = imgTools->EncodeImage(image, NS_LITERAL_CSTRING(IMAGE_BMP),
@@ -1439,17 +1439,17 @@ HRESULT nsDataObj::DropImage(FORMATETC& 
     }
     nsCOMPtr<imgIContainer> image(do_QueryInterface(genericDataWrapper));
     if (!image) return E_FAIL;
 
     nsCOMPtr<imgITools> imgTools =
         do_CreateInstance("@mozilla.org/image/tools;1");
     nsCOMPtr<nsIInputStream> inputStream;
     rv = imgTools->EncodeImage(image, NS_LITERAL_CSTRING(IMAGE_BMP),
-                               NS_LITERAL_STRING("version=3"),
+                               NS_LITERAL_STRING("bpp=32;version=3"),
                                getter_AddRefs(inputStream));
     if (NS_FAILED(rv) || !inputStream) {
       return E_FAIL;
     }
 
     nsCOMPtr<imgIEncoder> encoder = do_QueryInterface(inputStream);
     if (!encoder) {
       return E_FAIL;