blob: 117110ac4f7b68d10563e79dfe341698c8e475b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// SPDX-License-Identifier: GPL-2.0-or-later
/** @file
* The context in which a single CanvasItem tree exists. Holds the root node and common state.
*/
#ifndef SEEN_CANVAS_ITEM_CONTEXT_H
#define SEEN_CANVAS_ITEM_CONTEXT_H
#include <2geom/affine.h>
#include "util/funclog.h"
namespace Inkscape {
namespace UI::Widget { class Canvas; }
class CanvasItemGroup;
class CanvasItemContext
{
public:
CanvasItemContext(UI::Widget::Canvas *canvas);
CanvasItemContext(CanvasItemContext const &) = delete;
CanvasItemContext &operator=(CanvasItemContext const &) = delete;
~CanvasItemContext();
// Structure
UI::Widget::Canvas *canvas() const { return _canvas; }
CanvasItemGroup *root() const { return _root; }
// Geometry
Geom::Affine const &affine() const { return _affine; }
void setAffine(Geom::Affine const &affine) { _affine = affine; }
// Snapshotting
void snapshot();
void unsnapshot();
bool snapshotted() const { return _snapshotted; }
template<typename F>
void defer(F &&f) { _snapshotted ? _funclog.emplace(std::forward<F>(f)) : f(); }
private:
// Structure
UI::Widget::Canvas *_canvas;
CanvasItemGroup *_root;
// Geometry
Geom::Affine _affine;
// Snapshotting
char _cacheline_separator[127];
bool _snapshotted = false;
Util::FuncLog _funclog;
};
} // namespace Inkscape
#endif // SEEN_CANVAS_ITEM_CONTEXT_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|