summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshit Kushwaha <akshitsan13@gmail.com>2022-02-18 13:14:09 +0530
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-12-12 17:13:55 +0900
commitb167059facb2b01de1d0a46777ef3ff01fa61a83 (patch)
tree96c08d70b75f6d1c64dbd3bca67f7889d87b582e
parent998c7c9d4d65d2262003e4a4d49b1ded46ccb463 (diff)
Introduced the Flush() method for aiding the benchmarksfeature/benchmarks
This Flush() method would help in clearing any and all queued drawing calls in order to prevent unnecessary time addition to the benchmarks. Change-Id: Ie4170bc5ebbf5011b6be315daa6a0035ffb3aa24
-rw-r--r--include/vcl/outdev.hxx2
-rw-r--r--vcl/backendtest/benchmark/outputdevice/Benchmarks.cxx12
-rw-r--r--vcl/inc/headless/SvpGraphicsBackend.hxx2
-rw-r--r--vcl/inc/qt5/QtGraphics.hxx2
-rw-r--r--vcl/inc/quartz/salgdi.h2
-rw-r--r--vcl/inc/salgdi.hxx7
-rw-r--r--vcl/inc/salgdiimpl.hxx2
-rw-r--r--vcl/inc/unx/GenPspGfxBackend.hxx2
-rw-r--r--vcl/source/outdev/outdev.cxx5
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx5
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.hxx2
-rw-r--r--vcl/win/gdi/gdiimpl.cxx5
-rw-r--r--vcl/win/gdi/gdiimpl.hxx2
13 files changed, 49 insertions, 1 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index b2053f412b49..5ad5d5eb7de7 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -426,7 +426,7 @@ public:
///@{
public:
- virtual void Flush() {}
+ virtual void Flush();
virtual void DrawOutDev(
const Point& rDestPt, const Size& rDestSize,
diff --git a/vcl/backendtest/benchmark/outputdevice/Benchmarks.cxx b/vcl/backendtest/benchmark/outputdevice/Benchmarks.cxx
index d7cf1cdeb345..94e50a8865a3 100644
--- a/vcl/backendtest/benchmark/outputdevice/Benchmarks.cxx
+++ b/vcl/backendtest/benchmark/outputdevice/Benchmarks.cxx
@@ -57,6 +57,7 @@ Bitmap Benchmark::setupMultiplePolygonsWithPolyPolygon()
aPolyPolygon.Insert(aPolygon1);
}
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
mpVirtualDevice->DrawPolyPolygon(aPolyPolygon);
Bitmap aBitmap = mpVirtualDevice->GetBitmap(maVDRectangle.TopLeft(), maVDRectangle.GetSize());
@@ -71,6 +72,7 @@ Bitmap Benchmark::setupWavelines()
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
for (int i = 1; i <= 4094; i += 2)
{
@@ -91,6 +93,7 @@ Bitmap Benchmark::setupGrid()
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
for (int i = 1; i <= 4096; i += 2)
{
@@ -109,6 +112,7 @@ Bitmap Benchmark::setupGridWithDottedLine()
mpVirtualDevice->SetLineColor(constLineColor);
mpVirtualDevice->SetFillColor();
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
for (int i = 1; i <= 4096; i += 2)
{
@@ -148,6 +152,7 @@ Bitmap Benchmark::setupBitmap()
Point aPoint((maVDRectangle.GetWidth() / 2.0) - (aBitmapSize.Width() / 2.0),
(maVDRectangle.GetHeight() / 2.0) - (aBitmapSize.Height() / 2.0));
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
mpVirtualDevice->DrawBitmapEx(aPoint, BitmapEx(aBitmap));
@@ -185,6 +190,7 @@ Bitmap Benchmark::setupBitmapWithAlpha()
Point aPoint((maVDRectangle.GetWidth() / 2.0) - (aRect.GetWidth() / 2.0),
(maVDRectangle.GetHeight() / 2.0) - (aRect.GetHeight() / 2.0));
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
mpVirtualDevice->DrawBitmapEx(tools::Rectangle(aPoint, aRect.GetSize()).TopLeft(),
@@ -212,6 +218,7 @@ Bitmap Benchmark::setupScaledBitmap()
aWriteAccess->DrawRect(tools::Rectangle(i + 1, i + 1, 100 - i - 1, 100 - i - 1));
}
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
BitmapEx aBitmapEx(aBitmap);
@@ -241,6 +248,7 @@ Bitmap Benchmark::setupReducedBitmap()
aWriteAccess->DrawRect(tools::Rectangle(i + 1, i + 1, 8096 - i - 1, 8096 - i - 1));
}
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
BitmapEx aBitmapEx(aBitmap);
@@ -273,6 +281,7 @@ Bitmap Benchmark::setupRotatedBitmap()
Point aPoint((maVDRectangle.GetWidth() / 2.0) - (aBitmapSize.Width() / 2.0),
(maVDRectangle.GetHeight() / 2.0) - (aBitmapSize.Height() / 2.0));
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
BitmapEx aBitmapEx(aBitmap);
@@ -298,6 +307,7 @@ Bitmap Benchmark::setupLinearGradient()
{ Color(0x65, 0x4E, 0xA3), Color(0xEA, 0xAF, 0xC8) },
{ Color(0xFF, 0x41, 0x6C), Color(0xFF, 0x4B, 0x2B) } };
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
for (int i = 0, nLeftOffset = 0, nRightOffset = 3840; i < 16;
i++, nLeftOffset += 256, nRightOffset -= 256)
@@ -330,6 +340,7 @@ Bitmap Benchmark::setupAxialGradient()
{ Color(0x65, 0x4E, 0xA3), Color(0xEA, 0xAF, 0xC8) },
{ Color(0xFF, 0x41, 0x6C), Color(0xFF, 0x4B, 0x2B) } };
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
for (int i = 0, nLeftOffset = 0, nRightOffset = 3840; i < 16;
i++, nLeftOffset += 256, nRightOffset -= 256)
@@ -361,6 +372,7 @@ Bitmap Benchmark::setupRadialGradient()
{ Color(0x65, 0x4E, 0xA3), Color(0xEA, 0xAF, 0xC8) },
{ Color(0xFF, 0x41, 0x6C), Color(0xFF, 0x4B, 0x2B) } };
+ mpVirtualDevice->Flush();
m_xStart = std::chrono::steady_clock::now();
for (int i = 0, nLeftOffset = 0, nRightOffset = 3840; i < 16;
i++, nLeftOffset += 256, nRightOffset -= 256)
diff --git a/vcl/inc/headless/SvpGraphicsBackend.hxx b/vcl/inc/headless/SvpGraphicsBackend.hxx
index 997f1bc84e9d..246bd766493e 100644
--- a/vcl/inc/headless/SvpGraphicsBackend.hxx
+++ b/vcl/inc/headless/SvpGraphicsBackend.hxx
@@ -47,6 +47,8 @@ public:
tools::Long GetGraphicsWidth() const override;
+ void Flush() override {}
+
void SetLineColor() override;
void SetLineColor(Color nColor) override;
void SetFillColor() override;
diff --git a/vcl/inc/qt5/QtGraphics.hxx b/vcl/inc/qt5/QtGraphics.hxx
index b8a168d1a3cf..ea88b8b60db8 100644
--- a/vcl/inc/qt5/QtGraphics.hxx
+++ b/vcl/inc/qt5/QtGraphics.hxx
@@ -58,6 +58,8 @@ public:
QtGraphicsBackend(QtFrame* pFrame, QImage* pQImage);
~QtGraphicsBackend() override;
+ void Flush() override {};
+
void Init() override {}
QImage* getQImage() { return m_pQImage; }
diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h
index 9e070c4215ce..4d4ffb25725a 100644
--- a/vcl/inc/quartz/salgdi.h
+++ b/vcl/inc/quartz/salgdi.h
@@ -331,6 +331,8 @@ public:
AquaGraphicsBackend(AquaSharedAttributes & rShared);
~AquaGraphicsBackend() override;
+ void Flush() override {};
+
void Init() override;
void freeResources() override;
diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx
index 0b8952b74123..a7f5dc6080b9 100644
--- a/vcl/inc/salgdi.hxx
+++ b/vcl/inc/salgdi.hxx
@@ -96,6 +96,8 @@ public:
// public SalGraphics methods, the interface to the independent vcl part
+ virtual void Flush() = 0;
+
// get device resolution
virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) = 0;
@@ -656,6 +658,11 @@ public:
return GetImpl()->GetGraphicsWidth();
}
+ void Flush() override
+ {
+ GetImpl()->Flush();
+ }
+
void ResetClipRegion() override
{
GetImpl()->ResetClipRegion();
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index 55f7544587ed..dc5cb315a554 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -88,6 +88,8 @@ public:
virtual void ResetClipRegion() = 0;
+ virtual void Flush() = 0;
+
virtual void SetLineColor() = 0;
virtual void SetLineColor( Color nColor ) = 0;
diff --git a/vcl/inc/unx/GenPspGfxBackend.hxx b/vcl/inc/unx/GenPspGfxBackend.hxx
index a37ee433e6eb..600606845007 100644
--- a/vcl/inc/unx/GenPspGfxBackend.hxx
+++ b/vcl/inc/unx/GenPspGfxBackend.hxx
@@ -26,6 +26,8 @@ public:
GenPspGfxBackend(psp::PrinterGfx* pPrinterGfx);
~GenPspGfxBackend() override;
+ void Flush() override {}
+
void Init() override;
void freeResources() override;
OUString getRenderBackendName() const override { return "genpsp"; }
diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx
index b4c1eac4499e..3c8cea776722 100644
--- a/vcl/source/outdev/outdev.cxx
+++ b/vcl/source/outdev/outdev.cxx
@@ -141,6 +141,11 @@ OutputDevice::~OutputDevice()
disposeOnce();
}
+void OutputDevice::Flush()
+{
+ mpGraphics->Flush();
+}
+
void OutputDevice::dispose()
{
if ( GetUnoGraphicsList() )
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index ad28e0fb39a9..19b545795c95 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -946,6 +946,11 @@ void X11SalGraphicsImpl::ResetClipRegion()
mrParent.mpClipRegion = nullptr;
}
+void X11SalGraphicsImpl::Flush()
+{
+ mrParent.Flush();
+}
+
bool X11SalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
{
if( mrParent.mpClipRegion )
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index 48211b13d472..ac59a4cf5983 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -111,6 +111,8 @@ public:
virtual ~X11SalGraphicsImpl() override;
+ void Flush() override;
+
virtual OUString getRenderBackendName() const override { return "gen"; }
virtual bool setClipRegion( const vcl::Region& ) override;
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 81d41cf41d33..4ae3383fb95f 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -1032,6 +1032,11 @@ static bool containsOnlyHorizontalAndVerticalEdges(const basegfx::B2DPolyPolygon
return true;
}
+void WinSalGraphicsImpl::Flush()
+{
+ mrParent.Flush();
+}
+
bool WinSalGraphicsImpl::setClipRegion( const vcl::Region& i_rClip )
{
if ( mrParent.mhRegion )
diff --git a/vcl/win/gdi/gdiimpl.hxx b/vcl/win/gdi/gdiimpl.hxx
index 86342533fc6c..3728244deb0e 100644
--- a/vcl/win/gdi/gdiimpl.hxx
+++ b/vcl/win/gdi/gdiimpl.hxx
@@ -66,6 +66,8 @@ public:
virtual ~WinSalGraphicsImpl() override;
+ void Flush() override;
+
virtual void Init() override;
virtual void freeResources() override;