Resolves: rhbz#1341064 fix test on big endian systems

f41
David Tardon 9 years ago
parent 5f3bcc9db0
commit 3735f9fb51

@ -0,0 +1,50 @@
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

@ -0,0 +1,126 @@
From cff87aac4ec77957569377d690bc4aa8f7146e0d Mon Sep 17 00:00:00 2001
From: David Tardon <dtardon@redhat.com>
Date: Mon, 27 Jun 2016 20:37:25 +0200
Subject: [PATCH 2/2] update other places that read data from cairo image
surface
Change-Id: Icb8761e5ff89e1c0e0e034a751fe9a50ad5ab90a
---
canvas/source/cairo/cairo_canvasbitmap.cxx | 7 ++++++
vcl/headless/svpgdi.cxx | 36 +++++++++++++-----------------
vcl/inc/headless/svpgdi.hxx | 12 ++++++++++
3 files changed, 34 insertions(+), 21 deletions(-)
diff --git a/canvas/source/cairo/cairo_canvasbitmap.cxx b/canvas/source/cairo/cairo_canvasbitmap.cxx
index 37c8902..86020ac 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.cxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.cxx
@@ -152,10 +152,17 @@ namespace cairocanvas
sal_uInt32 *pPix = reinterpret_cast<sal_uInt32 *>(pSrc + nStride * y);
for( unsigned long x = 0; x < (unsigned long) aSize.Width(); x++ )
{
+#if defined OSL_BIGENDIAN
+ sal_uInt8 nB = (*pPix >> 24);
+ sal_uInt8 nG = (*pPix >> 16) & 0xff;
+ sal_uInt8 nR = (*pPix >> 8) & 0xff;
+ sal_uInt8 nAlpha = *pPix & 0xff;
+#else
sal_uInt8 nAlpha = (*pPix >> 24);
sal_uInt8 nR = (*pPix >> 16) & 0xff;
sal_uInt8 nG = (*pPix >> 8) & 0xff;
sal_uInt8 nB = *pPix & 0xff;
+#endif
if( nAlpha != 0 && nAlpha != 255 )
{
// Cairo uses pre-multiplied alpha - we do not => re-multiply
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index 511a427..e9f761f 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -1059,9 +1059,9 @@ void SvpSalGraphics::drawMask( const SalTwoRect& rTR,
unsigned char *data = row + (rTR.mnSrcX * 4);
for (sal_Int32 x = rTR.mnSrcX; x < rTR.mnSrcX + rTR.mnSrcWidth; ++x)
{
- sal_uInt8 b = unpremultiply(data[0], data[3]);
- sal_uInt8 g = unpremultiply(data[1], data[3]);
- sal_uInt8 r = unpremultiply(data[2], data[3]);
+ sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], data[SVP_CAIRO_ALPHA]);
+ sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], data[SVP_CAIRO_ALPHA]);
+ sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], data[SVP_CAIRO_ALPHA]);
if (r == 0 && g == 0 && b == 0)
{
data[0] = SALCOLOR_BLUE(nMaskColor);
@@ -1125,15 +1125,9 @@ 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
+ sal_uInt8 b = unpremultiply(data[SVP_CAIRO_BLUE], data[SVP_CAIRO_ALPHA]);
+ sal_uInt8 g = unpremultiply(data[SVP_CAIRO_GREEN], data[SVP_CAIRO_ALPHA]);
+ sal_uInt8 r = unpremultiply(data[SVP_CAIRO_RED], data[SVP_CAIRO_ALPHA]);
return MAKE_SALCOLOR(r, g, b);
}
@@ -1342,15 +1336,15 @@ void SvpSalGraphics::releaseCairoContext(cairo_t* cr, bool bXorModeAllowed, cons
unsigned char *xor_data = xor_row + (nExtentsLeft * 4);
for (sal_Int32 x = nExtentsLeft; x < nExtentsRight; ++x)
{
- sal_uInt8 b = unpremultiply(true_data[0], true_data[3]) ^
- unpremultiply(xor_data[0], xor_data[3]);
- sal_uInt8 g = unpremultiply(true_data[1], true_data[3]) ^
- unpremultiply(xor_data[1], xor_data[3]);
- sal_uInt8 r = unpremultiply(true_data[2], true_data[3]) ^
- unpremultiply(xor_data[2], xor_data[3]);
- true_data[0] = premultiply(b, true_data[3]);
- true_data[1] = premultiply(g, true_data[3]);
- true_data[2] = premultiply(r, true_data[3]);
+ sal_uInt8 b = unpremultiply(true_data[SVP_CAIRO_BLUE], true_data[SVP_CAIRO_ALPHA]) ^
+ unpremultiply(xor_data[SVP_CAIRO_BLUE], xor_data[SVP_CAIRO_ALPHA]);
+ sal_uInt8 g = unpremultiply(true_data[SVP_CAIRO_GREEN], true_data[SVP_CAIRO_ALPHA]) ^
+ unpremultiply(xor_data[SVP_CAIRO_GREEN], xor_data[SVP_CAIRO_ALPHA]);
+ sal_uInt8 r = unpremultiply(true_data[SVP_CAIRO_RED], true_data[SVP_CAIRO_ALPHA]) ^
+ unpremultiply(xor_data[SVP_CAIRO_RED], xor_data[SVP_CAIRO_ALPHA]);
+ true_data[0] = premultiply(b, true_data[SVP_CAIRO_ALPHA]);
+ true_data[1] = premultiply(g, true_data[SVP_CAIRO_ALPHA]);
+ true_data[2] = premultiply(r, true_data[SVP_CAIRO_ALPHA]);
true_data+=4;
xor_data+=4;
}
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 1bd4b65..76e4460 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -39,10 +39,22 @@
//where we don't have GL_BGRA support.
#if defined ANDROID
# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown)
+# define SVP_CAIRO_BLUE 1
+# define SVP_CAIRO_GREEN 2
+# define SVP_CAIRO_RED 0
+# define SVP_CAIRO_ALPHA 3
#elif defined OSL_BIGENDIAN
# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcArgb | ScanlineFormat::TopDown)
+# define SVP_CAIRO_BLUE 3
+# define SVP_CAIRO_GREEN 2
+# define SVP_CAIRO_RED 1
+# define SVP_CAIRO_ALPHA 0
#else
# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcBgra | ScanlineFormat::TopDown)
+# define SVP_CAIRO_BLUE 0
+# define SVP_CAIRO_GREEN 1
+# define SVP_CAIRO_RED 2
+# define SVP_CAIRO_ALPHA 3
#endif
struct BitmapBuffer;
--
2.7.4

@ -55,7 +55,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.1
Release: 1%{?libo_prerelease}%{?dist}
Release: 2%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0
URL: http://www.libreoffice.org/
@ -234,6 +234,8 @@ Patch5: 0001-never-run-autogen.sh.patch
# not upstreamed
Patch6: 0001-add-X-TryExec-entries-to-desktop-files.patch
Patch7: 0001-Resolves-rhbz-1326304-cannot-detect-loss-of-wayland-.patch
Patch8: 0001-rhbz-1341064-fix-OutputDevice-test-on-big-endian-sys.patch
Patch9: 0002-update-other-places-that-read-data-from-cairo-image-.patch
%if 0%{?rhel}
# not upstreamed
@ -2236,6 +2238,9 @@ done
%endif
%changelog
* Tue Jun 28 2016 David Tardon <dtardon@redhat.com> - 1:5.2.0.1-2
- Resolves: rhbz#1341064 fix test on big endian systems
* Wed Jun 22 2016 David Tardon <dtardon@redhat.com> - 1:5.2.0.1-1
- update to 5.1.0 rc1
- Resolves: rhbz#1343752 wrong radiobutton and checkbutton behavior in

Loading…
Cancel
Save