vcl/headless/svpgdi.cxx           |   20 ++++++++++++++++----
 vcl/source/bitmap/BitmapTools.cxx |    9 +++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)

New commits:
commit 2ca4b505b25e13c9f422c28252f5b7533b8e3270
Author: Caolán McNamara <caol...@redhat.com>
Date:   Wed Apr 11 16:14:06 2018 +0100

    cairo_surface_create_similar_image is >= cairo 1.12.0
    
    Change-Id: I1805e5680beff6c632016686aa661efe25a8c2f8

diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index cad5f5ea21a5..7543bc69c760 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1320,7 +1320,13 @@ SalBitmap* SvpSalGraphics::getBitmap( long nX, long nY, 
long nWidth, long nHeigh
 
 Color SvpSalGraphics::getPixel( long nX, long nY )
 {
-    cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, 
CAIRO_FORMAT_ARGB32, 1, 1);
+#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, 1, 1);
+
     cairo_t* cr = cairo_create(target);
 
     cairo_rectangle(cr, 0, 0, 1, 1);
@@ -1484,9 +1490,15 @@ cairo_surface_t* 
SvpSalGraphics::createCairoSurface(const BitmapBuffer *pBuffer)
 
 cairo_t* SvpSalGraphics::createTmpCompatibleCairoContext() const
 {
-    cairo_surface_t *target = cairo_surface_create_similar_image(m_pSurface, 
CAIRO_FORMAT_ARGB32,
-                                                         m_aFrameSize.getX() * 
m_fScale,
-                                                         m_aFrameSize.getY() * 
m_fScale);
+#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);
+
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 14, 0)
     cairo_surface_set_device_scale(target, m_fScale, m_fScale);
 #endif
diff --git a/vcl/source/bitmap/BitmapTools.cxx 
b/vcl/source/bitmap/BitmapTools.cxx
index 77583f28e3f9..6d3b0af31015 100644
--- a/vcl/source/bitmap/BitmapTools.cxx
+++ b/vcl/source/bitmap/BitmapTools.cxx
@@ -235,8 +235,13 @@ BitmapEx* CreateFromCairoSurface(Size aSize, 
cairo_surface_t * pSurface)
 {
     // FIXME: if we could teach VCL/ about cairo handles, life could
     // be significantly better here perhaps.
-    cairo_surface_t *pPixels = cairo_surface_create_similar_image(pSurface, 
CAIRO_FORMAT_ARGB32,
-                                              aSize.Width(), aSize.Height());
+
+#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 )
         return nullptr;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to