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: 155 184 84.2 %
Date: 2012-12-17 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         689 :         void OverlayManagerBuffered::ImpPrepareBufferDevice()
      37             :         {
      38             :             // compare size of maBufferDevice with size of visible area
      39         689 :             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         332 :                 maBufferDevice.SetOutputSizePixel(getOutputDevice().GetOutputSizePixel(), false);
      44             :             }
      45             : 
      46             :             // compare the MapModes for zoom/scroll changes
      47         689 :             if(maBufferDevice.GetMapMode() != getOutputDevice().GetMapMode())
      48             :             {
      49             :                 const bool bZoomed(
      50         344 :                     maBufferDevice.GetMapMode().GetScaleX() != getOutputDevice().GetMapMode().GetScaleX()
      51         344 :                     || maBufferDevice.GetMapMode().GetScaleY() != getOutputDevice().GetMapMode().GetScaleY());
      52             : 
      53         344 :                 if(!bZoomed)
      54             :                 {
      55         306 :                     const Point& rOriginOld = maBufferDevice.GetMapMode().GetOrigin();
      56         306 :                     const Point& rOriginNew = getOutputDevice().GetMapMode().GetOrigin();
      57         306 :                     const bool bScrolled(rOriginOld != rOriginNew);
      58             : 
      59         306 :                     if(bScrolled)
      60             :                     {
      61             :                         // get pixel bounds
      62          20 :                         const Point aOriginOldPixel(maBufferDevice.LogicToPixel(rOriginOld));
      63          20 :                         const Point aOriginNewPixel(maBufferDevice.LogicToPixel(rOriginNew));
      64          20 :                         const Size aOutputSizePixel(maBufferDevice.GetOutputSizePixel());
      65             : 
      66             :                         // remember and switch off MapMode
      67          20 :                         const bool bMapModeWasEnabled(maBufferDevice.IsMapModeEnabled());
      68          20 :                         maBufferDevice.EnableMapMode(false);
      69             : 
      70             :                         // scroll internally buffered stuff
      71          20 :                         const Point aDestinationOffsetPixel(aOriginNewPixel - aOriginOldPixel);
      72             :                         maBufferDevice.DrawOutDev(
      73             :                             aDestinationOffsetPixel, aOutputSizePixel, // destination
      74          20 :                             Point(), aOutputSizePixel); // source
      75             : 
      76             :                         // restore MapMode
      77          20 :                         maBufferDevice.EnableMapMode(bMapModeWasEnabled);
      78             : 
      79             :                         // scroll remembered region, too.
      80          20 :                         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         344 :                 maBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
      92             :             }
      93             : 
      94             :             // #i29186#
      95         689 :             maBufferDevice.SetDrawMode(getOutputDevice().GetDrawMode());
      96         689 :             maBufferDevice.SetSettings(getOutputDevice().GetSettings());
      97         689 :             maBufferDevice.SetAntialiasing(getOutputDevice().GetAntialiasing());
      98         689 :         }
      99             : 
     100          24 :         void OverlayManagerBuffered::ImpRestoreBackground() const
     101             :         {
     102             :             const Rectangle aRegionRectanglePixel(
     103             :                 maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
     104          24 :                 maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
     105          24 :             const Region aRegionPixel(aRegionRectanglePixel);
     106             : 
     107          24 :             ImpRestoreBackground(aRegionPixel);
     108          24 :         }
     109             : 
     110          24 :         void OverlayManagerBuffered::ImpRestoreBackground(const Region& rRegionPixel) const
     111             :         {
     112             :             // local region
     113          24 :             Region aRegionPixel(rRegionPixel);
     114          24 :             RegionHandle aRegionHandle(aRegionPixel.BeginEnumRects());
     115          24 :             Rectangle aRegionRectanglePixel;
     116             : 
     117             :             // MapModes off
     118          24 :             const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
     119          24 :             const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
     120          24 :             getOutputDevice().EnableMapMode(false);
     121          24 :             ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(false);
     122             : 
     123          72 :             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          24 :                 const Point aTopLeft(aRegionRectanglePixel.TopLeft());
     138          24 :                 const Size aSize(aRegionRectanglePixel.GetSize());
     139             : 
     140          24 :                 getOutputDevice().DrawOutDev(
     141             :                     aTopLeft, aSize, // destination
     142             :                     aTopLeft, aSize, // source
     143          48 :                     maBufferDevice);
     144             :             }
     145             : 
     146          24 :             aRegionPixel.EndEnumRects(aRegionHandle);
     147             : 
     148             :             // restore MapModes
     149          24 :             getOutputDevice().EnableMapMode(bMapModeWasEnabledDest);
     150          24 :             ((OverlayManagerBuffered*)this)->maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
     151          24 :         }
     152             : 
     153         689 :         void OverlayManagerBuffered::ImpSaveBackground(const Region& rRegion, OutputDevice* pPreRenderDevice)
     154             :         {
     155             :             // prepare source
     156         689 :             OutputDevice& rSource = (pPreRenderDevice) ? *pPreRenderDevice : getOutputDevice();
     157             : 
     158             :             // Ensure buffer is valid
     159         689 :             ImpPrepareBufferDevice();
     160             : 
     161             :             // build region which needs to be copied
     162         689 :             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         689 :             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         689 :             const Rectangle aBufferDeviceRectanglePixel = Rectangle(Point(), maBufferDevice.GetOutputSizePixel());
     179         689 :             aRegion.Intersect(aBufferDeviceRectanglePixel);
     180             : 
     181             :             // prepare to iterate over the rectangles from the region in pixels
     182         689 :             RegionHandle aRegionHandle(aRegion.BeginEnumRects());
     183         689 :             Rectangle aRegionRectanglePixel;
     184             : 
     185             :             // MapModes off
     186         689 :             const bool bMapModeWasEnabledDest(rSource.IsMapModeEnabled());
     187         689 :             const bool bMapModeWasEnabledSource(maBufferDevice.IsMapModeEnabled());
     188         689 :             rSource.EnableMapMode(false);
     189         689 :             maBufferDevice.EnableMapMode(false);
     190             : 
     191        2074 :             while(aRegion.GetEnumRects(aRegionHandle, aRegionRectanglePixel))
     192             :             {
     193             :                 // for each rectangle, save the area
     194         696 :                 Point aTopLeft(aRegionRectanglePixel.TopLeft());
     195         696 :                 Size aSize(aRegionRectanglePixel.GetSize());
     196             : 
     197             :                 maBufferDevice.DrawOutDev(
     198             :                     aTopLeft, aSize, // destination
     199             :                     aTopLeft, aSize, // source
     200         696 :                     rSource);
     201             :             }
     202             : 
     203         689 :             aRegion.EndEnumRects(aRegionHandle);
     204             : 
     205             :             // restore MapModes
     206         689 :             rSource.EnableMapMode(bMapModeWasEnabledDest);
     207         689 :             maBufferDevice.EnableMapMode(bMapModeWasEnabledSource);
     208         689 :         }
     209             : 
     210          36 :         IMPL_LINK(OverlayManagerBuffered, ImpBufferTimerHandler, AutoTimer*, /*pTimer*/)
     211             :         {
     212             :             //Resolves: fdo#46728 ensure this exists until end of scope
     213          18 :             rtl::Reference<OverlayManager> xRef(this);
     214             : 
     215             :             // stop timer
     216          18 :             maBufferTimer.Stop();
     217             : 
     218          18 :             if(!maBufferRememberedRangePixel.isEmpty())
     219             :             {
     220             :                 // logic size for impDrawMember call
     221             :                 basegfx::B2DRange aBufferRememberedRangeLogic(
     222          36 :                     maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
     223          54 :                     maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
     224          18 :                 aBufferRememberedRangeLogic.transform(getOutputDevice().GetInverseViewTransformation());
     225             : 
     226             :                 // prepare cursor handling
     227          18 :                 const bool bTargetIsWindow(OUTDEV_WINDOW == rmOutputDevice.GetOutDevType());
     228          18 :                 bool bCursorWasEnabled(false);
     229             : 
     230             :                 // #i80730# switch off VCL cursor during overlay refresh
     231          18 :                 if(bTargetIsWindow)
     232             :                 {
     233          18 :                     Window& rWindow = static_cast< Window& >(rmOutputDevice);
     234          18 :                     Cursor* pCursor = rWindow.GetCursor();
     235             : 
     236          18 :                     if(pCursor && pCursor->IsVisible())
     237             :                     {
     238           6 :                         pCursor->Hide();
     239           6 :                         bCursorWasEnabled = true;
     240             :                     }
     241             :                 }
     242             : 
     243          18 :                 if(DoRefreshWithPreRendering())
     244             :                 {
     245             :                     // #i73602# ensure valid and sized maOutputBufferDevice
     246          18 :                     const Size aDestinationSizePixel(maBufferDevice.GetOutputSizePixel());
     247          18 :                     const Size aOutputBufferSizePixel(maOutputBufferDevice.GetOutputSizePixel());
     248             : 
     249          18 :                     if(aDestinationSizePixel != aOutputBufferSizePixel)
     250             :                     {
     251          16 :                         maOutputBufferDevice.SetOutputSizePixel(aDestinationSizePixel);
     252             :                     }
     253             : 
     254          18 :                     maOutputBufferDevice.SetMapMode(getOutputDevice().GetMapMode());
     255          18 :                     maOutputBufferDevice.EnableMapMode(false);
     256          18 :                     maOutputBufferDevice.SetDrawMode(maBufferDevice.GetDrawMode());
     257          18 :                     maOutputBufferDevice.SetSettings(maBufferDevice.GetSettings());
     258          18 :                     maOutputBufferDevice.SetAntialiasing(maBufferDevice.GetAntialiasing());
     259             : 
     260             :                     // calculate sizes
     261             :                     Rectangle aRegionRectanglePixel(
     262             :                         maBufferRememberedRangePixel.getMinX(), maBufferRememberedRangePixel.getMinY(),
     263          18 :                         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          18 :                     if(aRegionRectanglePixel.Left() < 0L)
     269             :                     {
     270          10 :                         aRegionRectanglePixel.Left() = 0L;
     271             :                     }
     272             : 
     273          18 :                     if(aRegionRectanglePixel.Top() < 0L)
     274             :                     {
     275          10 :                         aRegionRectanglePixel.Top() = 0L;
     276             :                     }
     277             : 
     278          18 :                     if(aRegionRectanglePixel.Right() > aDestinationSizePixel.getWidth())
     279             :                     {
     280           8 :                         aRegionRectanglePixel.Right() = aDestinationSizePixel.getWidth();
     281             :                     }
     282             : 
     283          18 :                     if(aRegionRectanglePixel.Bottom() > aDestinationSizePixel.getHeight())
     284             :                     {
     285           0 :                         aRegionRectanglePixel.Bottom() = aDestinationSizePixel.getHeight();
     286             :                     }
     287             : 
     288             :                     // get sizes
     289          18 :                     const Point aTopLeft(aRegionRectanglePixel.TopLeft());
     290          18 :                     const Size aSize(aRegionRectanglePixel.GetSize());
     291             : 
     292             :                     {
     293          18 :                         const bool bMapModeWasEnabledDest(maBufferDevice.IsMapModeEnabled());
     294          18 :                         maBufferDevice.EnableMapMode(false);
     295             : 
     296             :                         maOutputBufferDevice.DrawOutDev(
     297             :                             aTopLeft, aSize, // destination
     298             :                             aTopLeft, aSize, // source
     299          18 :                             maBufferDevice);
     300             : 
     301             :                         // restore MapModes
     302          18 :                         maBufferDevice.EnableMapMode(bMapModeWasEnabledDest);
     303             :                     }
     304             : 
     305             :                     // paint overlay content for remembered region, use
     306             :                     // method from base class directly
     307          18 :                     maOutputBufferDevice.EnableMapMode(true);
     308          18 :                     OverlayManager::ImpDrawMembers(aBufferRememberedRangeLogic, maOutputBufferDevice);
     309          18 :                     maOutputBufferDevice.EnableMapMode(false);
     310             : 
     311             :                     // copy to output
     312             :                     {
     313          18 :                         const bool bMapModeWasEnabledDest(getOutputDevice().IsMapModeEnabled());
     314          18 :                         getOutputDevice().EnableMapMode(false);
     315             : 
     316          18 :                         getOutputDevice().DrawOutDev(
     317             :                             aTopLeft, aSize, // destination
     318             :                             aTopLeft, aSize, // source
     319          36 :                             maOutputBufferDevice);
     320             : 
     321             :                         // debug
     322             :                         /*getOutputDevice().SetLineColor(COL_RED);
     323             :                         getOutputDevice().SetFillColor();
     324             :                         getOutputDevice().DrawRect(Rectangle(aTopLeft, aSize));*/
     325             : 
     326             :                         // restore MapModes
     327          18 :                         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          18 :                 if(bTargetIsWindow)
     349             :                 {
     350          18 :                     Window& rWindow = static_cast< Window& >(rmOutputDevice);
     351          18 :                     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          18 :                             maBufferRememberedRangePixel.getMaxX(), maBufferRememberedRangePixel.getMaxY());
     357             : 
     358             :                         rWindow.Invalidate(aRegionRectanglePixel,
     359          18 :                                            INVALIDATE_NOTRANSPARENT|INVALIDATE_CHILDREN|INVALIDATE_UPDATE);
     360             :                     }
     361             :                 }
     362             : 
     363             :                 // #i80730# restore visibility of VCL cursor
     364          18 :                 if(bCursorWasEnabled)
     365             :                 {
     366           6 :                     Window& rWindow = static_cast< Window& >(rmOutputDevice);
     367           6 :                     Cursor* pCursor = rWindow.GetCursor();
     368             : 
     369           6 :                     if(pCursor)
     370             :                     {
     371             :                         // check if cursor still exists. It may have been deleted from someone
     372           6 :                         pCursor->Show();
     373             :                     }
     374             :                 }
     375             : 
     376             :                 // forget remembered Region
     377          18 :                 maBufferRememberedRangePixel.reset();
     378             :             }
     379             : 
     380          18 :             return 0;
     381             :         }
     382             : 
     383         356 :         OverlayManagerBuffered::OverlayManagerBuffered(
     384             :             OutputDevice& rOutputDevice,
     385             :             OverlayManager* pOldOverlayManager,
     386             :             bool bRefreshWithPreRendering)
     387             :         :   OverlayManager(rOutputDevice, pOldOverlayManager),
     388         356 :             mbRefreshWithPreRendering(bRefreshWithPreRendering)
     389             :         {
     390             :             // Init timer
     391         356 :             maBufferTimer.SetTimeout(1);
     392         356 :             maBufferTimer.SetTimeoutHdl(LINK(this, OverlayManagerBuffered, ImpBufferTimerHandler));
     393         356 :         }
     394             : 
     395         356 :         rtl::Reference<OverlayManager> OverlayManagerBuffered::create(
     396             :             OutputDevice& rOutputDevice,
     397             :             OverlayManager* pOldOverlayManager,
     398             :             bool bRefreshWithPreRendering)
     399             :         {
     400             :             return rtl::Reference<OverlayManager>(new OverlayManagerBuffered(rOutputDevice,
     401         356 :                 pOldOverlayManager, bRefreshWithPreRendering));
     402             :         }
     403             : 
     404         120 :         OverlayManagerBuffered::~OverlayManagerBuffered()
     405             :         {
     406             :             // Clear timer
     407          40 :             maBufferTimer.Stop();
     408             : 
     409          40 :             if(!maBufferRememberedRangePixel.isEmpty())
     410             :             {
     411             :                 // Restore all rectangles for remembered region from buffer
     412          24 :                 ImpRestoreBackground();
     413             :             }
     414          80 :         }
     415             : 
     416         689 :         void OverlayManagerBuffered::completeRedraw(const Region& rRegion, OutputDevice* pPreRenderDevice) const
     417             :         {
     418         689 :             if(!rRegion.IsEmpty())
     419             :             {
     420             :                 // save new background
     421         689 :                 ((OverlayManagerBuffered*)this)->ImpSaveBackground(rRegion, pPreRenderDevice);
     422             :             }
     423             : 
     424             :             // call parent
     425         689 :             OverlayManager::completeRedraw(rRegion, pPreRenderDevice);
     426         689 :         }
     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         696 :         void OverlayManagerBuffered::invalidateRange(const basegfx::B2DRange& rRange)
     452             :         {
     453         696 :             if(!rRange.isEmpty())
     454             :             {
     455             :                 // buffered output, do not invalidate but use the timer
     456             :                 // to trigger a timer event for refresh
     457         696 :                 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         696 :                 basegfx::B2DRange aDiscreteRange(rRange);
     466         696 :                 aDiscreteRange.transform(getOutputDevice().GetViewTransformation());
     467             : 
     468         696 :                 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         696 :                     const basegfx::B2IPoint aTopLeft((sal_Int32)floor(aDiscreteRange.getMinX()), (sal_Int32)floor(aDiscreteRange.getMinY()));
     485         696 :                     const basegfx::B2IPoint aBottomRight((sal_Int32)ceil(aDiscreteRange.getMaxX()), (sal_Int32)ceil(aDiscreteRange.getMaxY()));
     486             : 
     487         696 :                     maBufferRememberedRangePixel.expand(aTopLeft);
     488         696 :                     maBufferRememberedRangePixel.expand(aBottomRight);
     489             :                 }
     490             :             }
     491         696 :         }
     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