Line data Source code
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 :
30 : namespace sdr
31 : {
32 : namespace overlay
33 : {
34 : class OverlayManagerBuffered : public OverlayManager
35 : {
36 : protected:
37 : // The VirtualDevice for draw window content buffering, this
38 : // is the view content without overlay
39 : ScopedVclPtr<VirtualDevice> mpBufferDevice;
40 :
41 : // #i73602# The VirtualDevice for OverlayPaint buffering. This
42 : // is an extra device to avoid flickering of overlay paints
43 : ScopedVclPtr<VirtualDevice> mpOutputBufferDevice;
44 :
45 : // Idle for buffering
46 : Idle maBufferIdle;
47 :
48 : // Range for buffering (in pixel to be independent from mapMode)
49 : basegfx::B2IRange maBufferRememberedRangePixel;
50 :
51 : // bitfield
52 : // Flag to decide if PreRendering shall be used for overlay refreshes.
53 : // Default is false.
54 : bool mbRefreshWithPreRendering : 1;
55 :
56 : // link for timer
57 : DECL_LINK_TYPED(ImpBufferTimerHandler, Idle*, void);
58 :
59 : // Internal methods for buffering
60 : void ImpPrepareBufferDevice();
61 : void ImpRestoreBackground() const ;
62 : void ImpRestoreBackground(const vcl::Region& rRegionPixel) const;
63 : void ImpSaveBackground(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = 0L);
64 :
65 : OverlayManagerBuffered(
66 : OutputDevice& rOutputDevice,
67 : const SdrModel* pModel,
68 : bool bRefreshWithPreRendering = false);
69 : virtual ~OverlayManagerBuffered();
70 :
71 : public:
72 : static rtl::Reference<OverlayManager> create(OutputDevice& rOutputDevice,
73 : const SdrModel* pModel,
74 : bool bRefreshWithPreRendering = false);
75 :
76 : // complete redraw
77 : virtual void completeRedraw(const vcl::Region& rRegion, OutputDevice* pPreRenderDevice = 0L) const SAL_OVERRIDE;
78 :
79 : // flush. Do buffered updates.
80 : virtual void flush() SAL_OVERRIDE;
81 :
82 : // #i68597# part of content gets copied, react on it
83 : virtual void copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize) SAL_OVERRIDE;
84 :
85 : // restore part of background. Implemented form buffered versions only.
86 : virtual void restoreBackground(const vcl::Region& rRegion) const SAL_OVERRIDE;
87 :
88 : // invalidate the given range at local OutputDevice
89 : virtual void invalidateRange(const basegfx::B2DRange& rRange) SAL_OVERRIDE;
90 :
91 : // access to RefreshWithPreRendering Flag
92 587 : bool DoRefreshWithPreRendering() const { return mbRefreshWithPreRendering; }
93 : };
94 : } // end of namespace overlay
95 : } // end of namespace sdr
96 :
97 :
98 :
99 : #endif // INCLUDED_SVX_INC_SDR_OVERLAY_OVERLAYMANAGERBUFFERED_HXX
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|