drawinglayer/source/primitive2d/Tools.cxx | 2 + drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx | 19 ++++++++++ drawinglayer/source/processor2d/hittestprocessor2d.cxx | 1 include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 1 svx/source/sdr/contact/viewobjectcontact.cxx | 1 5 files changed, 24 insertions(+)
New commits: commit 7df76cda53dfdb60dab1e2189cafc86d9a30461a Author: Noel Grandin <[email protected]> AuthorDate: Tue Jul 16 15:59:23 2024 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Jul 17 15:33:54 2024 +0200 tdf#158397 freeze hovering mouse above animating gif Improve the hit-test machinery so we don't need to rerender the graphic when moving the mouse over it Change-Id: Ide088296aa9c2be1348b8908194f47378454ae40 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170587 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins Signed-off-by: Xisco Fauli <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170593 diff --git a/drawinglayer/source/primitive2d/Tools.cxx b/drawinglayer/source/primitive2d/Tools.cxx index bd74a4b5cd00..cef1829e1567 100644 --- a/drawinglayer/source/primitive2d/Tools.cxx +++ b/drawinglayer/source/primitive2d/Tools.cxx @@ -233,6 +233,8 @@ OUString idToString(sal_uInt32 nId) return u"SINGLELINEPRIMITIVE"_ustr; case PRIMITIVE2D_ID_EXCLUSIVEEDITVIEWPRIMITIVE2D: return u"EXCLUSIVEEDITVIEWPRIMITIVE2D"_ustr; + case PRIMITIVE2D_ID_ANIMATEDGRAPHICPRIMITIVE2D: + return u"ANIMATEDGRAPHICPRIMITIVE2D"_ustr; default: return OUString::number((nId >> 16) & 0xFF) + "|" + OUString::number(nId & 0xFF); } diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index d756e6e3b74f..e0c68c0c1f34 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -29,6 +29,7 @@ #include <drawinglayer/primitive2d/transformprimitive2d.hxx> #include <drawinglayer/primitive2d/maskprimitive2d.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> +#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> @@ -360,11 +361,17 @@ namespace drawinglayer::primitive2d /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } + /// provide unique ID + virtual sal_uInt32 getPrimitive2DID() const override { return PRIMITIVE2D_ID_ANIMATEDGRAPHICPRIMITIVE2D; } + /// compare operator virtual bool operator==(const BasePrimitive2D& rPrimitive) const override; /// override to deliver the correct expected frame dependent of timing virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; + + /// get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override; }; } @@ -501,6 +508,18 @@ namespace drawinglayer::primitive2d rVisitor.visit(aRetval); } + basegfx::B2DRange AnimatedGraphicPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + // get object's range + basegfx::B2DRange aUnitRange(0.0, 0.0, 1.0, 1.0); + aUnitRange.transform(getTransform()); + + // intersect with visible part + aUnitRange.intersect(rViewInformation.getViewport()); + + return aUnitRange; + } + } // end of namespace namespace drawinglayer::primitive2d diff --git a/drawinglayer/source/processor2d/hittestprocessor2d.cxx b/drawinglayer/source/processor2d/hittestprocessor2d.cxx index cf6d3eec9447..a6fc3978b733 100644 --- a/drawinglayer/source/processor2d/hittestprocessor2d.cxx +++ b/drawinglayer/source/processor2d/hittestprocessor2d.cxx @@ -468,6 +468,7 @@ namespace drawinglayer::processor2d case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D : case PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D : case PRIMITIVE2D_ID_MEDIAPRIMITIVE2D: + case PRIMITIVE2D_ID_ANIMATEDGRAPHICPRIMITIVE2D: { if(!getHitTextOnly()) { diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index f276caa8ec04..987d10e6297b 100644 --- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -108,6 +108,7 @@ #define PRIMITIVE2D_ID_FILLEDRECTANGLEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 74) #define PRIMITIVE2D_ID_SINGLELINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 75) #define PRIMITIVE2D_ID_EXCLUSIVEEDITVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 76) +#define PRIMITIVE2D_ID_ANIMATEDGRAPHICPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 78) // When you add a new primitive, please update the drawinglayer::primitive2d::idToString() function // in drawinglayer/source/primitive2d/Tools.cxx. diff --git a/svx/source/sdr/contact/viewobjectcontact.cxx b/svx/source/sdr/contact/viewobjectcontact.cxx index 03d6eb4bd10c..cb9630125cce 100644 --- a/svx/source/sdr/contact/viewobjectcontact.cxx +++ b/svx/source/sdr/contact/viewobjectcontact.cxx @@ -97,6 +97,7 @@ void AnimatedExtractingProcessor2D::processBasePrimitive2D(const drawinglayer::p case PRIMITIVE2D_ID_ANIMATEDSWITCHPRIMITIVE2D : case PRIMITIVE2D_ID_ANIMATEDBLINKPRIMITIVE2D : case PRIMITIVE2D_ID_ANIMATEDINTERPOLATEPRIMITIVE2D : + case PRIMITIVE2D_ID_ANIMATEDGRAPHICPRIMITIVE2D : { const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& rSwitchPrimitive = static_cast< const drawinglayer::primitive2d::AnimatedSwitchPrimitive2D& >(rCandidate);
