[Libreoffice-commits] core.git: configure.ac vcl/headless vcl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu Apr 4 16:08:25 UTC 2019


 configure.ac                      |    2 +-
 vcl/headless/svpgdi.cxx           |   23 ++++++++++++++++++++++-
 vcl/source/bitmap/BitmapTools.cxx |    4 ++++
 3 files changed, 27 insertions(+), 2 deletions(-)

New commits:
commit 3c6c56b107d71d5f4790be0b76299e8f215f88cc
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Apr 4 15:56:29 2019 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Apr 4 18:07:53 2019 +0200

    Revert "raise cairo baseline to 1.12.0"
    
    This reverts commit 50580f452cc7c88a231831619a3f05958ce56460.
    
    Revert "raise cairo baseline to 1.10.0"
    
    This reverts commit 58a0e60dee0d27a699f856827c20b792417d3478.
    
    32bit baseline is currently at cairo 1.8.8
    
    Change-Id: I5156df6aee03dbbb2e209dbd5717a98580256170
    Reviewed-on: https://gerrit.libreoffice.org/70260
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/configure.ac b/configure.ac
index 02ea8809de4b..befe75bbac3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -11600,7 +11600,7 @@ if test "$test_cairo" = "yes"; then
         SYSTEM_CAIRO=TRUE
         AC_MSG_RESULT([yes])
 
-        PKG_CHECK_MODULES( CAIRO, cairo >= 1.12.0 )
+        PKG_CHECK_MODULES( CAIRO, cairo >= 1.8.0 )
         CAIRO_CFLAGS=$(printf '%s' "$CAIRO_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g")
         FilterLibs "${CAIRO_LIBS}"
         CAIRO_LIBS="${filteredlibs}"
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index b072bf946cdc..2cf49ca17696 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -47,6 +47,12 @@
 #include <unx/gendata.hxx>
 #include <dlfcn.h>
 
+#if ENABLE_CAIRO_CANVAS
+#   if defined CAIRO_VERSION && CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 10, 0)
+#      define CAIRO_OPERATOR_DIFFERENCE (static_cast<cairo_operator_t>(23))
+#   endif
+#endif
+
 namespace
 {
     basegfx::B2DRange getClipBox(cairo_t* cr)
@@ -1739,7 +1745,11 @@ std::shared_ptr<SalBitmap> SvpSalGraphics::getBitmap( long nX, long nY, long nWi
 
 Color SvpSalGraphics::getPixel( long nX, long nY )
 {
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
     cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, CAIRO_FORMAT_ARGB32, 1, 1);
+#else
+    cairo_surface_t *target = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1);
+#endif
 
     cairo_t* cr = cairo_create(target);
 
@@ -1795,7 +1805,14 @@ void SvpSalGraphics::invert(const basegfx::B2DPolygon &rPoly, SalInvert nFlags)
 
     cairo_set_source_rgb(cr, 1.0, 1.0, 1.0);
 
-    cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
+    if (cairo_version() >= CAIRO_VERSION_ENCODE(1, 10, 0))
+    {
+        cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE);
+    }
+    else
+    {
+        SAL_WARN("vcl.gdi", "SvpSalGraphics::invert, archaic cairo");
+    }
 
     if (nFlags & SalInvert::TrackFrame)
     {
@@ -1973,7 +1990,11 @@ cairo_surface_t* SvpSalGraphics::createCairoSurface(const BitmapBuffer *pBuffer)
 
 cairo_t* SvpSalGraphics::createTmpCompatibleCairoContext() const
 {
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
     cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface,
+#else
+    cairo_surface_t *target = cairo_image_surface_create(
+#endif
             CAIRO_FORMAT_ARGB32,
             m_aFrameSize.getX() * m_fScale,
             m_aFrameSize.getY() * m_fScale);
diff --git a/vcl/source/bitmap/BitmapTools.cxx b/vcl/source/bitmap/BitmapTools.cxx
index 212557d3c28a..6f14c3526d42 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -236,7 +236,11 @@ BitmapEx* CreateFromCairoSurface(Size aSize, cairo_surface_t * pSurface)
     // FIXME: if we could teach VCL/ about cairo handles, life could
     // be significantly better here perhaps.
 
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 12, 0)
     cairo_surface_t *pPixels = cairo_surface_create_similar_image(pSurface,
+#else
+    cairo_surface_t *pPixels = cairo_image_surface_create(
+#endif
             CAIRO_FORMAT_ARGB32, aSize.Width(), aSize.Height());
     cairo_t *pCairo = cairo_create( pPixels );
     if( !pPixels || !pCairo || cairo_status(pCairo) != CAIRO_STATUS_SUCCESS )


More information about the Libreoffice-commits mailing list