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

Generated by: LCOV version 1.10