vcl: utilize CoordinateMapper wrappers to simplify map.cxx

This commit replaces manual coordinate arithmetic in map.cxx with the
newly introduced CoordinateMapper pipeline stages and master wrappers,
improving encapsulation and fixing a subtle offset bug.

Key changes:
- OutputDevice::LogicToDeviceSubPixel: Replaced nested pipeline calls
  and manual device origin additions with the LogicToDeviceSubPixel
  master wrapper. This completely hides the math from map.cxx and
  ensures the absolute logical offset (mnOutOffLogic) is correctly
  applied before any DPI/MapMode scaling occurs.

- OutputDevice::ImplPixelToDevicePixel: Fixed an early-exit bug. The
  legacy code only checked if the screen origin (mnOutOff) was zero
  before returning early, completely ignoring whether the window had an
  internal VCL pixel offset (mnOutOffOrig). By piping `0` through
  ViewToWindowUnits and WindowToDeviceUnits, we now calculate the
  exact combined spatial delta to check for the early exit and move
  the region safely.

Change-Id: I697a0a7aa2bc4c03e55654305432b0805cee9c66
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203667
Tested-by: Jenkins
Reviewed-by: Dan Williams <dcbw@libreoffice.org>
This commit is contained in:
Christopher Sherlock
2026-08-24 18:51:16 +02:00
committed by Dan Williams
parent 0749bf21b3
commit adf3a4e560
+5 -2
View File
@@ -257,11 +257,14 @@ tools::Rectangle OutputDevice::ImplDevicePixelToLogic( const tools::Rectangle& r
vcl::Region OutputDevice::ImplPixelToDevicePixel( const vcl::Region& rRegion ) const
{
if ( !mpMapper->GetDeviceOriginX() && !mpMapper->GetDeviceOriginY() )
tools::Long nDeltaX = mpMapper->WindowToDeviceUnitsX(mpMapper->ViewToWindowUnitsX(0));
tools::Long nDeltaY = mpMapper->WindowToDeviceUnitsY(mpMapper->ViewToWindowUnitsY(0));
if (nDeltaX == 0 && nDeltaY == 0)
return rRegion;
vcl::Region aRegion( rRegion );
aRegion.Move( mpMapper->GetDeviceOriginX()+mpMapper->GetPixelXOffset(), mpMapper->GetDeviceOriginY()+mpMapper->GetPixelYOffset() );
aRegion.Move(nDeltaX, nDeltaY);
return aRegion;
}