diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2019-05-08 15:31:49 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2019-05-18 08:38:11 +0200 |
commit | 356dd5430ac928b87aed714d7c8ef92a9b4a6b19 (patch) | |
tree | 7aea7bbdb89db5e8cd92acadb3fb851277939a2f /vcl/inc/quartz | |
parent | ad3c5210fe308e71a8be246c8968a0f3535cb6e4 (diff) |
Move CGCotextHolder to separate file - CGHelpers.hxx
Change-Id: Id511af2ee22e421aa7088a72f43a74d45dfe6ec1
Reviewed-on: https://gerrit.libreoffice.org/72437
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/inc/quartz')
-rw-r--r-- | vcl/inc/quartz/CGHelpers.hxx | 55 | ||||
-rw-r--r-- | vcl/inc/quartz/salgdi.h | 46 |
2 files changed, 58 insertions, 43 deletions
diff --git a/vcl/inc/quartz/CGHelpers.hxx b/vcl/inc/quartz/CGHelpers.hxx new file mode 100644 index 000000000000..cbd13d76fcf4 --- /dev/null +++ b/vcl/inc/quartz/CGHelpers.hxx @@ -0,0 +1,55 @@ +/* -*- 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/. + * + */ + +#ifndef INCLUDED_VCL_INC_QUARTZ_CGHELPER_HXX +#define INCLUDED_VCL_INC_QUARTZ_CGHELPER_HXX + +#include <premac.h> +#include <CoreGraphics/CoreGraphics.h> +#include <postmac.h> + +class CGContextHolder +{ + CGContextRef mpContext; +#if OSL_DEBUG_LEVEL > 0 + int mnContextStackDepth; +#endif + +public: + CGContextHolder() + : mpContext(nullptr) +#if OSL_DEBUG_LEVEL > 0 + , mnContextStackDepth(0) +#endif + { + } + + CGContextRef get() const { return mpContext; } + + bool isSet() const { return mpContext != nullptr; } + + void set(CGContextRef const& pContext) { mpContext = pContext; } + + void saveState() + { + SAL_INFO("vcl.cg", "CGContextSaveGState(" << mpContext << ") " << ++mnContextStackDepth); + CGContextSaveGState(mpContext); + } + + void restoreState() + { + SAL_INFO("vcl.cg", "CGContextRestoreGState(" << mpContext << ") " << mnContextStackDepth--); + CGContextRestoreGState(mpContext); + } +}; + +#endif // INCLUDED_VCL_INC_QUARTZ_CGHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index 7d5df4bcbaf3..bde5167f55f5 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -38,6 +38,7 @@ #include <vcl/fontcapabilities.hxx> #include <vcl/metric.hxx> + #include <fontinstance.hxx> #include <impfontmetricdata.hxx> #include <PhysicalFontFace.hxx> @@ -47,6 +48,8 @@ #include <unordered_map> #include <hb-ot.h> +#include <quartz/CGHelpers.hxx> + class AquaSalFrame; class FontAttributes; class CoreTextStyle; @@ -127,49 +130,6 @@ private: std::unordered_map<sal_IntPtr, rtl::Reference<CoreTextFontFace>> maFontContainer; }; -class CGContextHolder -{ - CGContextRef mpContext; -#if OSL_DEBUG_LEVEL > 0 - int mnContextStackDepth; -#endif -public: - - CGContextHolder() - : mpContext(nullptr) -#if OSL_DEBUG_LEVEL > 0 - , mnContextStackDepth( 0 ) -#endif - {} - - CGContextRef get() const - { - return mpContext; - } - - bool isSet() const - { - return mpContext != nullptr; - } - - void set(CGContextRef const & pContext) - { - mpContext = pContext; - } - - void saveState() - { - SAL_INFO("vcl.cg", "CGContextSaveGState(" << mpContext << ") " << ++mnContextStackDepth ); - CGContextSaveGState(mpContext); - } - - void restoreState() - { - SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mpContext << ") " << mnContextStackDepth-- ); - CGContextRestoreGState(mpContext); - } -}; - class AquaSalGraphics : public SalGraphics { CGLayerRef mxLayer; // Quartz graphics layer |