You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-rhbz-1341064-fix-Outpu...

51 lines
1.9 KiB

From e9ef81eeefba5c4ec6de3fe72aefb6af26de30c4 Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 27 Jun 2016 14:17:38 -0400
Subject: [PATCH 1/2] rhbz#1341064 fix OutputDevice test on big endian systems
Change-Id: I902acd90797ab26304bc5b239b862cae9f3075ef
---
vcl/headless/svpgdi.cxx | 6 ++++++
vcl/inc/headless/svpgdi.hxx | 4 +++-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 34fa731..511a427 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1125,9 +1125,15 @@ SalColor SvpSalGraphics::getPixel( long nX, long nY )
unsigned char *surface_data = cairo_image_surface_get_data(m_pSurface);
unsigned char *row = surface_data + (nStride*nY);
unsigned char *data = row + (nX * 4);
+# if defined OSL_BIGENDIAN
+ sal_uInt8 b = unpremultiply(data[3], data[0]);
+ sal_uInt8 g = unpremultiply(data[2], data[0]);
+ sal_uInt8 r = unpremultiply(data[1], data[0]);
+#else
sal_uInt8 b = unpremultiply(data[0], data[3]);
sal_uInt8 g = unpremultiply(data[1], data[3]);
sal_uInt8 r = unpremultiply(data[2], data[3]);
+#endif
return MAKE_SALCOLOR(r, g, b);
}
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index bb2e2f5..1bd4b65 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -37,8 +37,10 @@
//which is internal in that case, to swap the rgb components so that
//cairo then matches the OpenGL GL_RGBA format so we can use it there
//where we don't have GL_BGRA support.
-#ifdef ANDROID
+#if defined ANDROID
# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown)
+#elif defined OSL_BIGENDIAN
+# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown)
#else
# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra | ScanlineFormat::TopDown)
#endif
--
2.7.4