[Libreoffice-commits] core.git: bin/lo-all-static-libs configure.ac external/cairo RepositoryExternal.mk vcl/headless vcl/inc vcl/Library_vcl.mk vcl/unx

Caolán McNamara caolanm at redhat.com
Mon Nov 16 08:07:28 PST 2015


 RepositoryExternal.mk                         |   18 ++++++++++++++++++
 bin/lo-all-static-libs                        |    2 ++
 configure.ac                                  |    2 +-
 external/cairo/ExternalPackage_cairo.mk       |    4 ++++
 external/cairo/ExternalPackage_pixman.mk      |    5 +++++
 external/cairo/ExternalProject_cairo.mk       |    5 ++++-
 external/cairo/ExternalProject_pixman.mk      |    2 +-
 vcl/Library_vcl.mk                            |    2 ++
 vcl/headless/svpgdi.cxx                       |   23 +++++++----------------
 vcl/inc/headless/svpgdi.hxx                   |    5 ++---
 vcl/inc/unx/gtk/gtkgdi.hxx                    |    2 --
 vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx      |   13 +++++++------
 vcl/unx/gtk3/gdi/gtk3cairotextrender.hxx      |    9 +++++----
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |    7 +------
 14 files changed, 59 insertions(+), 40 deletions(-)

New commits:
commit fb7d4ba1cbe24b74dfab0f54eeffe898a0291ce3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Nov 16 13:40:22 2015 +0000

    build cairo on android
    
    Change-Id: Ie2f7662a4cc3955963517f265894b8f6a495ece8
    Reviewed-on: https://gerrit.libreoffice.org/19991
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 31beeb9..42f53db 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -1272,6 +1272,24 @@ endef
 
 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
 
 ifneq ($(SYSTEM_FREETYPE),)
diff --git a/bin/lo-all-static-libs b/bin/lo-all-static-libs
index e6052c3..a5d26c5 100755
--- a/bin/lo-all-static-libs
+++ b/bin/lo-all-static-libs
@@ -39,6 +39,8 @@ ANDROID)
     oslibs="$WORKDIR/UnpackedTarball/curl/lib/.libs/*.a"
     oslibs="$oslibs $WORKDIR/UnpackedTarball/fontconfig/src/.libs/libfontconfig.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:
     oslibs="$oslibs $WORKDIR/LinkTarget/Library/lib*.a"
     ;;
diff --git a/configure.ac b/configure.ac
index 58a6ad7..b87fe11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -828,7 +828,7 @@ linux-android*)
     fi
 
     AC_DEFINE(HAVE_FT_FACE_GETCHARVARIANTINDEX)
-    BUILD_TYPE="$BUILD_TYPE FONTCONFIG FREETYPE"
+    BUILD_TYPE="$BUILD_TYPE CAIRO FONTCONFIG FREETYPE"
     ;;
 
 emscripten*)
diff --git a/external/cairo/ExternalPackage_cairo.mk b/external/cairo/ExternalPackage_cairo.mk
index e40fc54..7209276 100644
--- a/external/cairo/ExternalPackage_cairo.mk
+++ b/external/cairo/ExternalPackage_cairo.mk
@@ -11,6 +11,10 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,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))
 
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/cairo/ExternalPackage_pixman.mk b/external/cairo/ExternalPackage_pixman.mk
index ead0289..c08a775 100644
--- a/external/cairo/ExternalPackage_pixman.mk
+++ b/external/cairo/ExternalPackage_pixman.mk
@@ -11,6 +11,11 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,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))
 
+endif
+
+
 # vim: set noet sw=4 ts=4:
diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk
index cc26096..d204514 100644
--- a/external/cairo/ExternalProject_cairo.mk
+++ b/external/cairo/ExternalProject_cairo.mk
@@ -32,7 +32,7 @@ $(call gb_ExternalProject_get_state_target,cairo,build) :
 	$(call gb_ExternalProject_run,build,\
 	./configure \
 		$(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) \
 		pixman_CFLAGS="-I$(call gb_UnpackedTarball_get_dir,pixman)/pixman" \
 		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) :
 		ZLIB3RDLIB="$(if $(SYSTEM_ZLIB),,-L$(WORKDIR)/LinkTarget/StaticLibrary) -lz" \
 		png_REQUIRES="trick_configure_into_using_png_CFLAGS_and_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 ANDROID,$(OS)),--disable-shared,--disable-static) \
 		$(if $(filter ANDROID IOS,$(OS)),--disable-xlib,--enable-xlib) \
 		$(if $(filter IOS,$(OS)),--enable-quartz --enable-quartz-font) \
 		--disable-valgrind \
diff --git a/external/cairo/ExternalProject_pixman.mk b/external/cairo/ExternalProject_pixman.mk
index 8eb7d8c..bbb4081 100644
--- a/external/cairo/ExternalProject_pixman.mk
+++ b/external/cairo/ExternalProject_pixman.mk
@@ -32,7 +32,7 @@ else
 $(call gb_ExternalProject_get_state_target,pixman,build) :
 	$(call gb_ExternalProject_run,build,\
 		./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 $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
 		&& $(MAKE) \
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index e9933d1..0da204a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -624,6 +624,7 @@ $(eval $(call gb_Library_use_libraries,vcl,\
 ))
 
 $(eval $(call gb_Library_use_externals,vcl,\
+	cairo \
 	freetype \
 ))
 ifneq ($(OS),EMSCRIPTEN)
@@ -654,6 +655,7 @@ $(eval $(call gb_Library_use_static_libraries,vcl,\
 ))
 
 $(eval $(call gb_Library_use_externals,vcl,\
+	cairo \
 	fontconfig \
 	freetype \
 	expat \
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index fc7d5fa..8edc059 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -33,9 +33,7 @@
 #include <basegfx/polygon/b2dpolygontools.hxx>
 #include <basebmp/scanlineformats.hxx>
 
-#if ENABLE_CAIRO_CANVAS
 #include <cairo.h>
-#endif
 
 #if OSL_DEBUG_LEVEL > 2
 #include <basebmp/debug.hxx>
@@ -95,8 +93,6 @@ bool SvpSalGraphics::drawTransformedBitmap(
     return false;
 }
 
-#if ENABLE_CAIRO_CANVAS
-
 namespace
 {
     bool isCairoCompatible(const basebmp::BitmapDeviceSharedPtr &rBuffer)
@@ -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 bRet = false;
     (void)nX; (void)nY; (void)nWidth; (void)nHeight; (void)nTransparency;
-#if ENABLE_CAIRO_CANVAS
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 10, 0)
     if (m_bUseLineColor || !m_bUseFillColor)
         return bRet;
 
-    cairo_t* cr = createCairoContext(m_aDevice);
+    cairo_t* cr = getCairoContext();
     if (!cr)
         return bRet;
 
@@ -195,7 +188,6 @@ bool SvpSalGraphics::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
     }
     bRet = true;
 #endif
-#endif
     return bRet;
 }
 
@@ -817,8 +809,6 @@ bool SvpSalGraphics::drawEPS( long, long, long, long, void*, sal_uLong )
     return false;
 }
 
-#if ENABLE_CAIRO_CANVAS
-
 cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr &rBuffer)
 {
     if (!isCairoCompatible(rBuffer))
@@ -838,6 +828,12 @@ cairo_t* SvpSalGraphics::createCairoContext(const basebmp::BitmapDeviceSharedPtr
     return cr;
 }
 
+cairo_t* SvpSalGraphics::getCairoContext() const
+{
+    return SvpSalGraphics::createCairoContext(m_aOrigDevice);
+}
+
+#if ENABLE_CAIRO_CANVAS
 bool SvpSalGraphics::SupportsCairo() const
 {
     return false;
@@ -874,14 +870,9 @@ SystemGraphicsData SvpSalGraphics::GetGraphicsData() const
 
 bool SvpSalGraphics::supportsOperation(OutDevSupportType eType) const
 {
-#if ENABLE_CAIRO_CANVAS
     return m_aDrawMode != basebmp::DrawMode::XOR &&
            OutDevSupport_TransparentRect == eType &&
            isCairoCompatible(m_aDevice);
-#else
-    (void)eType;
-    return false;
-#endif
 }
 
 #endif
diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx
index 8449ce1..b4bcd1e 100644
--- a/vcl/inc/headless/svpgdi.hxx
+++ b/vcl/inc/headless/svpgdi.hxx
@@ -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 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 SystemFontData  GetSysFontData( int nFallbacklevel ) const override;
+#endif // ENABLE_CAIRO_CANVAS
 
+    cairo_t*                getCairoContext() const;
     static cairo_t*         createCairoContext(const basebmp::BitmapDeviceSharedPtr& rBuffer);
     void                    clipRegion(cairo_t* cr);
-
-#endif // ENABLE_CAIRO_CANVAS
 };
 
 #endif
diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index ee101af..e559385 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -59,8 +59,6 @@ public:
     static void refreshFontconfig( GtkSettings *pSettings );
     static void signalSettingsNotify( GObject*, GParamSpec *pSpec, gpointer );
 
-    cairo_t* getCairoContext() const;
-
     virtual void GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) override;
 private:
     GtkWidget       *mpWindow;
