[Libreoffice-commits] core.git: Branch 'libreoffice-5-0' - svx/source

Thorsten Behrens Thorsten.Behrens at CIB.de
Wed Jan 13 12:39:20 PST 2016


 svx/source/xml/xmlgrhlp.cxx |   28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

New commits:
commit cb72051d70a844077363d52a1a54d083136cde03
Author: Thorsten Behrens <Thorsten.Behrens at CIB.de>
Date:   Mon Dec 7 23:40:39 2015 +0100

    Related: tdf#71622 compress more gfx in odf streams
    
    Except for jpeg and png, most natively-stored image fileformats compress
    rather well with zlib. adding a number of vector and pixel formats.
    
    Change-Id: I97407a98f620520b0d11552911d2339bf004dc5b
    Reviewed-on: https://gerrit.libreoffice.org/20461
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit ad0edc184792f3aa3f72e8d4ec8b76c3d1bf8479)
    Reviewed-on: https://gerrit.libreoffice.org/20467
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>
    (cherry picked from commit 26f62c80aa3684301e29dd17f9efba1bcd68264d)
    Reviewed-on: https://gerrit.libreoffice.org/21438

diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index fa21c17..5c7b0ff 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -533,7 +533,33 @@ bool SvXMLGraphicHelper::ImplWriteGraphic( const OUString& rPictureStorageName,
                 xProps->setPropertyValue( "MediaType", aAny );
             }
 
-            const bool bCompressed = aMimeType.isEmpty() || aMimeType == "image/tiff" || aMimeType == "image/svg+xml";
+            // picture formats that actuall _do_ benefit from zip
+            // storage compression
+            // .svm pics gets compressed via ZBITMAP old-style stream
+            // option below
+            static const char* aCompressiblePics[] =
+            {
+                "image/svg+xml",
+                "image/x-wmf",
+                "image/tiff",
+                "image/x-eps",
+                "image/bmp",
+                "image/x-pict"
+            };
+
+            bool bCompressed = aMimeType.isEmpty();
+            if( !bCompressed )
+            {
+                for( size_t i = 0; i < SAL_N_ELEMENTS(aCompressiblePics); ++i )
+                {
+                    if( aMimeType.equalsIgnoreAsciiCaseAscii(aCompressiblePics[i]) )
+                    {
+                        bCompressed = true;
+                        break;
+                    }
+                }
+            }
+
             aAny <<= bCompressed;
             xProps->setPropertyValue( "Compressed", aAny );
 


More information about the Libreoffice-commits mailing list