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

Chris Sherlock (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 10 07:52:57 UTC 2021


 include/vcl/outdev.hxx            |    2 +-
 vcl/qa/cppunit/outdev.cxx         |   13 +++++++++++++
 vcl/source/outdev/outdev.cxx      |    8 ++++++++
 vcl/source/outdev/outdevstate.cxx |   10 ----------
 4 files changed, 22 insertions(+), 11 deletions(-)

New commits:
commit 9db1e85a8da3952cefef552853753342d7147b98
Author:     Chris Sherlock <chris.sherlock79 at gmail.com>
AuthorDate: Wed Aug 25 18:16:38 2021 +1000
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Fri Sep 10 09:52:21 2021 +0200

    vcl: move OutputDevice drawmode functions to outdev.cxx
    
    Ultimately I hope to reduce outdevstate.cxx to only have push(), pop()
    and clearstack(), then rename outdevstate.cxx to stack.cxx. Eventually,
    the plan is to separate metafile processing from rendering.
    
    Add unit test for GetDrawMode() and SetDrawMode().
    
    Change-Id: I63948e7e4c332c786487c18c52faa60893f672a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121021
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index a80b49c2239b..8fa546b20b60 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -480,7 +480,7 @@ public:
     AntialiasingFlags           GetAntialiasing() const { return mnAntialiasing; }
 
     void                        SetDrawMode( DrawModeFlags nDrawMode );
-    DrawModeFlags               GetDrawMode() const;
+    DrawModeFlags               GetDrawMode() const { return mnDrawMode; }
 
     void                        SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode );
     ComplexTextLayoutFlags       GetLayoutMode() const { return mnTextLayoutMode; }
diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx
index ee1dc6a37b8d..f7a50b3bb5d2 100644
--- a/vcl/qa/cppunit/outdev.cxx
+++ b/vcl/qa/cppunit/outdev.cxx
@@ -58,6 +58,7 @@ public:
     void testRefPoint();
     void testRasterOp();
     void testOutputFlag();
+    void testDrawMode();
     void testAntialias();
     void testSystemTextColor();
     void testShouldDrawWavePixelAsRect();
@@ -93,6 +94,7 @@ public:
     CPPUNIT_TEST(testRefPoint);
     CPPUNIT_TEST(testRasterOp);
     CPPUNIT_TEST(testAntialias);
+    CPPUNIT_TEST(testDrawMode);
     CPPUNIT_TEST(testOutputFlag);
     CPPUNIT_TEST(testSystemTextColor);
     CPPUNIT_TEST(testShouldDrawWavePixelAsRect);
@@ -814,6 +816,17 @@ void VclOutdevTest::testAntialias()
     CPPUNIT_ASSERT_EQUAL(AntialiasingFlags::Enable, pVDev->GetAntialiasing());
 }
 
+void VclOutdevTest::testDrawMode()
+{
+    ScopedVclPtrInstance<VirtualDevice> pVDev;
+
+    CPPUNIT_ASSERT_EQUAL(DrawModeFlags::Default, pVDev->GetDrawMode());
+
+    pVDev->SetDrawMode(DrawModeFlags::BlackLine);
+
+    CPPUNIT_ASSERT_EQUAL(DrawModeFlags::BlackLine, pVDev->GetDrawMode());
+}
+
 void VclOutdevTest::testSystemTextColor()
 {
     {
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index 8d1f9504609f..f3d9c48b752d 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -356,6 +356,14 @@ void OutputDevice::SetAntialiasing( AntialiasingFlags nMode )
         mpAlphaVDev->SetAntialiasing( nMode );
 }
 
+void OutputDevice::SetDrawMode(DrawModeFlags nDrawMode)
+{
+    mnDrawMode = nDrawMode;
+
+    if (mpAlphaVDev)
+        mpAlphaVDev->SetDrawMode(nDrawMode);
+}
+
 sal_uInt16 OutputDevice::GetBitCount() const
 {
     // we need a graphics instance
diff --git a/vcl/source/outdev/outdevstate.cxx b/vcl/source/outdev/outdevstate.cxx
index 8832c09e0f9a..3d788019854c 100644
--- a/vcl/source/outdev/outdevstate.cxx
+++ b/vcl/source/outdev/outdevstate.cxx
@@ -198,16 +198,6 @@ void OutputDevice::ClearStack()
         Pop();
 }
 
-DrawModeFlags OutputDevice::GetDrawMode() const { return mnDrawMode; }
-
-void OutputDevice::SetDrawMode(DrawModeFlags nDrawMode)
-{
-    mnDrawMode = nDrawMode;
-
-    if (mpAlphaVDev)
-        mpAlphaVDev->SetDrawMode(nDrawMode);
-}
-
 void OutputDevice::SetLayoutMode( ComplexTextLayoutFlags nTextLayoutMode )
 {
     if( mpMetaFile )


More information about the Libreoffice-commits mailing list