Kaydet (Commit) fb7d4ba1 authored tarafından Caolán McNamara's avatar Caolán McNamara

build cairo on android

Change-Id: Ie2f7662a4cc3955963517f265894b8f6a495ece8
Reviewed-on: https://gerrit.libreoffice.org/19991Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst dc65f048
...@@ -1272,6 +1272,24 @@ endef ...@@ -1272,6 +1272,24 @@ endef
endif # SYSTEM_CAIRO endif # SYSTEM_CAIRO
else ifeq ($(OS),ANDROID)
define gb_LinkTarget__use_cairo
$(call gb_LinkTarget_use_package,$(1),cairo)
$(call gb_LinkTarget_use_package,$(1),pixman)
$(call gb_LinkTarget_use_external,$(1),freetype_headers)
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,cairo) \
-I$(call gb_UnpackedTarball_get_dir,cairo)/src \
$$(INCLUDE) \
)
$(call gb_LinkTarget_add_libs,$(1),\
-L$(call gb_UnpackedTarball_get_dir,cairo)/src/.libs -lcairo \
-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1 \
)
endef
endif # CAIRO endif # CAIRO
ifneq ($(SYSTEM_FREETYPE),) ifneq ($(SYSTEM_FREETYPE),)
......
...@@ -39,6 +39,8 @@ ANDROID) ...@@ -39,6 +39,8 @@ ANDROID)
oslibs="$WORKDIR/UnpackedTarball/curl/lib/.libs/*.a" oslibs="$WORKDIR/UnpackedTarball/curl/lib/.libs/*.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/fontconfig/src/.libs/libfontconfig.a" oslibs="$oslibs $WORKDIR/UnpackedTarball/fontconfig/src/.libs/libfontconfig.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/freetype/objs/.libs/libfreetype.a" oslibs="$oslibs $WORKDIR/UnpackedTarball/freetype/objs/.libs/libfreetype.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/pixman/pixman/.libs/libpixman-1.a"
oslibs="$oslibs $WORKDIR/UnpackedTarball/cairo/src/.libs/libcairo.a"
# Only liblo-bootstrap.a ends up here: # Only liblo-bootstrap.a ends up here:
oslibs="$oslibs $WORKDIR/LinkTarget/Library/lib*.a" oslibs="$oslibs $WORKDIR/LinkTarget/Library/lib*.a"
;; ;;
......
...@@ -828,7 +828,7 @@ linux-android*) ...@@ -828,7 +828,7 @@ linux-android*)
fi fi
AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX) AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE" BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
;; ;;
emscripten*) emscripten*)
......
...@@ -11,6 +11,10 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,cairo,cairo)) ...@@ -11,6 +11,10 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,cairo,cairo))
$(eval $(call gb_ExternalPackage_use_external_project,cairo,cairo)) $(eval $(call gb_ExternalPackage_use_external_project,cairo,cairo))
ifneq ($(OS),ANDROID)
$(eval $(call gb_ExternalPackage_add_file,cairo,$(LIBO_LIB_FOLDER)/libcairo.so.2,src/.libs/libcairo.so.2.11000.2)) $(eval $(call gb_ExternalPackage_add_file,cairo,$(LIBO_LIB_FOLDER)/libcairo.so.2,src/.libs/libcairo.so.2.11000.2))
endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -11,6 +11,11 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,pixman,pixman)) ...@@ -11,6 +11,11 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,pixman,pixman))
$(eval $(call gb_ExternalPackage_use_external_project,pixman,pixman)) $(eval $(call gb_ExternalPackage_use_external_project,pixman,pixman))
ifneq ($(OS),ANDROID)
$(eval $(call gb_ExternalPackage_add_file,pixman,$(LIBO_LIB_FOLDER)/libpixman-1.so.0,pixman/.libs/libpixman-1.so.0.24.4)) $(eval $(call gb_ExternalPackage_add_file,pixman,$(LIBO_LIB_FOLDER)/libpixman-1.so.0,pixman/.libs/libpixman-1.so.0.24.4))
endif
# vim: set noet sw=4 ts=4: # vim: set noet sw=4 ts=4:
...@@ -32,7 +32,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) : ...@@ -32,7 +32,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
$(call gb_ExternalProject_run,build,\ $(call gb_ExternalProject_run,build,\
./configure \ ./configure \
$(if $(debug),STRIP=" ") \ $(if $(debug),STRIP=" ") \
CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS)" \ CFLAGS="$(if $(debug),-g) $(ZLIB_CFLAGS) $(gb_VISIBILITY_FLAGS)" \
$(if $(filter ANDROID IOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \ $(if $(filter ANDROID IOS,$(OS)),PKG_CONFIG=./dummy_pkg_config) \
pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \ pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \
pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1" \ pixman_LIBS="-L$(call gb_UnpackedTarball_get_dir,pixman)/pixman/.libs -lpixman-1" \
...@@ -40,7 +40,10 @@ $(call gb_ExternalProject_get_state_target,cairo,build) : ...@@ -40,7 +40,10 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
ZLIB3RDLIB="$(if $(SYSTEM_ZLIB),,-L$(WORKDIR)/LinkTarget/StaticLibrary) -lz" \ ZLIB3RDLIB="$(if $(SYSTEM_ZLIB),,-L$(WORKDIR)/LinkTarget/StaticLibrary) -lz" \
png_REQUIRES="trick_configure_into_using_png_CFLAGS_and_LIBS" \ png_REQUIRES="trick_configure_into_using_png_CFLAGS_and_LIBS" \
png_CFLAGS="$(LIBPNG_CFLAGS)" png_LIBS="$(LIBPNG_LIBS)" \ png_CFLAGS="$(LIBPNG_CFLAGS)" png_LIBS="$(LIBPNG_LIBS)" \
FREETYPE_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,freetype)/include" \
FONTCONFIG_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,fontconfig)" \
$(if $(filter IOS,$(OS)),--disable-shared,--disable-static) \ $(if $(filter IOS,$(OS)),--disable-shared,--disable-static) \
$(if $(filter ANDROID,$(OS)),--disable-shared,--disable-static) \
$(if $(filter ANDROID IOS,$(OS)),--disable-xlib,--enable-xlib) \ $(if $(filter ANDROID IOS,$(OS)),--disable-xlib,--enable-xlib) \
$(if $(filter IOS,$(OS)),--enable-quartz --enable-quartz-font) \ $(if $(filter IOS,$(OS)),--enable-quartz --enable-quartz-font) \
--disable-valgrind \ --disable-valgrind \
......
...@@ -32,7 +32,7 @@ else ...@@ -32,7 +32,7 @@ else
$(call gb_ExternalProject_get_state_target,pixman,build) : $(call gb_ExternalProject_get_state_target,pixman,build) :
$(call gb_ExternalProject_run,build,\ $(call gb_ExternalProject_run,build,\
./configure \ ./configure \
$(if $(filter MACOSX IOS,$(OS)),--disable-shared,--disable-static) \ $(if $(filter MACOSX IOS ANDROID,$(OS)),--disable-shared,--disable-static) \
$(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \ $(if $(filter ANDROID,$(OS)),--disable-arm-simd --disable-arm-neon --disable-arm-iwmmxt) \
$(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
&& $(MAKE) \ && $(MAKE) \
......
...@@ -624,6 +624,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\ ...@@ -624,6 +624,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
)) ))
$(eval $(call gb_Library_use_externals,vcl,\ $(eval $(call gb_Library_use_externals,vcl,\
cairo \
freetype \ freetype \
)) ))
ifneq ($(OS),EMSCRIPTEN) ifneq ($(OS),EMSCRIPTEN)
...@@ -654,6 +655,7 @@ $(eval $(call gb_Library_use_static_libraries,vcl,\ ...@@ -654,6 +655,7 @@ $(eval $(call gb_Library_use_static_libraries,vcl,\
)) ))
$(eval $(call gb_Library_use_externals,vcl,\ $(eval $(call gb_Library_use_externals,vcl,\
cairo \
fontconfig \ fontconfig \
freetype \ freetype \
expat \ expat \
......
...@@ -33,9 +33,7 @@ ...@@ -33,9 +33,7 @@
#include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx>
#include <basebmp/scanlineformats.hxx> #include <basebmp/scanlineformats.hxx>
#if ENABLE_CAIRO_CANVAS
#include <cairo.h> #include <cairo.h>
#endif
#if OSL_DEBUG_LEVEL > 2 #if OSL_DEBUG_LEVEL > 2
#include <basebmp/debug.hxx> #include <basebmp/debug.hxx>
...@@ -95,8 +93,6 @@ bool SvpSalGraphics::drawTransformedBitmap( ...@@ -95,8 +93,6 @@ bool SvpSalGraphics::drawTransformedBitmap(
return false; return false;
} }
#if ENABLE_CAIRO_CANVAS
namespace namespace
{ {
bool isCairoCompatible(const basebmp::BitmapDeviceSharedPtr &rBuffer) bool isCairoCompatible(const basebmp::BitmapDeviceSharedPtr &rBuffer)
...@@ -134,18 +130,15 @@ void SvpSalGraphics::clipRegion(cairo_t* cr) ...@@ -134,18 +130,15 @@ void SvpSalGraphics::clipRegion(cairo_t* cr)
} }
} }
#endif
bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency) bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency)
{ {
bool bRet = false; bool bRet = false;
(void)nX; (void)nY; (void)nWidth; (void)nHeight; (void)nTransparency; (void)nX; (void)nY; (void)nWidth; (void)nHeight; (void)nTransparency;
#if ENABLE_CAIRO_CANVAS
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0) #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
if (m_bUseLineColor || !m_bUseFillColor) if (m_bUseLineColor || !m_bUseFillColor)
return bRet; return bRet;
cairo_t* cr = createCairoContext(m_aDevice); cairo_t* cr = getCairoContext();
if (!cr) if (!cr)
return bRet; return bRet;
...@@ -194,7 +187,6 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight, ...@@ -194,7 +187,6 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
extents.y + extents.height)); extents.y + extents.height));
} }
bRet = true; bRet = true;
#endif
#endif #endif
return bRet; return bRet;
} }
...@@ -817,8 +809,6 @@ bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong ) ...@@ -817,8 +809,6 @@ bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong )
return false; return false;
} }
#if ENABLE_CAIRO_CANVAS
cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr &rBuffer) cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr &rBuffer)
{ {
if (!isCairoCompatible(rBuffer)) if (!isCairoCompatible(rBuffer))
...@@ -838,6 +828,12 @@ cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr ...@@ -838,6 +828,12 @@ cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr
return cr; return cr;
} }
cairo_t* SvpSalGraphics::getCairoContext() const
{
return SvpSalGraphics::createCairoContext(m_aOrigDevice);
}
#if ENABLE_CAIRO_CANVAS
bool SvpSalGraphics::SupportsCairo() const bool SvpSalGraphics::SupportsCairo() const
{ {
return false; return false;
...@@ -874,14 +870,9 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const ...@@ -874,14 +870,9 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const
bool SvpSalGraphics::supportsOperation(OutDevSupportType eType) const bool SvpSalGraphics::supportsOperation(OutDevSupportType eType) const
{ {
#if ENABLE_CAIRO_CANVAS
return m_aDrawMode != basebmp::DrawMode::XOR && return m_aDrawMode != basebmp::DrawMode::XOR &&
OutDevSupport_TransparentRect == eType && OutDevSupport_TransparentRect == eType &&
isCairoCompatible(m_aDevice); isCairoCompatible(m_aDevice);
#else
(void)eType;
return false;
#endif
} }
#endif #endif
......
...@@ -202,13 +202,12 @@ public: ...@@ -202,13 +202,12 @@ public:
virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override; virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const override;
virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override; virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const override;
virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override; virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const override;
virtual SystemFontData GetSysFontData( int nFallbacklevel ) const override; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const override;
#endif // ENABLE_CAIRO_CANVAS
cairo_t* getCairoContext() const;
static cairo_t* createCairoContext(const basebmp::BitmapDeviceSharedPtr& rBuffer); static cairo_t* createCairoContext(const basebmp::BitmapDeviceSharedPtr& rBuffer);
void clipRegion(cairo_t* cr); void clipRegion(cairo_t* cr);
#endif // ENABLE_CAIRO_CANVAS
}; };
#endif #endif
......
...@@ -59,8 +59,6 @@ public: ...@@ -59,8 +59,6 @@ public:
static void refreshFontconfig( GtkSettings *pSettings ); static void refreshFontconfig( GtkSettings *pSettings );
static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer ); static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
cairo_t* getCairoContext() const;
virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override; virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
private: private:
GtkWidget *mpWindow; GtkWidget *mpWindow;
......
...@@ -8,34 +8,35 @@ ...@@ -8,34 +8,35 @@
*/ */
#include "gtk3cairotextrender.hxx" #include "gtk3cairotextrender.hxx"
#include "headless/svpgdi.hxx"
GtkCairoTextRender::GtkCairoTextRender(GtkSalGraphics& rParent) SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent)
: mrParent(rParent) : mrParent(rParent)
{ {
} }
GlyphCache& GtkCairoTextRender::getPlatformGlyphCache() GlyphCache& SvpCairoTextRender::getPlatformGlyphCache()
{ {
return SvpSalGraphics::getPlatformGlyphCache(); return SvpSalGraphics::getPlatformGlyphCache();
} }
cairo_t* GtkCairoTextRender::getCairoContext() cairo_t* SvpCairoTextRender::getCairoContext()
{ {
return mrParent.getCairoContext(); return mrParent.getCairoContext();
} }
void GtkCairoTextRender::getSurfaceOffset(double& nDX, double& nDY) void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
{ {
nDX = 0; nDX = 0;
nDY = 0; nDY = 0;
} }
void GtkCairoTextRender::clipRegion(cairo_t* cr) void SvpCairoTextRender::clipRegion(cairo_t* cr)
{ {
mrParent.clipRegion(cr); mrParent.clipRegion(cr);
} }
void GtkCairoTextRender::drawSurface(cairo_t* /*cr*/) void SvpCairoTextRender::drawSurface(cairo_t* /*cr*/)
{ {
} }
......
...@@ -11,15 +11,16 @@ ...@@ -11,15 +11,16 @@
#define INCLUDED_VCL_UNX_GTK3_GDI_GTK3CAIROTEXTRENDER_HXX #define INCLUDED_VCL_UNX_GTK3_GDI_GTK3CAIROTEXTRENDER_HXX
#include "cairotextrender.hxx" #include "cairotextrender.hxx"
#include <unx/gtk/gtkgdi.hxx>
class GtkCairoTextRender : public CairoTextRender class SvpSalGraphics;
class SvpCairoTextRender : public CairoTextRender
{ {
protected: protected:
GtkSalGraphics& mrParent; SvpSalGraphics& mrParent;
public: public:
explicit GtkCairoTextRender(GtkSalGraphics& rParent); explicit SvpCairoTextRender(SvpSalGraphics& rParent);
virtual GlyphCache& getPlatformGlyphCache() override; virtual GlyphCache& getPlatformGlyphCache() override;
virtual cairo_t* getCairoContext() override; virtual cairo_t* getCairoContext() override;
......
...@@ -1999,7 +1999,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) ...@@ -1999,7 +1999,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
mpFrame( pFrame ), mpFrame( pFrame ),
mpWindow( pWindow ) mpWindow( pWindow )
{ {
m_xTextRenderImpl.reset(new GtkCairoTextRender(*this)); m_xTextRenderImpl.reset(new SvpCairoTextRender(*this));
if(style_loaded) if(style_loaded)
return; return;
...@@ -2124,11 +2124,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow ) ...@@ -2124,11 +2124,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
gtk_widget_show_all(gDumbContainer); gtk_widget_show_all(gDumbContainer);
} }
cairo_t* GtkSalGraphics::getCairoContext() const
{
return mpFrame->getCairoContext();
}
void GtkSalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) void GtkSalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
{ {
char* pForceDpi; char* pForceDpi;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment