drawinglayer/source/processor2d/processor2dtools.cxx |   21 ++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

New commits:
commit bf3cd8e50f886084500e3a8ff72ff4ffab05ddd7
Author:     Armin Le Grand (Collabora) <armin.le.gr...@me.com>
AuthorDate: Mon Aug 26 14:25:19 2024 +0200
Commit:     Armin Le Grand <armin.le.gr...@me.com>
CommitDate: Tue Aug 27 13:05:19 2024 +0200

    CairoSDPR: Make using SDPR dependent of ExperimentalMode
    
    Change-Id: Ia25fe2f3c5ff4904530ea8c296d10bbbe2823af5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172394
    Tested-by: Jenkins
    Reviewed-by: Armin Le Grand <armin.le.gr...@me.com>

diff --git a/drawinglayer/source/processor2d/processor2dtools.cxx 
b/drawinglayer/source/processor2d/processor2dtools.cxx
index 585f312c7c60..742115f0b156 100644
--- a/drawinglayer/source/processor2d/processor2dtools.cxx
+++ b/drawinglayer/source/processor2d/processor2dtools.cxx
@@ -27,6 +27,7 @@
 #include <drawinglayer/processor2d/d2dpixelprocessor2d.hxx>
 #elif USE_HEADLESS_CODE
 #include <drawinglayer/processor2d/cairopixelprocessor2d.hxx>
+#include <officecfg/Office/Common.hxx>
 #endif
 
 namespace drawinglayer::processor2d
@@ -35,10 +36,23 @@ std::unique_ptr<BaseProcessor2D> 
createPixelProcessor2DFromOutputDevice(
     OutputDevice& rTargetOutDev,
     const drawinglayer::geometry::ViewInformation2D& rViewInformation2D)
 {
-    static const bool bTestSystemPrimitiveRenderer(nullptr != 
std::getenv("TEST_SYSTEM_PRIMITIVE_RENDERER"));
-    if(bTestSystemPrimitiveRenderer)
+    static bool bUsePrimitiveRenderer(
+#if defined(_WIN32)
+        // Windows: make still dependent on TEST_SYSTEM_PRIMITIVE_RENDERER
+        nullptr != std::getenv("TEST_SYSTEM_PRIMITIVE_RENDERER")
+#elif USE_HEADLESS_CODE
+        // Linux/Cairo: make dependent on ExperimentalMode now
+        officecfg::Office::Common::Misc::ExperimentalMode::get()
+#else
+        // all others: do not use, not (yet) supported
+        false
+#endif
+    );
+
+    if(bUsePrimitiveRenderer)
     {
         drawinglayer::geometry::ViewInformation2D 
aViewInformation2D(rViewInformation2D);
+
         // if mnOutOffX/mnOutOffY is set (a 'hack' to get a cheap additional 
offset), apply it additionally
         if(0 != rTargetOutDev.GetOutOffXPixel() || 0 != 
rTargetOutDev.GetOutOffYPixel())
         {
@@ -46,6 +60,7 @@ std::unique_ptr<BaseProcessor2D> 
createPixelProcessor2DFromOutputDevice(
             aTransform.translate(rTargetOutDev.GetOutOffXPixel(), 
rTargetOutDev.GetOutOffYPixel());
             aViewInformation2D.setViewTransformation(aTransform);
         }
+
 #if defined(_WIN32)
         SystemGraphicsData aData(rTargetOutDev.GetSystemGfxData());
         std::unique_ptr<D2DPixelProcessor2D> aRetval(
@@ -61,7 +76,7 @@ std::unique_ptr<BaseProcessor2D> 
createPixelProcessor2DFromOutputDevice(
 #endif
     }
 
-    // create Pixel Vcl-Processor
+    // default: create Pixel Vcl-Processor
     return std::make_unique<VclPixelProcessor2D>(rViewInformation2D, 
rTargetOutDev);
 }
 

Reply via email to