include/vcl/outdev.hxx | 2 ++ include/vcl/print.hxx | 2 ++ include/vcl/virdev.hxx | 2 ++ vcl/inc/windowdev.hxx | 2 ++ vcl/qa/cppunit/animationrenderer.cxx | 1 + vcl/qa/cppunit/outdev.cxx | 7 ++++--- vcl/source/animate/Animation.cxx | 2 +- 7 files changed, 14 insertions(+), 4 deletions(-)
New commits: commit 08d940d3b7b194808385bd25bac6aa3160013e17 Author: Christopher Sherlock <chris.sherloc...@gmail.com> AuthorDate: Sun Feb 23 14:37:45 2025 +1100 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Thu Feb 27 02:39:24 2025 +0100 tdf#74702 vcl: make OutputDevice classes aware of animation capability Not all OutputDevice classes can animate. In fact, the only class that can do this currently is WindowOutputDevice, everything else is a static image. Rather than check what type of class is being used, I'm introducing CanAnimate(). Change-Id: I56339214e388aee2e7a564cf10a3f92629f0a6ae Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182049 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 4f7bcd250afb..67208d9ad55e 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -337,6 +337,8 @@ public: /// request XSpriteCanvas render interface css::uno::Reference< css::rendering::XSpriteCanvas > GetSpriteCanvas() const; + virtual bool CanAnimate() const = 0; + protected: /** Acquire a graphics device that the output device uses to draw on. diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 962308e327dc..75792a8557cf 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -147,6 +147,8 @@ public: bool IsScreenComp() const override { return false; } + bool CanAnimate() const override { return false; } + void DrawBorder(tools::Rectangle aBorderRect) override { SetLineColor(COL_BLACK); diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx index 51a6194d6509..0ab91eae8973 100644 --- a/include/vcl/virdev.hxx +++ b/include/vcl/virdev.hxx @@ -119,6 +119,8 @@ public: bool CanEnableNativeWidget() const override; + bool CanAnimate() const override { return false; } + virtual void EnableRTL( bool bEnable = true ) override; bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true, bool bAlphaMaskTransparent = false ); diff --git a/vcl/inc/windowdev.hxx b/vcl/inc/windowdev.hxx index a3d535646ccf..013cfbc69cd0 100644 --- a/vcl/inc/windowdev.hxx +++ b/vcl/inc/windowdev.hxx @@ -48,6 +48,8 @@ public: Color GetBackgroundColor() const override; + bool CanAnimate() const override { return true; } + using ::OutputDevice::SetSettings; virtual void SetSettings(const AllSettings& rSettings) override; void SetSettings(const AllSettings& rSettings, bool bChild); diff --git a/vcl/qa/cppunit/animationrenderer.cxx b/vcl/qa/cppunit/animationrenderer.cxx index 93f80970f2ea..aa5edcc5dff2 100644 --- a/vcl/qa/cppunit/animationrenderer.cxx +++ b/vcl/qa/cppunit/animationrenderer.cxx @@ -30,6 +30,7 @@ public: bool AcquireGraphics() const override { return true; } void ReleaseGraphics(bool) override {} bool UsePolyPolygonForComplexGradient() override { return false; } + bool CanAnimate() const override { return false; } }; Animation createAnimation() diff --git a/vcl/qa/cppunit/outdev.cxx b/vcl/qa/cppunit/outdev.cxx index a6dfd4f901d6..678189f1912e 100644 --- a/vcl/qa/cppunit/outdev.cxx +++ b/vcl/qa/cppunit/outdev.cxx @@ -887,9 +887,10 @@ public: { } - bool AcquireGraphics() const { return true; } - void ReleaseGraphics(bool) {} - bool UsePolyPolygonForComplexGradient() { return false; } + bool AcquireGraphics() const override { return true; } + void ReleaseGraphics(bool) override {} + bool UsePolyPolygonForComplexGradient() override { return false; } + bool CanAnimate() const override { return false; } bool testShouldDrawWavePixelAsRect(tools::Long nLineWidth) { diff --git a/vcl/source/animate/Animation.cxx b/vcl/source/animate/Animation.cxx index f0256f345021..f9738f10ff08 100644 --- a/vcl/source/animate/Animation.cxx +++ b/vcl/source/animate/Animation.cxx @@ -168,7 +168,7 @@ bool Animation::Start(OutputDevice& rOut, const Point& rDestPt, const Size& rDes if (maFrames.empty()) return false; - if ((rOut.GetOutDevType() == OUTDEV_WINDOW) && !mbLoopTerminated + if (rOut.CanAnimate() && !mbLoopTerminated && (ANIMATION_TIMEOUT_ON_CLICK != maFrames[mnFrameIndex]->mnWait)) { bool differs = true;