Kaydet (Commit) 356dd543 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl Kaydeden (comit) Tomaž Vajngerl

Move CGCotextHolder to separate file - CGHelpers.hxx

Change-Id: Id511af2ee22e421aa7088a72f43a74d45dfe6ec1
Reviewed-on: https://gerrit.libreoffice.org/72437
Tested-by: Jenkins
Reviewed-by: 's avatarTomaž Vajngerl <quikee@gmail.com>
üst ad3c5210
/* -*- 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: */
......@@ -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
......
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