[Libreoffice-commits] core.git: Branch 'aoo/trunk' - svtools/source

Armin Le Grand alg at apache.org
Fri Aug 30 07:07:35 PDT 2013


 svtools/source/misc/transfer.cxx |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

New commits:
commit a77275c610f1543dcc8b38dc5ec50f1195965f27
Author: Armin Le Grand <alg at apache.org>
Date:   Fri Aug 30 13:27:36 2013 +0000

    i122982 Fallback to bitmap reader when no PNG even when claimed

diff --git a/svtools/source/misc/transfer.cxx b/svtools/source/misc/transfer.cxx
index 62cab33..0dae8ae 100644
--- a/svtools/source/misc/transfer.cxx
+++ b/svtools/source/misc/transfer.cxx
@@ -1808,6 +1808,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
     SotStorageStreamRef xStm;
     DataFlavor aSubstFlavor;
     bool bRet(GetSotStorageStream(rFlavor, xStm));
+    bool bSuppressPNG(false); // #122982# If PNG stream not accessed, but BMP one, suppress trying to load PNG
 
     if(!bRet && HasFormat(SOT_FORMATSTR_ID_PNG) && SotExchange::GetFormatDataFlavor(SOT_FORMATSTR_ID_PNG, aSubstFlavor))
     {
@@ -1819,18 +1820,20 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
     {
         // when no direct success, try if BMP is available
         bRet = GetSotStorageStream(aSubstFlavor, xStm);
+        bSuppressPNG = bRet;
     }
 
     if(bRet)
     {
-        if(rFlavor.MimeType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("image/png")))
+        if(!bSuppressPNG && rFlavor.MimeType.equalsIgnoreAsciiCase(::rtl::OUString::createFromAscii("image/png")))
         {
             // it's a PNG, import to BitmapEx
             ::vcl::PNGReader aPNGReader(*xStm);
 
             rBmpEx = aPNGReader.Read();
         }
-        else
+
+        if(rBmpEx.IsEmpty())
         {
             Bitmap aBitmap;
             Bitmap aMask;
@@ -1848,7 +1851,7 @@ sal_Bool TransferableDataHelper::GetBitmapEx( const DataFlavor& rFlavor, BitmapE
             }
         }
 
-        bRet = (ERRCODE_NONE == xStm->GetError());
+        bRet = (ERRCODE_NONE == xStm->GetError() && !rBmpEx.IsEmpty());
 
         /* SJ: #110748# At the moment we are having problems with DDB inserted as DIB. The
            problem is, that some graphics are inserted much too big because the nXPelsPerMeter


More information about the Libreoffice-commits mailing list