diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2015-01-16 03:15:38 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2015-01-17 00:27:53 +1100 |
commit | c9b79c754777a3d1817249c6a85c13f54b8e0457 (patch) | |
tree | d3a07e28cf5243290d1b3e4ec076029675f81de9 | |
parent | vcl: make CairoTextRender::DrawServerFontLayout more efficient (diff) | |
download | core-private/tbsdy/drawserverfontlayout.tar.gz core-private/tbsdy/drawserverfontlayout.zip |
vcl: Add basic textdemo
private/tbsdy/drawserverfontlayout
This can be used to isolate font rendering issues in vcl
Change-Id: Ibe61de6099a5b98226a84f4cc9a23a2e2c0b14f8
-rw-r--r-- | Repository.mk | 1 | ||||
-rw-r--r-- | vcl/Executable_textdemo.mk | 60 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 3 | ||||
-rw-r--r-- | vcl/workben/textdemo.cxx | 134 |
4 files changed, 197 insertions, 1 deletions
diff --git a/Repository.mk b/Repository.mk index aa9224fd4c32..86c3cb94defc 100644 --- a/Repository.mk +++ b/Repository.mk @@ -97,6 +97,7 @@ $(eval $(call gb_Helper_register_executables_for_install,OOO,brand, \ unopkg \ unopkg_com \ ) \ + textdemo \ )) $(eval $(call gb_Helper_register_executables_for_install,OOO,base_brand, \ diff --git a/vcl/Executable_textdemo.mk b/vcl/Executable_textdemo.mk new file mode 100644 index 000000000000..dcf1cc274d9c --- /dev/null +++ b/vcl/Executable_textdemo.mk @@ -0,0 +1,60 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Executable_Executable,textdemo)) + +$(eval $(call gb_Executable_use_api,textdemo,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_Executable_use_external,textdemo,boost_headers)) + +$(eval $(call gb_Executable_set_include,textdemo,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ + -I$(SRCDIR)/solenv/inc \ +)) + +$(eval $(call gb_Executable_use_libraries,textdemo,\ + basegfx \ + tl \ + sal \ + vcl \ + cppu \ + cppuhelper \ + comphelper \ + svt \ +)) + +$(eval $(call gb_Executable_add_exception_objects,textdemo,\ + vcl/workben/textdemo \ +)) + +$(eval $(call gb_Executable_use_static_libraries,textdemo,\ + vclmain \ +)) + +ifeq ($(OS),LINUX) +$(eval $(call gb_Executable_add_libs,textdemo,\ + -lm \ + -ldl \ + -lpthread \ + -lGL \ + -lGLU \ + -lX11 \ +)) + +$(eval $(call gb_Executable_use_static_libraries,textdemo,\ + glxtest \ +)) +endif + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index 9cc9ee038d87..e956cd071d1e 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -30,7 +30,8 @@ $(eval $(call gb_Module_add_targets,vcl,\ Executable_icontest \ Executable_outdevgrind \ Executable_vcldemo \ - Executable_mtfdemo )) \ + Executable_mtfdemo \ + Executable_textdemo )) \ $(if $(filter-out ANDROID IOS WNT,$(OS)), \ Executable_svdemo \ Executable_svptest \ diff --git a/vcl/workben/textdemo.cxx b/vcl/workben/textdemo.cxx new file mode 100644 index 000000000000..a74ac6ce22ec --- /dev/null +++ b/vcl/workben/textdemo.cxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <comphelper/processfactory.hxx> +#include <comphelper/random.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/registry/XSimpleRegistry.hpp> +#include <com/sun/star/ucb/UniversalContentBroker.hpp> + +#include <vcl/vclmain.hxx> +#include <vcl/layout.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/wmf.hxx> + +#include <tools/urlobj.hxx> +#include <tools/stream.hxx> +#include <tools/vcompat.hxx> +#include <vcl/svapp.hxx> +#include <vcl/wrkwin.hxx> +#include <vcl/virdev.hxx> + +#include <svtools/ctrlbox.hxx> + +#include <tools/stream.hxx> + +#include <cstdlib> + +using namespace com::sun::star; + +using namespace css; + +class DemoTextWin : public WorkWindow +{ +public: + DemoTextWin() + : WorkWindow(NULL, WB_APP | WB_STDWORK) + { } + + virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE; +}; + +void DemoTextWin::Paint( const Rectangle& rRect ) +{ + OUString aFontFamily("Abyssinica SIL"); + vcl::Font aFont( aFontFamily, Size(20, 20) ); + + OUString aString("Hello world"); + + SetFont( aFont ); + DrawText( Point(50, 10), aString, 0, 12 ); + + WorkWindow::Paint( rRect ); +} + +class DemoTextApp : public Application +{ + DemoTextWin *mpWin; + +public: + DemoTextApp() + : mpWin(NULL) + { + } + + virtual int Main() SAL_OVERRIDE + { + try + { + mpWin = new DemoTextWin(); + mpWin->SetText(OUString("Display text")); + + mpWin->Show(); + + Application::Execute(); + } + catch (const css::uno::Exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.Message); + return 1; + } + catch (const std::exception& e) + { + SAL_WARN("vcl.app", "Fatal exception: " << e.what()); + return 1; + } + return 0; + } + +protected: + uno::Reference<lang::XMultiServiceFactory> xMSF; + void Init() SAL_OVERRIDE + { + try + { + uno::Reference<uno::XComponentContext> xComponentContext + = ::cppu::defaultBootstrap_InitialComponentContext(); + xMSF = uno::Reference<lang::XMultiServiceFactory> + (xComponentContext->getServiceManager(), uno::UNO_QUERY); + if(!xMSF.is()) + Application::Abort("Bootstrap failure - no service manager"); + + ::comphelper::setProcessServiceFactory(xMSF); + } + catch (const uno::Exception &e) + { + Application::Abort("Bootstrap exception " + e.Message); + } + } + + void DeInit() SAL_OVERRIDE + { + uno::Reference< lang::XComponent >( + comphelper::getProcessComponentContext(), + uno::UNO_QUERY_THROW)-> dispose(); + ::comphelper::setProcessServiceFactory(NULL); + } + +}; + + +void vclmain::createApplication() +{ + static DemoTextApp aApp; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |