[Libreoffice-commits] core.git: include/vcl vcl/source

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Thu Aug 26 02:28:13 UTC 2021


 include/vcl/outdevstate.hxx       |   56 +++++++++++++++++---------------------
 vcl/source/outdev/outdevstate.cxx |   26 -----------------
 2 files changed, 26 insertions(+), 56 deletions(-)

New commits:
commit 0484630164275e2828f1420b055f05e94b8c73ee
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Tue Aug 24 21:29:16 2021 +1000
Commit:     Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Thu Aug 26 04:27:39 2021 +0200

    vcl: make OutDevState constructor default, no need for destructor
    
    There is no value of having the OutDevState constructor and destructor
    being in its own file, so move to header. Also, resetting the variables
    in the destructor is rather pointless as they are destroyed in the next
    step anyhow. This removes the need to define an empty destructor.
    
    Use C++11 magic to make a default constructor - many thanks to Mike
    Kaganski for the tip on this one.
    
    Change-Id: I9561b311d8752fa12802b5ae8e11123aedabe8be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115460
    Tested-by: Jenkins
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

diff --git a/include/vcl/outdevstate.hxx b/include/vcl/outdevstate.hxx
index 36f02e2f2e42..b1104a28f34f 100644
--- a/include/vcl/outdevstate.hxx
+++ b/include/vcl/outdevstate.hxx
@@ -17,22 +17,21 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#ifndef INCLUDED_VCL_OUTDEVSTATE_HXX
-#define INCLUDED_VCL_OUTDEVSTATE_HXX
-
-#include <vcl/mapmod.hxx>
-#include <vcl/vclenum.hxx>
-#include <vcl/font.hxx>
+#pragma once
 
 #include <tools/color.hxx>
 #include <tools/gen.hxx>
 #include <tools/fontenum.hxx>
+#include <i18nlangtag/lang.h>
 #include <o3tl/typed_flags_set.hxx>
+
+#include <vcl/font.hxx>
+#include <vcl/mapmod.hxx>
+#include <vcl/region.hxx>
+#include <vcl/vclenum.hxx>
+
 #include <memory>
 #include <optional>
-#include <i18nlangtag/lang.h>
-
-namespace vcl { class Region; }
 
 // Flags for OutputDevice::Push() and OutDevState
 enum class PushFlags {
@@ -77,28 +76,25 @@ namespace o3tl {
 
 struct OutDevState
 {
-    OutDevState();
-    OutDevState(OutDevState&&);
-    ~OutDevState();
+    OutDevState() = default;
+    OutDevState(OutDevState&&) = default;
 
-    std::optional<MapMode>        mpMapMode;
-    bool            mbMapActive;
-    std::unique_ptr<vcl::Region>    mpClipRegion;
-    std::optional<Color>          mpLineColor;
-    std::optional<Color>          mpFillColor;
-    std::optional<vcl::Font>      mpFont;
-    std::optional<Color>          mpTextColor;
-    std::optional<Color>          mpTextFillColor;
-    std::optional<Color>          mpTextLineColor;
-    std::optional<Color>          mpOverlineColor;
-    std::optional<Point>          mpRefPoint;
-    TextAlign       meTextAlign;
-    RasterOp        meRasterOp;
-    ComplexTextLayoutFlags  mnTextLayoutMode;
-    LanguageType    meTextLanguage;
-    PushFlags       mnFlags;
+    std::optional<MapMode> mpMapMode;
+    bool mbMapActive = false;
+    std::unique_ptr<vcl::Region> mpClipRegion;
+    std::optional<Color> mpLineColor;
+    std::optional<Color> mpFillColor;
+    std::optional<vcl::Font> mpFont;
+    std::optional<Color> mpTextColor;
+    std::optional<Color> mpTextFillColor;
+    std::optional<Color> mpTextLineColor;
+    std::optional<Color> mpOverlineColor;
+    std::optional<Point> mpRefPoint;
+    TextAlign meTextAlign = ALIGN_TOP;
+    RasterOp meRasterOp = RasterOp::OverPaint;
+    ComplexTextLayoutFlags mnTextLayoutMode = ComplexTextLayoutFlags::Default;
+    LanguageType meTextLanguage = LANGUAGE_SYSTEM;
+    PushFlags mnFlags = PushFlags::NONE;
 };
 
-#endif // INCLUDED_VCL_OUTDEVSTATE_HXX
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 0c0d1afbb955..fa1af5ab576d 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -31,32 +31,6 @@
 #include <drawmode.hxx>
 #include <salgdi.hxx>
 
-OutDevState::OutDevState()
-    : mbMapActive(false)
-    , meTextAlign(ALIGN_TOP)
-    , meRasterOp(RasterOp::OverPaint)
-    , mnTextLayoutMode(ComplexTextLayoutFlags::Default)
-    , meTextLanguage(0)
-    , mnFlags(PushFlags::NONE)
-{
-}
-
-OutDevState::OutDevState(OutDevState&&) = default;
-
-OutDevState::~OutDevState()
-{
-    mpLineColor.reset();
-    mpFillColor.reset();
-    mpFont.reset();
-    mpTextColor.reset();
-    mpTextFillColor.reset();
-    mpTextLineColor.reset();
-    mpOverlineColor.reset();
-    mpMapMode.reset();
-    mpClipRegion.reset();
-    mpRefPoint.reset();
-}
-
 void OutputDevice::Push( PushFlags nFlags )
 {
 


More information about the Libreoffice-commits mailing list