summaryrefslogtreecommitdiff
path: root/vcl/headless/svpgdi.cxx
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-12-09 16:28:42 -0500
committerAshod Nakashian <ashnakash@gmail.com>2017-12-26 21:48:36 +0100
commit54596087e57ea533253e19eea594d9b6c06e8d26 (patch)
tree7742656890e21b8750deeb2f676168b1091599d6 /vcl/headless/svpgdi.cxx
parent33761c69e9d3fa16e7a5b176200d183dc3236627 (diff)
vcl-svp: add 24-bit (3-byte) RGB surface support to Cairo
(cherry picked from commit e8ba02b1d56dc7b59a4f0a7373995b28653a0597) Reviewed-on: https://gerrit.libreoffice.org/46681 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit 31c044e2501b9d4a0917e4e09133660bbe2a24dc) Change-Id: I7707219eae4c2d6d40c8dc957207b63d3049a75f Reviewed-on: https://gerrit.libreoffice.org/47010 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'vcl/headless/svpgdi.cxx')
-rw-r--r--vcl/headless/svpgdi.cxx25
1 files changed, 21 insertions, 4 deletions
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 6a5409e7f2e9..396618f354a1 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -38,9 +38,9 @@
#include <cairo.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
+# 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
@@ -104,9 +104,18 @@ namespace
cairo_format_t getCairoFormat(const BitmapBuffer& rBuffer)
{
cairo_format_t nFormat;
+#ifdef HAVE_CAIRO_FORMAT_RGB24_888
+ assert(rBuffer.mnBitCount == 32 || rBuffer.mnBitCount == 24 || rBuffer.mnBitCount == 1);
+#else
assert(rBuffer.mnBitCount == 32 || rBuffer.mnBitCount == 1);
+#endif
+
if (rBuffer.mnBitCount == 32)
nFormat = CAIRO_FORMAT_ARGB32;
+#ifdef HAVE_CAIRO_FORMAT_RGB24_888
+ else if (rBuffer.mnBitCount == 24)
+ nFormat = CAIRO_FORMAT_RGB24_888;
+#endif
else
nFormat = CAIRO_FORMAT_A1;
return nFormat;
@@ -215,7 +224,11 @@ namespace
explicit SourceHelper(const SalBitmap& rSourceBitmap)
{
const SvpSalBitmap& rSrcBmp = static_cast<const SvpSalBitmap&>(rSourceBitmap);
+#ifdef HAVE_CAIRO_FORMAT_RGB24_888
+ if (rSrcBmp.GetBitCount() != 32 && rSrcBmp.GetBitCount() != 24)
+#else
if (rSrcBmp.GetBitCount() != 32)
+#endif
{
//big stupid copy here
static bool bWarnedOnce = false;
@@ -1437,8 +1450,12 @@ namespace
if (!pBuffer)
return false;
- // Cairo doesn't support 24-bit RGB; only ARGB with the alpha ignored.
+ // We use Cairo that supports 24-bit RGB.
+#ifdef HAVE_CAIRO_FORMAT_RGB24_888
+ if (pBuffer->mnBitCount != 32 && pBuffer->mnBitCount != 24 && pBuffer->mnBitCount != 1)
+#else
if (pBuffer->mnBitCount != 32 && pBuffer->mnBitCount != 1)
+#endif
return false;
cairo_format_t nFormat = getCairoFormat(*pBuffer);