[Libreoffice-commits] core.git: svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Jul 27 17:51:54 UTC 2018


 svx/source/unodraw/UnoGraphicExporter.cxx |   17 +++++++++++++++++
 1 file changed, 17 insertions(+)

New commits:
commit b197a4488adcf37b5460f5f7a5edc8adff0edabb
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Fri Jul 27 15:23:18 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Fri Jul 27 19:51:25 2018 +0200

    svx UnoGraphicExporter: allow a custom AA just for that particular export
    
    This has an effect for text only since the cairo text renderer no longer
    ignores the "disable AA" requests.
    
    To use it, instantiate com.sun.star.drawing.GraphicExportFilter, call
    its filter() method with an argument that has a FilterData, which has an
    AntiAliasing sub-key with a boolean value.
    
    Change-Id: I4f51bc685a97141eb0fdeae5e4afed26787b1fb8
    Reviewed-on: https://gerrit.libreoffice.org/58194
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx
index ffb4675e6500..e5a410b07f54 100644
--- a/svx/source/unodraw/UnoGraphicExporter.cxx
+++ b/svx/source/unodraw/UnoGraphicExporter.cxx
@@ -108,6 +108,8 @@ namespace {
         Fraction    maScaleX;
         Fraction    maScaleY;
 
+        TriState meAntiAliasing = TRISTATE_INDET;
+
         explicit ExportSettings(const SdrModel* pSdrModel);
     };
 
@@ -584,6 +586,12 @@ void GraphicExporter::ParseSettings( const Sequence< PropertyValue >& aDescripto
                     if( pDataValues->Value >>= nVal )
                         rSettings.maScaleY = Fraction( rSettings.maScaleY.GetNumerator(), nVal );
                 }
+                else if (pDataValues->Name == "AntiAliasing")
+                {
+                    bool bAntiAliasing;
+                    if (pDataValues->Value >>= bAntiAliasing)
+                        rSettings.meAntiAliasing = bAntiAliasing ? TRISTATE_TRUE : TRISTATE_FALSE;
+                }
 
                 pDataValues++;
             }
@@ -1020,7 +1028,16 @@ sal_Bool SAL_CALL GraphicExporter::filter( const Sequence< PropertyValue >& aDes
 
     ErrCode nStatus = ERRCODE_NONE;
     if (!maGraphic)
+    {
+        SvtOptionsDrawinglayer aOptions;
+        bool bAntiAliasing = aOptions.IsAntiAliasing();
+        if (aSettings.meAntiAliasing != TRISTATE_INDET)
+            // This is safe to do globally as we own the solar mutex.
+            aOptions.SetAntiAliasing(aSettings.meAntiAliasing == TRISTATE_TRUE);
         nStatus = GetGraphic( aSettings, aGraphic, bVectorType ) ? ERRCODE_NONE : ERRCODE_GRFILTER_FILTERERROR;
+        if (aSettings.meAntiAliasing != TRISTATE_INDET)
+            aOptions.SetAntiAliasing(bAntiAliasing);
+    }
 
     if( nStatus == ERRCODE_NONE )
     {


More information about the Libreoffice-commits mailing list