android: Introduce --enable-android-lok configure switch to fix RGB vs. BGR.

This indicates that the build targets the Online-based Android app, for
which we need to avoid various tweaks that are needed for the 'old'
Android app present in the android/ subdir of core.git.

In particular, the switch used in this patch fixes a RGBA vs. BGRA
confusion that caused yellow <-> cyan switch in the Online-based Android
app.

Change-Id: I5f394868f51ce87013677834cfafb967b9bb333e
Reviewed-on: https://gerrit.libreoffice.org/83342
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
(cherry picked from commit 49002a143a4534df5f6139e07fefd06174621c59)
Reviewed-on: https://gerrit.libreoffice.org/83718
Tested-by: Jenkins
This commit is contained in:
Jan Holesovsky
2019-11-20 16:06:13 +01:00
parent 3208e9153c
commit bd8fcf5b47
6 changed files with 34 additions and 3 deletions

View File

@@ -118,6 +118,7 @@ export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
export DPKG=@DPKG@
export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@
export ENABLE_ANDROID_LOK=@ENABLE_ANDROID_LOK@
export ENABLE_ANDROID_EDITING=@ENABLE_ANDROID_EDITING@
export ENABLE_AVAHI=@ENABLE_AVAHI@
export ENABLE_BREAKPAD=@ENABLE_BREAKPAD@

View File

@@ -151,4 +151,10 @@
*/
#define HAVE_FEATURE_UPDATE_MAR 0
/*
* Whether we are avoiding the tweaks needed for the Android app from the
* android/ subdir.
*/
#define HAVE_FEATURE_ANDROID_LOK 0
#endif

View File

@@ -544,6 +544,25 @@ if test -n "$with_android_sdk"; then
fi
AC_SUBST(ANDROID_SDK_HOME)
AC_ARG_ENABLE([android-lok],
AS_HELP_STRING([--enable-android-lok],
[The Android app from the android/ subdir needs several tweaks all
over the place that break the LOK when used in the Online-based
Android app. This switch indicates that the intent of this build is
actually the Online-based, non-modified LOK.])
)
ENABLE_ANDROID_LOK=
if test -n "$ANDROID_NDK_HOME" ; then
if test "$enable_android_lok" = yes; then
ENABLE_ANDROID_LOK=TRUE
AC_DEFINE(HAVE_FEATURE_ANDROID_LOK)
AC_MSG_NOTICE([building the Android version... for the Online-based Android app])
else
AC_MSG_NOTICE([building the Android version... for the app from the android/ subdir])
fi
fi
AC_SUBST([ENABLE_ANDROID_LOK])
libo_FUZZ_ARG_ENABLE([android-editing],
AS_HELP_STRING([--enable-android-editing],
[Enable the experimental editing feature on Android.])

View File

@@ -23,7 +23,8 @@ $(eval $(call gb_UnpackedTarball_add_patches,cairo,\
))
endif
ifeq ($(OS),ANDROID)
# To be applied only when ENABLE_ANDROID_LOK is not defined
ifeq ($(OS)$(ENABLE_ANDROID_LOK),ANDROID)
$(eval $(call gb_UnpackedTarball_add_patches,cairo,\
external/cairo/cairo/cairo.GL_RGBA.patch \
))

View File

@@ -17,6 +17,8 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <config_features.h>
#include <memory>
#ifndef IOS
#include <headless/svpgdi.hxx>
@@ -216,7 +218,7 @@ namespace
sal_uInt8* pD = pDst->mpBits + y * pDst->mnScanlineSize;
for (long x = 0; x < nWidth; ++x)
{
#if defined ANDROID
#if defined(ANDROID) && !HAVE_FEATURE_ANDROID_LOK
static_assert((SVP_CAIRO_FORMAT & ~ScanlineFormat::TopDown) == ScanlineFormat::N32BitTcRgba, "Expected SVP_CAIRO_FORMAT set to N32BitTcBgra");
static_assert((SVP_24BIT_FORMAT & ~ScanlineFormat::TopDown) == ScanlineFormat::N24BitTcRgb, "Expected SVP_24BIT_FORMAT set to N24BitTcRgb");
pD[0] = pS[0];

View File

@@ -24,6 +24,8 @@
#error This file is not for iOS
#endif
#include <config_features.h>
#include <osl/endian.h>
#include <vcl/sysdata.hxx>
#include <config_cairo_canvas.h>
@@ -40,7 +42,7 @@
//cairo then matches the OpenGL GL_RGBA format so we can use it there
//where we don't have GL_BGRA support.
// SVP_24BIT_FORMAT is used to store 24-bit images in 3-byte pixels to conserve memory.
#if defined ANDROID
#if defined(ANDROID) && !HAVE_FEATURE_ANDROID_LOK
# define SVP_24BIT_FORMAT (ScanlineFormat::N24BitTcRgb | ScanlineFormat::TopDown)
# define SVP_CAIRO_FORMAT (ScanlineFormat::N32BitTcRgba | ScanlineFormat::TopDown)
# define SVP_CAIRO_BLUE 1