Debian Codegraph @

svx/inc/sdr/overlay/overlaymanagerbuffered.hxx

raw
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 #ifndef INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
21 #define INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
22
23 #include <svx/sdr/overlay/overlaymanager.hxx>
24 #include <basegfx/range/b2irange.hxx>
25 #include <vcl/virdev.hxx>
26 #include <vcl/idle.hxx>
27
28
29 namespace sdr::overlay
30 {
31 class OverlayManagerBuffered final : public OverlayManager
32 {
33 // The VirtualDevice for draw window content buffering, this
34 // is the view content without overlay
35 ScopedVclPtr<VirtualDevice> mpBufferDevice;
36
37 // #i73602# The VirtualDevice for OverlayPaint buffering. This
38 // is an extra device to avoid flickering of overlay paints
39 ScopedVclPtr<VirtualDevice> mpOutputBufferDevice;
40
41 // Idle for buffering
42 Idle maBufferIdle;
43
44 // Range for buffering (in pixel to be independent from mapMode)
45 basegfx::B2IRange maBufferRememberedRangePixel;
46
47 // remember MapMode from last completeRedraw, that is what
48 // a timer-based refresh will be based on
49 mutable MapMode maMapModeLastCompleteRedraw;
50
51 // link for timer
52 DECL_LINK(ImpBufferTimerHandler, Timer*, void);
53
54 // Internal methods for buffering
55 void ImpPrepareBufferDevice();
56 void ImpRestoreBackground() const ;
57 void ImpRestoreBackground(const vcl::Region& rRegionPixel) const;
58 void ImpSaveBackground(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice);
59
60 OverlayManagerBuffered(OutputDevice& rOutputDevice);
61 virtual ~OverlayManagerBuffered() override;
62
63 public:
64 static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice);
65
66 // complete redraw
67 virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = nullptr) const override;
68
69 // invalidate the given range at local OutputDevice
70 virtual void invalidateRange(const basegfx::B2DRange& rRange) override;
71 };
72 } // end of namespace sdr::overlay
73
74
75 #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
76
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */