xref: /trunk/main/svx/source/sdr/overlay/overlaymanagerbuffered.cxx (revision d8dff77764cb74143fabc617dc8ee25d946bae78)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 // MARKER(update_precomp.py): autogen include statement, do not remove
23 #include "precompiled_svx.hxx"
24 #include <svx/sdr/overlay/overlaymanagerbuffered.hxx>
25 #include <vcl/outdev.hxx>
26 #include <basegfx/point/b2dpoint.hxx>
27 #include <basegfx/range/b2drange.hxx>
28 #include <vcl/salbtype.hxx>
29 #include <vcl/window.hxx>
30 #include <vcl/bitmap.hxx>
31 #include <tools/stream.hxx>
32 #include <basegfx/matrix/b2dhommatrix.hxx>
33 #include <vcl/cursor.hxx>
34 #include <vcl/dibtools.hxx>
35 
36 namespace sdr
37 {
38     namespace overlay
39     {
40         void OverlayManagerBuffered::ImpPrepareBufferDevice()
41         {
42             // compare size of maBufferDevice with size of visible area
43             if(maBufferDevice.GetOutputSizePixel() != getOutputDevice().GetOutputSizePixel())
44             {
45                 // set new buffer size, copy as much content as possible (use bool parameter for vcl).
46                 // Newly uncovered regions will be repainted.
47                 maBufferDevice.SetOutputSizePixel(getOutputDevice().GetOutputSizePixel(), false);
48             }
49 
50             // compare the MapModes for zoom/scroll changes
51             if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode())
52             {
53                 const bool bZoomed(
54                     maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
55                     || maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
56 
57                 if(!bZoomed)
58                 {
59                     const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin();
60                     const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin();
61                     const bool bScrolled(rOriginOld != rOriginNew);
62 
63                     if(bScrolled)
64                     {
65                         // get pixel bounds
66                         const Point aOriginOldPixel(maBufferDevice.LogicToPixel(rOriginOld));
67                         const Point aOriginNewPixel(maBufferDevice.LogicToPixel(rOriginNew));
68                         const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel());
69 
70                         // remember and switch off MapMode
71                         const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
72                         maBufferDevice.EnableMapMode(false);
73 
74                         // scroll internally buffered stuff
75                         const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel);
76                         maBufferDevice.DrawOutDev(
77                             aDestinationOffsetPixel, aOutputSizePixel, // destination
78                             Point(), aOutputSizePixel); // source
79 
80                         // restore MapMode
81                         maBufferDevice.EnableMapMode(bMapModeWasEnabled);
82 
83                         // scroll remembered region, too.
84                         if(!maBufferRememberedRangePixel.isEmpty())
85                         {
86                             const basegfx::B2IPoint aIPointDestinationOffsetPixel(aDestinationOffsetPixel.X(), aDestinationOffsetPixel.Y());
87                             const basegfx::B2IPoint aNewMinimum(maBufferRememberedRangePixel.getMinimum() + aIPointDestinationOffsetPixel);
88                             const basegfx::B2IPoint aNewMaximum(maBufferRememberedRangePixel.getMaximum() + aIPointDestinationOffsetPixel);
89                             maBufferRememberedRangePixel = basegfx::B2IRange(aNewMinimum, aNewMaximum);
90                         }
91                     }
92                 }
93 
94                 // copy new MapMode
95                 maBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
96             }
97 
98             // #i29186#
99             maBufferDevice.SetDrawMode(getOutputDevice().GetDrawMode());
100             maBufferDevice.SetSettings(getOutputDevice().GetSettings());
101             maBufferDevice.SetAntialiasing(getOutputDevice().GetAntialiasing());
102         }
103 
104         void OverlayManagerBuffered::ImpRestoreBackground() const
105         {
106             const Rectangle aRegionRectanglePixel(
107                 maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
108                 maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
109             const Region aRegionPixel(aRegionRectanglePixel);
110 
111             ImpRestoreBackground(aRegionPixel);
112         }
113 
114         void OverlayManagerBuffered::ImpRestoreBackground(const Region& rRegionPixel) const
115         {
116             // MapModes off
117             const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
118             const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
119             getOutputDevice().EnableMapMode(false);
120             ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(false);
121 
122             // local region
123             RectangleVector aRectangles;
124             rRegionPixel.GetRegionRectangles(aRectangles);
125 
126             for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
127             {
128 #ifdef DBG_UTIL
129                 // #i72754# possible graphical region test only with non-pro
130                 static bool bDoPaintForVisualControl(false);
131 
132                 if(bDoPaintForVisualControl)
133                 {
134                     getOutputDevice().SetLineColor(COL_LIGHTGREEN);
135                     getOutputDevice().SetFillColor();
136                     getOutputDevice().DrawRect(*aRectIter);
137                 }
138 #endif
139 
140                 // restore the area
141                 const Point aTopLeft(aRectIter->TopLeft());
142                 const Size aSize(aRectIter->GetSize());
143 
144                 getOutputDevice().DrawOutDev(
145                     aTopLeft, aSize, // destination
146                     aTopLeft, aSize, // source
147                     maBufferDevice);
148             }
149 
150             //Region aRegionPixel(rRegionPixel);
151             //RegionHandle aRegionHandle(aRegionPixel.BeginEnumRects());
152             //Rectangle aRegionRectanglePixel;
153             //
154             //while(aRegionPixel.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
155             //{
156 #ifdef DBG_U//TIL
157             //  // #i72754# possible graphical region test only with non-pro
158             //  static bool bDoPaintForVisualControl(false);
159             //  if(bDoPaintForVisualControl)
160             //  {
161             //      getOutputDevice().SetLineColor(COL_LIGHTGREEN);
162             //      getOutputDevice().SetFillColor();
163             //      getOutputDevice().DrawRect(aRegionRectanglePixel);
164             //  }
165 #endif      //
166             //  // restore the area
167             //  const Point aTopLeft(aRegionRectanglePixel.TopLeft());
168             //  const Size aSize(aRegionRectanglePixel.GetSize());
169             //
170             //  getOutputDevice().DrawOutDev(
171             //      aTopLeft, aSize, // destination
172             //      aTopLeft, aSize, // source
173             //      maBufferDevice);
174             //}
175             //
176             //aRegionPixel.EndEnumRects(aRegionHandle);
177 
178             // restore MapModes
179             getOutputDevice().EnableMapMode(bMapModeWasEnabledDest);
180             ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
181         }
182 
183         void OverlayManagerBuffered::ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice)
184         {
185             // prepare source
186             OutputDevice& rSource = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice();
187 
188             // Ensure buffer is valid
189             ImpPrepareBufferDevice();
190 
191             // build region which needs to be copied
192             Region aRegion(rSource.LogicToPixel(rRegion));
193 
194             // limit to PaintRegion if it's a window. This will be evtl. the expanded one,
195             // but always the exact redraw area
196             if(OUTDEV_WINDOW == rSource.GetOutDevType())
197             {
198                 Window& rWindow = (Window&)rSource;
199                 Region aPaintRegionPixel = rWindow.LogicToPixel(rWindow.GetPaintRegion());
200                 aRegion.Intersect(aPaintRegionPixel);
201 
202                 // #i72754# Make sure content is completely rendered, the window
203                 // will be used as source of a DrawOutDev soon
204                 rWindow.Flush();
205             }
206 
207             // also limit to buffer size
208             const Rectangle aBufferDeviceRectanglePixel(Point(), maBufferDevice.GetOutputSizePixel());
209             aRegion.Intersect(aBufferDeviceRectanglePixel);
210 
211             // MapModes off
212             const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
213             const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
214             rSource.EnableMapMode(false);
215             maBufferDevice.EnableMapMode(false);
216 
217             // prepare to iterate over the rectangles from the region in pixels
218             RectangleVector aRectangles;
219             aRegion.GetRegionRectangles(aRectangles);
220 
221             for(RectangleVector::const_iterator aRectIter(aRectangles.begin()); aRectIter != aRectangles.end(); aRectIter++)
222             {
223                 // for each rectangle, save the area
224                 const Point aTopLeft(aRectIter->TopLeft());
225                 const Size aSize(aRectIter->GetSize());
226 
227                 maBufferDevice.DrawOutDev(
228                     aTopLeft, aSize, // destination
229                     aTopLeft, aSize, // source
230                     rSource);
231 
232 #ifdef DBG_UTIL
233                 // #i72754# possible graphical region test only with non-pro
234                 static bool bDoPaintForVisualControl(false);
235 
236                 if(bDoPaintForVisualControl)
237                 {
238                     const bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
239 
240                     getOutputDevice().EnableMapMode(false);
241                     getOutputDevice().SetLineColor(COL_LIGHTRED);
242                     getOutputDevice().SetFillColor();
243                     getOutputDevice().DrawRect(*aRectIter);
244                     getOutputDevice().EnableMapMode(bMapModeWasEnabledTest);
245                 }
246 
247                 static bool bDoSaveForVisualControl(false);
248 
249                 if(bDoSaveForVisualControl)
250                 {
251                     const Bitmap aBitmap(maBufferDevice.GetBitmap(aTopLeft, aSize));
252                     SvFileStream aNew((const String&)String(ByteString( "c:\\test.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
253                     WriteDIB(aBitmap, aNew, false, true);
254                 }
255 #endif
256             }
257 
258             //RegionHandle aRegionHandle(aRegion.BeginEnumRects());
259             //Rectangle aRegionRectanglePixel;
260             //
261             //while(aRegion.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
262             //{
263             //  // for each rectangle, save the area
264             //  Point aTopLeft(aRegionRectanglePixel.TopLeft());
265             //  Size aSize(aRegionRectanglePixel.GetSize());
266             //
267             //  maBufferDevice.DrawOutDev(
268             //      aTopLeft, aSize, // destination
269             //      aTopLeft, aSize, // source
270             //      rSource);
271             //
272 #ifdef DBG_U//TIL
273             //  // #i72754# possible graphical region test only with non-pro
274             //  static bool bDoPaintForVisualControl(false);
275             //  if(bDoPaintForVisualControl)
276             //  {
277             //      const bool bMapModeWasEnabledTest(getOutputDevice().IsMapModeEnabled());
278             //      getOutputDevice().EnableMapMode(false);
279             //      getOutputDevice().SetLineColor(COL_LIGHTRED);
280             //      getOutputDevice().SetFillColor();
281             //      getOutputDevice().DrawRect(aRegionRectanglePixel);
282             //      getOutputDevice().EnableMapMode(bMapModeWasEnabledTest);
283             //  }
284             //
285             //  static bool bDoSaveForVisualControl(false);
286             //  if(bDoSaveForVisualControl)
287             //  {
288             //      const Bitmap aBitmap(maBufferDevice.GetBitmap(aTopLeft, aSize));
289             //      SvFileStream aNew((const String&)String(ByteString( "c:\\test.bmp" ), RTL_TEXTENCODING_UTF8), STREAM_WRITE|STREAM_TRUNC);
290             //      aNew << aBitmap;
291             //  }
292 #endif      //
293             //}
294             //
295             //aRegion.EndEnumRects(aRegionHandle);
296 
297             // restore MapModes
298             rSource.EnableMapMode(bMapModeWasEnabledDest);
299             maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
300         }
301 
302         IMPL_LINK(OverlayManagerBuffered, ImpBufferTimerHandler, AutoTimer*, /*pTimer*/)
303         {
304             // stop timer
305             maBufferTimer.Stop();
306 
307             if(!maBufferRememberedRangePixel.isEmpty())
308             {
309                 // logic size for impDrawMember call
310                 basegfx::B2DRange aBufferRememberedRangeLogic(
311                     maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
312                     maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
313                 aBufferRememberedRangeLogic.transform(getOutputDevice().GetInverseViewTransformation());
314 
315                 // prepare cursor handling
316                 const bool bTargetIsWindow(OUTDEV_WINDOW == rmOutputDevice.GetOutDevType());
317                 bool bCursorWasEnabled(false);
318 
319                 // #i80730# switch off VCL cursor during overlay refresh
320                 if(bTargetIsWindow)
321                 {
322                     Window& rWindow = static_cast< Window& >(rmOutputDevice);
323                     Cursor* pCursor = rWindow.GetCursor();
324 
325                     if(pCursor && pCursor->IsVisible())
326                     {
327                         pCursor->Hide();
328                         bCursorWasEnabled = true;
329                     }
330                 }
331 
332                 if(DoRefreshWithPreRendering())
333                 {
334                     // #i73602# ensure valid and sized maOutputBufferDevice
335                     const Size aDestinationSizePixel(maBufferDevice.GetOutputSizePixel());
336                     const Size aOutputBufferSizePixel(maOutputBufferDevice.GetOutputSizePixel());
337 
338                     if(aDestinationSizePixel != aOutputBufferSizePixel)
339                     {
340                         maOutputBufferDevice.SetOutputSizePixel(aDestinationSizePixel);
341                     }
342 
343                     maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
344                     maOutputBufferDevice.EnableMapMode(false);
345                     maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode());
346                     maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings());
347                     maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing());
348 
349                     // calculate sizes
350                     Rectangle aRegionRectanglePixel(
351                         maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
352                         maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
353 
354                     // truncate aRegionRectanglePixel to destination pixel size, more does
355                     // not need to be prepared since destination is a buffer for a window. So,
356                     // maximum size indirectly shall be limited to getOutputDevice().GetOutputSizePixel()
357                     if(aRegionRectanglePixel.Left() < 0L)
358                     {
359                         aRegionRectanglePixel.Left() = 0L;
360                     }
361 
362                     if(aRegionRectanglePixel.Top() < 0L)
363                     {
364                         aRegionRectanglePixel.Top() = 0L;
365                     }
366 
367                     if(aRegionRectanglePixel.Right() > aDestinationSizePixel.getWidth())
368                     {
369                         aRegionRectanglePixel.Right() = aDestinationSizePixel.getWidth();
370                     }
371 
372                     if(aRegionRectanglePixel.Bottom() > aDestinationSizePixel.getHeight())
373                     {
374                         aRegionRectanglePixel.Bottom() = aDestinationSizePixel.getHeight();
375                     }
376 
377                     // get sizes
378                     const Point aTopLeft(aRegionRectanglePixel.TopLeft());
379                     const Size aSize(aRegionRectanglePixel.GetSize());
380 
381                     {
382                         const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
383                         maBufferDevice.EnableMapMode(false);
384 
385                         maOutputBufferDevice.DrawOutDev(
386                             aTopLeft, aSize, // destination
387                             aTopLeft, aSize, // source
388                             maBufferDevice);
389 
390                         // restore MapModes
391                         maBufferDevice.EnableMapMode(bMapModeWasEnabledDest);
392                     }
393 
394                     // paint overlay content for remembered region, use
395                     // method from base class directly
396                     maOutputBufferDevice.EnableMapMode(true);
397                     OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice);
398                     maOutputBufferDevice.EnableMapMode(false);
399 
400                     // copy to output
401                     {
402                         const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
403                         getOutputDevice().EnableMapMode(false);
404 
405                         getOutputDevice().DrawOutDev(
406                             aTopLeft, aSize, // destination
407                             aTopLeft, aSize, // source
408                             maOutputBufferDevice);
409 
410                         // debug
411                         /*getOutputDevice().SetLineColor(COL_RED);
412                         getOutputDevice().SetFillColor();
413                         getOutputDevice().DrawRect(Rectangle(aTopLeft, aSize));*/
414 
415                         // restore MapModes
416                         getOutputDevice().EnableMapMode(bMapModeWasEnabledDest);
417                     }
418                 }
419                 else
420                 {
421                     // Restore all rectangles for remembered region from buffer
422                     ImpRestoreBackground();
423 
424                     // paint overlay content for remembered region, use
425                     // method from base class directly
426                     OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, getOutputDevice());
427                 }
428 
429                 // VCL hack for transparent child windows
430                 // Problem is e.g. a radiobuttion form control in life mode. The used window
431                 // is a transparent vcl childwindow. This flag only allows the parent window to
432                 // paint into the child windows area, but there is no mechanism which takes
433                 // care for a repaint of the child window. A transparent child window is NOT
434                 // a window which always keeps its content consistent over the parent, but it's
435                 // more like just a paint flag for the parent.
436                 // To get the update, the windows in question are updated manually here.
437                 if(bTargetIsWindow)
438                 {
439                     Window& rWindow = static_cast< Window& >(rmOutputDevice);
440 
441                     if(rWindow.IsChildTransparentModeEnabled() && rWindow.GetChildCount())
442                     {
443                         const Rectangle aRegionRectanglePixel(
444                             maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
445                             maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
446 
447                         for(sal_uInt16 a(0); a < rWindow.GetChildCount(); a++)
448                         {
449                             Window* pCandidate = rWindow.GetChild(a);
450 
451                             if(pCandidate && pCandidate->IsPaintTransparent())
452                             {
453                                 const Rectangle aCandidatePosSizePixel(pCandidate->GetPosPixel(), pCandidate->GetSizePixel());
454 
455                                 if(aCandidatePosSizePixel.IsOver(aRegionRectanglePixel))
456                                 {
457                                     pCandidate->Invalidate(INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN);
458                                     pCandidate->Update();
459                                 }
460                             }
461                         }
462                     }
463                 }
464 
465                 // #i80730# restore visibility of VCL cursor
466                 if(bCursorWasEnabled)
467                 {
468                     Window& rWindow = static_cast< Window& >(rmOutputDevice);
469                     Cursor* pCursor = rWindow.GetCursor();
470 
471                     if(pCursor)
472                     {
473                         // check if cursor still exists. It may have been deleted from someone
474                         pCursor->Show();
475                     }
476                 }
477 
478                 // forget remembered Region
479                 maBufferRememberedRangePixel.reset();
480             }
481 
482             return 0;
483         }
484 
485         OverlayManagerBuffered::OverlayManagerBuffered(
486             OutputDevice& rOutputDevice,
487             bool bRefreshWithPreRendering)
488         :   OverlayManager(rOutputDevice),
489             mbRefreshWithPreRendering(bRefreshWithPreRendering)
490         {
491             // Init timer
492             maBufferTimer.SetTimeout(1);
493             maBufferTimer.SetTimeoutHdl(LINK(this, OverlayManagerBuffered, ImpBufferTimerHandler));
494         }
495 
496         OverlayManagerBuffered::~OverlayManagerBuffered()
497         {
498             // Clear timer
499             maBufferTimer.Stop();
500 
501             if(!maBufferRememberedRangePixel.isEmpty())
502             {
503                 // Restore all rectangles for remembered region from buffer
504                 ImpRestoreBackground();
505             }
506         }
507 
508         void OverlayManagerBuffered::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
509         {
510             if(!rRegion.IsEmpty())
511             {
512                 // save new background
513                 ((OverlayManagerBuffered*)this)->ImpSaveBackground(rRegion, pPreRenderDevice);
514             }
515 
516             // call parent
517             OverlayManager::completeRedraw(rRegion, pPreRenderDevice);
518         }
519 
520         void OverlayManagerBuffered::flush()
521         {
522             // call timer handler direct
523             ImpBufferTimerHandler(0);
524         }
525 
526         // #i68597# part of content gets copied, react on it
527         void OverlayManagerBuffered::copyArea(const Point& rDestPt, const Point& rSrcPt, const Size& rSrcSize)
528         {
529             // scroll local buffered area
530             maBufferDevice.CopyArea(rDestPt, rSrcPt, rSrcSize);
531         }
532 
533         void OverlayManagerBuffered::restoreBackground(const Region& rRegion) const
534         {
535             // restore
536             const Region aRegionPixel(getOutputDevice().LogicToPixel(rRegion));
537             ImpRestoreBackground(aRegionPixel);
538 
539             // call parent
540             OverlayManager::restoreBackground(rRegion);
541         }
542 
543         void OverlayManagerBuffered::invalidateRange(const basegfx::B2DRange& rRange)
544         {
545             if(!rRange.isEmpty())
546             {
547                 // buffered output, do not invalidate but use the timer
548                 // to trigger a timer event for refresh
549                 maBufferTimer.Start();
550 
551                 // add the discrete range to the remembered region
552                 // #i75163# use double precision and floor/ceil rounding to get overlapped pixel region, even
553                 // when the given logic region has a width/height of 0.0. This does NOT work with LogicToPixel
554                 // since it just transforms the top left and bottom right points equally without taking
555                 // discrete pixel coverage into account. An empty B2DRange and thus empty logic Rectangle translated
556                 // to an also empty discrete pixel rectangle - what is wrong.
557                 basegfx::B2DRange aDiscreteRange(rRange);
558                 aDiscreteRange.transform(getOutputDevice().GetViewTransformation());
559 
560                 if(maDrawinglayerOpt.IsAntiAliasing())
561                 {
562                     // assume AA needs one pixel more and invalidate one pixel more
563                     const double fDiscreteOne(getDiscreteOne());
564                     const basegfx::B2IPoint aTopLeft(
565                         (sal_Int32)floor(aDiscreteRange.getMinX() - fDiscreteOne),
566                         (sal_Int32)floor(aDiscreteRange.getMinY() - fDiscreteOne));
567                     const basegfx::B2IPoint aBottomRight(
568                         (sal_Int32)ceil(aDiscreteRange.getMaxX() + fDiscreteOne),
569                         (sal_Int32)ceil(aDiscreteRange.getMaxY() + fDiscreteOne));
570 
571                     maBufferRememberedRangePixel.expand(aTopLeft);
572                     maBufferRememberedRangePixel.expand(aBottomRight);
573                 }
574                 else
575                 {
576                     const basegfx::B2IPoint aTopLeft((sal_Int32)floor(aDiscreteRange.getMinX()), (sal_Int32)floor(aDiscreteRange.getMinY()));
577                     const basegfx::B2IPoint aBottomRight((sal_Int32)ceil(aDiscreteRange.getMaxX()), (sal_Int32)ceil(aDiscreteRange.getMaxY()));
578 
579                     maBufferRememberedRangePixel.expand(aTopLeft);
580                     maBufferRememberedRangePixel.expand(aBottomRight);
581                 }
582             }
583         }
584 
585         void OverlayManagerBuffered::SetRefreshWithPreRendering(bool bNew)
586         {
587             if((bool)mbRefreshWithPreRendering != bNew)
588             {
589                 mbRefreshWithPreRendering = bNew;
590             }
591         }
592     } // end of namespace overlay
593 } // end of namespace sdr
594 
595 /* vim: set noet sw=4 ts=4: */
596