diff options
Diffstat (limited to 'vcl/headless/svpgdi.cxx')
-rw-r--r-- | vcl/headless/svpgdi.cxx | 25 |
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); |