vcl/headless/CairoCommon.cxx     |   28 ++++++++++++++++++++++++++++
 vcl/headless/svpgdi.cxx          |   32 --------------------------------
 vcl/inc/headless/CairoCommon.hxx |    2 ++
 3 files changed, 30 insertions(+), 32 deletions(-)

New commits:
commit fed7cc51c9bea947478a2451d545cd9fa53ebd1d
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Wed Dec 29 15:18:03 2021 +0900
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Wed Jan 5 04:34:59 2022 +0100

    vcl: move estimateUsageInBytesForSurfaceHelper to CairoCommon
    
    Change-Id: I3c4140f99db4867109b04416317b96b268d9d8c5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127925
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/headless/CairoCommon.cxx b/vcl/headless/CairoCommon.cxx
index 94ca2c3158be..6de48a501b98 100644
--- a/vcl/headless/CairoCommon.cxx
+++ b/vcl/headless/CairoCommon.cxx
@@ -1180,6 +1180,34 @@ const char* 
pDisableDownScale(getenv("SAL_DISABLE_CAIRO_DOWNSCALE"));
 bool bDisableDownScale(nullptr != pDisableDownScale);
 }
 
+sal_Int64 estimateUsageInBytesForSurfaceHelper(const SurfaceHelper* pHelper)
+{
+    sal_Int64 nRetval(0);
+
+    if (nullptr != pHelper)
+    {
+        cairo_surface_t* pSurface(pHelper->getSurface());
+
+        if (pSurface)
+        {
+            const tools::Long 
nStride(cairo_image_surface_get_stride(pSurface));
+            const tools::Long 
nHeight(cairo_image_surface_get_height(pSurface));
+
+            nRetval = nStride * nHeight;
+
+            // if we do downscale, size will grow by 1/4 + 1/16 + 1/32 + ...,
+            // rough estimation just multiplies by 1.25, should be good enough
+            // for estimation of buffer survival time
+            if (!bDisableDownScale)
+            {
+                nRetval = (nRetval * 5) / 4;
+            }
+        }
+    }
+
+    return nRetval;
+}
+
 cairo_surface_t* SurfaceHelper::implCreateOrReuseDownscale(unsigned long 
nTargetWidth,
                                                            unsigned long 
nTargetHeight)
 {
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 77553761e040..33e4e220cc69 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -60,38 +60,6 @@
 
 namespace
 {
-    // check for env var that decides for using downscale pattern
-    const char* pDisableDownScale(getenv("SAL_DISABLE_CAIRO_DOWNSCALE"));
-    bool bDisableDownScale(nullptr != pDisableDownScale);
-
-    sal_Int64 estimateUsageInBytesForSurfaceHelper(const SurfaceHelper* 
pHelper)
-    {
-        sal_Int64 nRetval(0);
-
-        if(nullptr != pHelper)
-        {
-            cairo_surface_t* pSurface(pHelper->getSurface());
-
-            if(pSurface)
-            {
-                const tools::Long 
nStride(cairo_image_surface_get_stride(pSurface));
-                const tools::Long 
nHeight(cairo_image_surface_get_height(pSurface));
-
-                nRetval = nStride * nHeight;
-
-                // if we do downscale, size will grow by 1/4 + 1/16 + 1/32 + 
...,
-                // rough estimation just multiplies by 1.25, should be good 
enough
-                // for estimation of buffer survival time
-                if(!bDisableDownScale)
-                {
-                    nRetval = (nRetval * 5) / 4;
-                }
-            }
-        }
-
-        return nRetval;
-    }
-
     class SystemDependentData_BitmapHelper : public 
basegfx::SystemDependentData
     {
     private:
diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx
index e8b1a4927e21..8d5dd22b1a75 100644
--- a/vcl/inc/headless/CairoCommon.hxx
+++ b/vcl/inc/headless/CairoCommon.hxx
@@ -227,4 +227,6 @@ public:
                                 unsigned long nTargetHeight = 0) const;
 };
 
+VCL_DLLPUBLIC sal_Int64 estimateUsageInBytesForSurfaceHelper(const 
SurfaceHelper* pHelper);
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to