Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/vcl/inc/animate/AnimationRenderer.hxx
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#pragma once
21
22
#include <vcl/dllapi.h>
23
#include <vcl/animate/Animation.hxx>
24
#include <vcl/vclptr.hxx>
25
26
class Animation;
27
class OutputDevice;
28
class VirtualDevice;
29
struct AnimationFrame;
30
31
struct AnimationData
32
{
33
    Point maOriginStartPt;
34
    Size maStartSize;
35
    VclPtr<OutputDevice> mpRenderContext;
36
    AnimationRenderer* mpRendererData;
37
    tools::Long mnRendererId;
38
    bool mbIsPaused;
39
40
    AnimationData();
41
};
42
43
44
class VCL_DLLPUBLIC AnimationRenderer
45
{
46
private:
47
    Animation*      mpParent;
48
    VclPtr<OutputDevice>  mpRenderContext;
49
    tools::Long     mnRendererId;
50
    Point           maOriginPt;
51
    Point           maDispPt;
52
    Point           maRestPt;
53
    Size            maLogicalSize;
54
    Size            maSizePx;
55
    Size            maDispSz;
56
    Size            maRestSz;
57
    vcl::Region     maClip;
58
    VclPtr<VirtualDevice>  mpBackground;
59
    VclPtr<VirtualDevice>  mpRestore;
60
    sal_uLong       mnActIndex;
61
    Disposal        meLastDisposal;
62
    bool            mbIsPaused;
63
    bool            mbIsMarked;
64
    bool            mbIsMirroredHorizontally;
65
    bool            mbIsMirroredVertically;
66
67
public:
68
                    AnimationRenderer( Animation* pParent, OutputDevice* pOut,
69
                                  const Point& rPt, const Size& rSz, sal_uLong nRendererId,
70
                                  OutputDevice* pFirstFrameOutDev = nullptr );
71
                    AnimationRenderer(AnimationRenderer&&) = delete;
72
     SAL_DLLPRIVATE ~AnimationRenderer();
73
74
    bool            matches(const OutputDevice* pOut, tools::Long nRendererId) const;
75
    void            drawToIndex( sal_uLong nIndex );
76
    SAL_DLLPRIVATE void draw( sal_uLong nIndex, VirtualDevice* pVDev=nullptr );
77
    SAL_DLLPRIVATE void repaint();
78
    SAL_DLLPRIVATE AnimationData*  createAnimationData() const;
79
80
    void            getPosSize( const AnimationFrame& rAnm, Point& rPosPix, Size& rSizePix );
81
82
0
    const Point&    getOriginPosition() const { return maOriginPt; }
83
84
0
    const Size&     getOutSizePix() const { return maSizePx; }
85
86
0
    void            pause( bool bIsPaused ) { mbIsPaused = bIsPaused; }
87
0
    bool            isPaused() const { return mbIsPaused; }
88
89
0
    void            setMarked( bool bIsMarked ) { mbIsMarked = bIsMarked; }
90
0
    bool            isMarked() const { return mbIsMarked; }
91
};
92
93
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */