summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-02-14 22:42:55 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-02-14 22:43:32 +0100
commit1f058d19efee26a4f945086e025f50027f5a05fd (patch)
treed0ad45374bd604fa01bbaac2f0ffec76ba809505
parent260b06c1c96285459947231a93f08e413be89dd0 (diff)
downloadUXP-1f058d19efee26a4f945086e025f50027f5a05fd.tar
UXP-1f058d19efee26a4f945086e025f50027f5a05fd.tar.gz
UXP-1f058d19efee26a4f945086e025f50027f5a05fd.tar.lz
UXP-1f058d19efee26a4f945086e025f50027f5a05fd.tar.xz
UXP-1f058d19efee26a4f945086e025f50027f5a05fd.zip
Preserve transparency when copying a DIB to/from the clipboard.
In order to get the alpha channel when encoding BMP images from a surface, we need to supply bmp=32 in the encoder options.
-rw-r--r--widget/windows/nsDataObj.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp
index ee2db7b65..a19dcb182 100644
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -921,7 +921,7 @@ nsDataObj::GetDib(const nsACString& inFlavor,
if ( image ) {
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 {
@@ -1580,7 +1580,7 @@ HRESULT nsDataObj::DropImage(FORMATETC& aFE, STGMEDIUM& aSTG)
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;