[Libreoffice-commits] core.git: 2 commits - vcl/inc vcl/quartz

Tomaž Vajngerl (via logerrit) logerrit at kemper.freedesktop.org
Sat May 18 06:39:12 UTC 2019


 vcl/inc/quartz/CGHelpers.hxx |   55 +++++++++++++++++++++++++++++++++++++++++++
 vcl/inc/quartz/salgdi.h      |   46 ++---------------------------------
 vcl/inc/quartz/salvd.h       |   14 +++++++++-
 vcl/quartz/salvd.cxx         |   17 +++----------
 4 files changed, 75 insertions(+), 57 deletions(-)

New commits:
commit 1b1c750146b07bb760603a8d1d2ef0a3ae5d98c2
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 15 16:35:40 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat May 18 08:38:23 2019 +0200

    macOS: store VirtualDevice size in an instance variable
    
    Change-Id: Id0a7317e9aed4b0222affb7292f6a3a44af74040
    Reviewed-on: https://gerrit.libreoffice.org/72438
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/vcl/inc/quartz/salvd.h b/vcl/inc/quartz/salvd.h
index 17d539182d7f..f5fc6e38b7bb 100644
--- a/vcl/inc/quartz/salvd.h
+++ b/vcl/inc/quartz/salvd.h
@@ -44,6 +44,9 @@ private:
     CGLayerRef mxLayer;              // Quartz layer
     AquaSalGraphics* mpGraphics;     // current VirDev graphics
 
+    long mnWidth;
+    long mnHeight;
+
     void Destroy();
 
 public:
@@ -54,8 +57,15 @@ public:
     virtual void                    ReleaseGraphics( SalGraphics* pGraphics ) override;
     virtual bool                    SetSize( long nNewDX, long nNewDY ) override;
 
-    virtual long GetWidth() const override;
-    virtual long GetHeight() const override;
+    long GetWidth() const override
+    {
+        return mnWidth;
+    }
+
+    long GetHeight() const override
+    {
+        return mnHeight;
+    }
 };
 
 #endif // INCLUDED_VCL_INC_QUARTZ_SALVD_H
diff --git a/vcl/quartz/salvd.cxx b/vcl/quartz/salvd.cxx
index 0fe4e7f923d3..a08345dfd1c1 100644
--- a/vcl/quartz/salvd.cxx
+++ b/vcl/quartz/salvd.cxx
@@ -68,6 +68,8 @@ AquaSalVirtualDevice::AquaSalVirtualDevice( AquaSalGraphics* pGraphic, long &nDX
   , mxBitmapContext( nullptr )
   , mnBitmapDepth( 0 )
   , mxLayer( nullptr )
+  , mnWidth(0)
+  , mnHeight(0)
 {
     SAL_INFO( "vcl.virdev", "AquaSalVirtualDevice::AquaSalVirtualDevice() this=" << this
               << " size=(" << nDX << "x" << nDY << ") bitcount=" << static_cast<int>(eFormat) <<
@@ -228,6 +230,9 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
 
     Destroy();
 
+    mnWidth = nDX;
+    mnHeight = nDY;
+
     // create a Quartz layer matching to the intended virdev usage
     CGContextRef xCGContext = nullptr;
     if( mnBitmapDepth && (mnBitmapDepth < 16) )
@@ -305,16 +310,4 @@ bool AquaSalVirtualDevice::SetSize( long nDX, long nDY )
     return (mxLayer != nullptr);
 }
 
-long AquaSalVirtualDevice::GetWidth() const
-{
-    const CGSize aSize = CGLayerGetSize( mxLayer );
-    return aSize.width;
-}
-
-long AquaSalVirtualDevice::GetHeight() const
-{
-    const CGSize aSize = CGLayerGetSize( mxLayer );
-    return aSize.height;
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 356dd5430ac928b87aed714d7c8ef92a9b4a6b19
Author:     Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Wed May 8 15:31:49 2019 +0900
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat May 18 08:38:11 2019 +0200

    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 at gmail.com>

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


More information about the Libreoffice-commits mailing list