diff --git a/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx b/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
index 2262012..0171ef1 100644
--- a/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3cairotextrender.cxx
@@ -8,34 +8,35 @@
  */
 
 #include "gtk3cairotextrender.hxx"
+#include "headless/svpgdi.hxx"
 
-GtkCairoTextRender::GtkCairoTextRender(GtkSalGraphics& rParent)
+SvpCairoTextRender::SvpCairoTextRender(SvpSalGraphics& rParent)
     : mrParent(rParent)
 {
 }
 
-GlyphCache& GtkCairoTextRender::getPlatformGlyphCache()
+GlyphCache& SvpCairoTextRender::getPlatformGlyphCache()
 {
     return SvpSalGraphics::getPlatformGlyphCache();
 }
 
-cairo_t* GtkCairoTextRender::getCairoContext()
+cairo_t* SvpCairoTextRender::getCairoContext()
 {
     return mrParent.getCairoContext();
 }
 
-void GtkCairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
+void SvpCairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
 {
     nDX = 0;
     nDY = 0;
 }
 
-void GtkCairoTextRender::clipRegion(cairo_t* cr)
+void SvpCairoTextRender::clipRegion(cairo_t* cr)
 {
     mrParent.clipRegion(cr);
 }
 
-void GtkCairoTextRender::drawSurface(cairo_t* /*cr*/)
+void SvpCairoTextRender::drawSurface(cairo_t* /*cr*/)
 {
 }
 
diff --git a/vcl/unx/gtk3/gdi/gtk3cairotextrender.hxx b/vcl/unx/gtk3/gdi/gtk3cairotextrender.hxx
index fcba273..1a0a1ec 100644
--- a/vcl/unx/gtk3/gdi/gtk3cairotextrender.hxx
+++ b/vcl/unx/gtk3/gdi/gtk3cairotextrender.hxx
@@ -11,15 +11,16 @@
 #define INCLUDED_VCL_UNX_GTK3_GDI_GTK3CAIROTEXTRENDER_HXX
 
 #include "cairotextrender.hxx"
-#include <unx/gtk/gtkgdi.hxx>
 
-class GtkCairoTextRender : public CairoTextRender
+class SvpSalGraphics;
+
+class SvpCairoTextRender : public CairoTextRender
 {
 protected:
-    GtkSalGraphics& mrParent;
+    SvpSalGraphics& mrParent;
 
 public:
-    explicit GtkCairoTextRender(GtkSalGraphics& rParent);
+    explicit SvpCairoTextRender(SvpSalGraphics& rParent);
 
     virtual GlyphCache& getPlatformGlyphCache() override;
     virtual cairo_t* getCairoContext() override;
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index a1927e4..7c25774 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -1999,7 +1999,7 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
       mpFrame( pFrame ),
       mpWindow( pWindow )
 {
-    m_xTextRenderImpl.reset(new GtkCairoTextRender(*this));
+    m_xTextRenderImpl.reset(new SvpCairoTextRender(*this));
 
     if(style_loaded)
         return;
@@ -2124,11 +2124,6 @@ GtkSalGraphics::GtkSalGraphics( GtkSalFrame *pFrame, GtkWidget *pWindow )
     gtk_widget_show_all(gDumbContainer);
 }
 
-cairo_t* GtkSalGraphics::getCairoContext() const
-{
-    return mpFrame->getCairoContext();
-}
-
 void GtkSalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY)
 {
     char* pForceDpi;


More information about the Libreoffice-commits mailing list