LCOV - code coverage report
Current view: top level - svx/source/sdr/overlay - overlaymanagerbuffered.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 165 186 88.7 %
Date: 2014-11-03 Functions: 15 17 88.2 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10