From c928d5bc077986e4fa01347241f7e51f6b416857 Mon Sep 17 00:00:00 2001 From: Christopher Sherlock Date: Sun, 12 Apr 2026 04:09:27 +1000 Subject: [PATCH] vcl: Rename Y-axis origin methods to Get/SetDeviceOriginY Completes the deprecation of legacy coordinate subsystem naming by renaming GetOutOffYPixel() and SetOutOffYPixel() to GetDeviceOriginY() and SetDeviceOriginY() across OutputDevice, Window, and CoordinateMapper. This unifies axis naming conventions following previous X-axis refactoring passes, clarifying that these fields represent the physical origin offsets of the device rendering canvas. This patch also moves view transformation logic inline from outdev/map to CoordinateMapper, and wraps sprawling multi-line logic formulas across mapping routines to clean up formatting boundaries. Key changes: * include/vcl/outdev.hxx / window.hxx: Updated public declarations to replace GetOutOffYPixel with GetDeviceOriginY. * vcl/inc/CoordinateMapper.hxx: Migrated view transformation cache State members and mapping calculation methods into the mapper object. * Global adjustments: Patched all related coordinate offset reads and tracking writes throughout desktop, editeng, sc, svx, and vcl. Change-Id: I28fec54a7f3312cc41ada2de38b26351c0a65527 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203646 Tested-by: Jenkins Reviewed-by: Dan Williams --- canvas/source/cairo/cairo_devicehelper.cxx | 6 +- desktop/source/lib/init.cxx | 2 +- .../processor2d/cairopixelprocessor2d.cxx | 2 +- .../source/processor2d/processor2dtools.cxx | 4 +- editeng/source/editeng/impedit.cxx | 6 +- include/vcl/outdev.hxx | 27 +- include/vcl/window.hxx | 2 +- sc/source/ui/app/inputwin.cxx | 2 +- sc/source/ui/unoobj/docuno.cxx | 2 +- vcl/inc/CoordinateMapper.hxx | 28 +- vcl/source/app/salvtables.cxx | 2 +- vcl/source/app/svapp.cxx | 4 +- vcl/source/outdev/CoordinateMapper.cxx | 110 +++++- vcl/source/outdev/bitmap.cxx | 16 +- vcl/source/outdev/bitmapex.cxx | 3 +- vcl/source/outdev/clipping.cxx | 4 +- vcl/source/outdev/font.cxx | 2 +- vcl/source/outdev/line.cxx | 3 +- vcl/source/outdev/map.cxx | 356 ++++++------------ vcl/source/outdev/outdev.cxx | 4 +- vcl/source/outdev/polygon.cxx | 7 +- vcl/source/outdev/polyline.cxx | 5 +- vcl/source/outdev/text.cxx | 8 +- vcl/source/outdev/transparent.cxx | 4 +- vcl/source/window/clipping.cxx | 8 +- vcl/source/window/cursor.cxx | 2 +- vcl/source/window/mouse.cxx | 2 +- vcl/source/window/paint.cxx | 12 +- vcl/source/window/window.cxx | 26 +- vcl/source/window/window2.cxx | 2 +- vcl/source/window/window3.cxx | 2 +- vcl/source/window/winproc.cxx | 2 +- 32 files changed, 318 insertions(+), 347 deletions(-) diff --git a/canvas/source/cairo/cairo_devicehelper.cxx b/canvas/source/cairo/cairo_devicehelper.cxx index 4bec29a2d629..f8086ba3fa66 100644 --- a/canvas/source/cairo/cairo_devicehelper.cxx +++ b/canvas/source/cairo/cairo_devicehelper.cxx @@ -60,7 +60,7 @@ namespace cairocanvas OutputDevice* pOutDev = getOutputDevice(); mpSurface = pOutDev->CreateSurface(pOutDev->GetDeviceOriginX(), - pOutDev->GetOutOffYPixel(), + pOutDev->GetDeviceOriginY(), pOutDev->GetOutputWidthPixel(), pOutDev->GetOutputHeightPixel()); } @@ -87,13 +87,13 @@ namespace cairocanvas // X11 only bool bReuseSurface = mpSurface && mpSurface->Resize(rSize.getWidth() + pOutDev->GetDeviceOriginX(), - rSize.getHeight() + pOutDev->GetOutOffYPixel()); + rSize.getHeight() + pOutDev->GetDeviceOriginY()); if (!bReuseSurface) { mpSurface = pOutDev->CreateSurface( pOutDev->GetDeviceOriginX(), - pOutDev->GetOutOffYPixel(), + pOutDev->GetDeviceOriginY(), rSize.getWidth(), rSize.getHeight() ); } } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f9faa839b8ef..278cb22c99e8 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5654,7 +5654,7 @@ static void doc_setWindowTextSelection(LibreOfficeKitDocument* /*pThis*/, unsign } - Size aOffset(pWindow->GetDeviceOriginX(), pWindow->GetOutOffYPixel()); + Size aOffset(pWindow->GetDeviceOriginX(), pWindow->GetDeviceOriginY()); Point aCursorPos(nX, nY); aCursorPos.Move(aOffset); sal_uInt16 nModifier = swap ? KEY_MOD1 + KEY_MOD2 : KEY_SHIFT; diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx index b30748b175e8..80b17d702b1a 100644 --- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx @@ -1088,7 +1088,7 @@ CairoPixelProcessor2D::CairoPixelProcessor2D(OutputDevice& rOutputDevice, // get evtl. offsets if OutputDevice is e.g. a OUTDEV_WINDOW // to evaluate if initial clip is needed const tools::Long nOffsetPixelX(mpTargetOutputDevice->GetDeviceOriginX()); - const tools::Long nOffsetPixelY(mpTargetOutputDevice->GetOutOffYPixel()); + const tools::Long nOffsetPixelY(mpTargetOutputDevice->GetDeviceOriginY()); const tools::Long nWidthPixel(mpTargetOutputDevice->GetOutputWidthPixel()); const tools::Long nHeightPixel(mpTargetOutputDevice->GetOutputHeightPixel()); bool bClipNeeded(false); diff --git a/drawinglayer/source/processor2d/processor2dtools.cxx b/drawinglayer/source/processor2d/processor2dtools.cxx index 286bc8441850..d0d7822807f5 100644 --- a/drawinglayer/source/processor2d/processor2dtools.cxx +++ b/drawinglayer/source/processor2d/processor2dtools.cxx @@ -117,10 +117,10 @@ std::unique_ptr createPixelProcessor2DFromOutputDevice( // NOTE: This will also need to take extended size of target device into // consideration, using D2DPixelProcessor2D *will* have to clip // against that. Thus for now this is *not* sufficient (see tdf#163125) - if(0 != rTargetOutDev.GetDeviceOriginX() || 0 != rTargetOutDev.GetOutOffYPixel()) + if(0 != rTargetOutDev.GetDeviceOriginX() || 0 != rTargetOutDev.GetDeviceOriginY()) { basegfx::B2DHomMatrix aTransform(aViewInformation2D.getViewTransformation()); - aTransform.translate(rTargetOutDev.GetDeviceOriginX(), rTargetOutDev.GetOutOffYPixel()); + aTransform.translate(rTargetOutDev.GetDeviceOriginX(), rTargetOutDev.GetDeviceOriginY()); aViewInformation2D.setViewTransformation(aTransform); } diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 0b5e4a4c8170..4f9bdb19e467 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -291,7 +291,7 @@ static void lcl_translateTwips(const OutputDevice& rParent, OutputDevice& rChild return; // Set map mode, so that callback payloads will contain absolute coordinates instead of relative ones. - Point aOffset(rChild.GetDeviceOriginX() - rParent.GetDeviceOriginX(), rChild.GetOutOffYPixel() - rParent.GetOutOffYPixel()); + Point aOffset(rChild.GetDeviceOriginX() - rParent.GetDeviceOriginX(), rChild.GetDeviceOriginY() - rParent.GetDeviceOriginY()); if (!rChild.IsMapModeEnabled()) { MapMode aMapMode(rChild.GetMapMode()); @@ -331,7 +331,7 @@ void ImpEditView::lokSelectionCallback(const std::optional & if (pParent && pParent->GetLOKWindowId() != 0) { const tools::Long nX = mpOutputWindow->GetDeviceOriginX() - pParent->GetDeviceOriginX(); - const tools::Long nY = mpOutputWindow->GetOutOffYPixel() - pParent->GetOutOffYPixel(); + const tools::Long nY = mpOutputWindow->GetDeviceOriginY() - pParent->GetDeviceOriginY(); std::vector aRectangles; aRegion.GetRegionRectangles(aRectangles); @@ -362,7 +362,7 @@ void ImpEditView::lokSelectionCallback(const std::optional & vcl::Window* parent = mpOutputWindow->GetParent(); while (parent && parent->GetDeviceOriginX() == mpOutputWindow->GetDeviceOriginX() && - parent->GetOutOffYPixel() == mpOutputWindow->GetOutOffYPixel()) + parent->GetDeviceOriginY() == mpOutputWindow->GetDeviceOriginY()) { parent = parent->GetParent(); } diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index e725cf045df8..a78e676b2db9 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -301,7 +301,7 @@ public: void SetOutputWidthPixel(tools::Long nWidth); void SetOutputHeightPixel(tools::Long nHeight); tools::Long GetDeviceOriginX() const; - tools::Long GetOutOffYPixel() const; + tools::Long GetDeviceOriginY() const; void SetDeviceOriginX(tools::Long nOutOffX); void SetDeviceOriginY(tools::Long nOutOffY); Point GetOutputOffPixel() const; @@ -1577,18 +1577,15 @@ public: virtual void SetMetafileMapMode(const MapMode& rNewMapMode, bool bIsRecord); const MapMode& GetMapMode() const; + basegfx::B2DHomMatrix GetViewTransformation() const; + basegfx::B2DHomMatrix GetViewTransformation(const MapMode& rMapMode) const; + basegfx::B2DHomMatrix GetInverseViewTransformation() const; + basegfx::B2DHomMatrix GetInverseViewTransformation(const MapMode& rMapMode) const; + protected: virtual void ImplInitMapModeObjects(); public: - // #i75163# - basegfx::B2DHomMatrix GetViewTransformation() const; - basegfx::B2DHomMatrix GetInverseViewTransformation() const; - - SAL_DLLPRIVATE basegfx::B2DHomMatrix GetViewTransformation( const MapMode& rMapMode ) const; - basegfx::B2DHomMatrix GetInverseViewTransformation( const MapMode& rMapMode ) const; - - /** Set an offset in pixel This method offsets every drawing operation that converts its @@ -1812,18 +1809,6 @@ private: */ SAL_DLLPRIVATE vcl::Region ImplPixelToDevicePixel( const vcl::Region& rRegion ) const; - /** Invalidate the view transformation. - - @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212) - */ - SAL_DLLPRIVATE void ImplInvalidateViewTransform(); - - /** Get device transformation. - - @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212) - */ - SAL_DLLPRIVATE basegfx::B2DHomMatrix ImplGetDeviceTransformation() const; - /** Convert a logical X coordinate to a device pixel's X coordinate. To get the device's X coordinate, it must calculate the mapping offset diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 0f4b4b94b05b..770a13d84881 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -1479,7 +1479,7 @@ public: const vcl::TextLayoutCommon* _pTextLayout = nullptr ) const; float GetDPIScaleFactor() const; tools::Long GetDeviceOriginX() const; - tools::Long GetOutOffYPixel() const; + tools::Long GetDeviceOriginY() const; void EnableMapMode( bool bEnable = true ); bool IsMapModeEnabled() const; diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 80933acd8e40..e3f3cd115146 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -443,7 +443,7 @@ void ScInputWindow::PixelInvalidate(const tools::Rectangle* pRectangle) if (pRectangle) { tools::Rectangle aRect(*pRectangle); - aRect.Move(-GetDeviceOriginX(), -GetOutOffYPixel()); + aRect.Move(-GetDeviceOriginX(), -GetDeviceOriginY()); Window::PixelInvalidate(&aRect); } else diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 8719162c9c30..bef35de89621 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -863,7 +863,7 @@ void ScModelObj::postMouseEvent(int nType, int nX, int nY, int nCount, int nButt // Calc operates in pixels... const Point aPosition(nX * pViewData->GetPPTX() + pGridWindow->GetDeviceOriginX(), - nY * pViewData->GetPPTY() + pGridWindow->GetOutOffYPixel()); + nY * pViewData->GetPPTY() + pGridWindow->GetDeviceOriginY()); VclEventId aEvent = VclEventId::NONE; MouseEvent aData(aPosition, nCount, MouseEventModifiers::SIMPLECLICK, nButtons, nModifier); diff --git a/vcl/inc/CoordinateMapper.hxx b/vcl/inc/CoordinateMapper.hxx index 789f692a2df3..6252d92b1907 100644 --- a/vcl/inc/CoordinateMapper.hxx +++ b/vcl/inc/CoordinateMapper.hxx @@ -32,6 +32,10 @@ private: MapMode maMapMode; ImplMapRes maMapRes; + // #i75163# + mutable basegfx::B2DHomMatrix* mpViewTransform = nullptr; + mutable basegfx::B2DHomMatrix* mpInverseViewTransform = nullptr; + sal_Int32 mnDPIX = 0; sal_Int32 mnDPIY = 0; sal_Int32 mnDPIScalePercentage = 100; @@ -69,7 +73,7 @@ public: void SetDPIScalePercentage(sal_Int32 nPercentage); tools::Long GetDeviceOriginX() const; - tools::Long GetOutOffYPixel() const; + tools::Long GetDeviceOriginY() const; void SetDeviceOriginX(tools::Long nOutOffX); void SetOutOffYPixel(tools::Long nOutOffY); @@ -82,12 +86,12 @@ public: Size GetPixelOffset() const { return Size(mnOutOffOrigX, mnOutOffOrigY); } void SetPixelOffset(const Size& rSize); - tools::Long GetPixelXOffset() { return mnOutOffOrigX; } - tools::Long GetPixelYOffset() { return mnOutOffOrigY; } + tools::Long GetPixelXOffset() const { return mnOutOffOrigX; } + tools::Long GetPixelYOffset() const { return mnOutOffOrigY; } void SetLogicalOffset(const Size& rSize); - tools::Long GetLogicalXOffset() { return mnOutOffLogicX; } - tools::Long GetLogicalYOffset() { return mnOutOffLogicY; } + tools::Long GetLogicalXOffset() const { return mnOutOffLogicX; } + tools::Long GetLogicalYOffset() const { return mnOutOffLogicY; } void SetOutputWidthPixel(tools::Long nWidth); void SetOutputHeightPixel(tools::Long nHeight); @@ -118,6 +122,20 @@ public: void CalcMapResolution(const MapMode& rMapMode, tools::Long nDPIX, tools::Long nDPIY); ImplMapRes ResolveMapRes(const MapMode* pMode); + + /** Invalidate the view transformation. + + @since AOO bug 75163 (OpenOffice.org 2.4.3 - OOH 680 milestone 212) + */ + void InvalidateViewTransform(); + basegfx::B2DHomMatrix GetViewTransformation() const; + basegfx::B2DHomMatrix GetViewTransformation(const MapMode& rMapMode) const; + basegfx::B2DHomMatrix GetInverseViewTransformation() const; + basegfx::B2DHomMatrix GetInverseViewTransformation(const MapMode& rMapMode) const; + basegfx::B2DHomMatrix GetDeviceTransformation() const; + + tools::Long LogicToOffsetLogicX(tools::Long nX) const; + tools::Long LogicToOffsetLogicY(tools::Long nY) const; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 7f6ef491c62a..78901782c6bd 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1418,7 +1418,7 @@ void SalInstanceWidget::DoRecursivePaint(vcl::Window* pWindow, const Point& rRen - pChild->GetOutDev()->GetOutputWidthPixel(); tools::Long nDeltaY - = pChild->GetOutDev()->GetOutOffYPixel() - pWindow->GetOutDev()->GetOutOffYPixel(); + = pChild->GetOutDev()->GetDeviceOriginY() - pWindow->GetOutDev()->GetDeviceOriginY(); Point aPos(rRenderLogicPos); aPos += Point(nDeltaX, nDeltaY); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index b337e08b23ca..3d06a4309fc1 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -843,7 +843,7 @@ ImplSVEvent* Application::PostGestureEvent(VclEventId nEvent, vcl::Window* pWin, Point aTransformedPosition(pGestureEvent->mnX, pGestureEvent->mnY); aTransformedPosition.AdjustX(pWin->GetDeviceOriginX()); - aTransformedPosition.AdjustY(pWin->GetOutOffYPixel()); + aTransformedPosition.AdjustY(pWin->GetDeviceOriginY()); const GestureEventPan aGestureEvent( sal_Int32(aTransformedPosition.X()), @@ -950,7 +950,7 @@ ImplSVEvent* Application::PostMouseEvent( VclEventId nEvent, vcl::Window *pWin, if (!comphelper::LibreOfficeKit::isActive()) { aTransformedPos.AdjustX(pWin->GetDeviceOriginX()); - aTransformedPos.AdjustY(pWin->GetOutOffYPixel()); + aTransformedPos.AdjustY(pWin->GetDeviceOriginY()); } const MouseEvent aTransformedEvent( aTransformedPos, pMouseEvent->GetClicks(), pMouseEvent->GetMode(), diff --git a/vcl/source/outdev/CoordinateMapper.cxx b/vcl/source/outdev/CoordinateMapper.cxx index 4e3f3caed299..8b3f161d4388 100644 --- a/vcl/source/outdev/CoordinateMapper.cxx +++ b/vcl/source/outdev/CoordinateMapper.cxx @@ -49,7 +49,7 @@ void CoordinateMapper::SetPixelOffset(const Size& rSize) tools::Long CoordinateMapper::GetDeviceOriginX() const { return mnOutOffX; } -tools::Long CoordinateMapper::GetOutOffYPixel() const { return mnOutOffY; } +tools::Long CoordinateMapper::GetDeviceOriginY() const { return mnOutOffY; } void CoordinateMapper::SetDeviceOriginX(tools::Long nOutOffX) { mnOutOffX = nOutOffX; } @@ -82,4 +82,112 @@ ImplMapRes CoordinateMapper::ResolveMapRes(const MapMode* pMode) return maMapRes.ResolveMapRes(pMode, maMapMode, mbMap, mnDPIX, mnDPIY); } +// #i75163# +void CoordinateMapper::InvalidateViewTransform() +{ + if (mpViewTransform) + { + delete mpViewTransform; + mpViewTransform = nullptr; + } + + if (mpInverseViewTransform) + { + delete mpInverseViewTransform; + mpInverseViewTransform = nullptr; + } +} + +basegfx::B2DHomMatrix CoordinateMapper::GetDeviceTransformation() const +{ + basegfx::B2DHomMatrix aTransformation = GetViewTransformation(); + + // TODO: is it worth to cache the transformed result? + if (mnOutOffX || mnOutOffY) + aTransformation.translate(mnOutOffX, mnOutOffY); + + return aTransformation; +} + +basegfx::B2DHomMatrix CoordinateMapper::GetViewTransformation() const +{ + if (!IsMapModeEnabled()) + return basegfx::B2DHomMatrix(); + + if (mpViewTransform) + return *mpViewTransform; + + mpViewTransform = new basegfx::B2DHomMatrix; + + const double fScaleFactorX(static_cast(GetDPIX()) * maMapRes.mfMapScX); + const double fScaleFactorY(static_cast(GetDPIY()) * maMapRes.mfMapScY); + const double fZeroPointX((static_cast(maMapRes.mnMapOfsX) * fScaleFactorX) + + static_cast(GetPixelXOffset())); + const double fZeroPointY((static_cast(maMapRes.mnMapOfsY) * fScaleFactorY) + + static_cast(GetPixelYOffset())); + + mpViewTransform->set(0, 0, fScaleFactorX); + mpViewTransform->set(1, 1, fScaleFactorY); + mpViewTransform->set(0, 2, fZeroPointX); + mpViewTransform->set(1, 2, fZeroPointY); + + return *mpViewTransform; +} + +basegfx::B2DHomMatrix CoordinateMapper::GetInverseViewTransformation() const +{ + if (!IsMapModeEnabled()) + return basegfx::B2DHomMatrix(); + + if (mpInverseViewTransform) + return *mpInverseViewTransform; + + GetViewTransformation(); + + mpInverseViewTransform = new basegfx::B2DHomMatrix(*mpViewTransform); + mpInverseViewTransform->invert(); + + return *mpInverseViewTransform; +} + +basegfx::B2DHomMatrix CoordinateMapper::GetViewTransformation(const MapMode& rMapMode) const +{ + // #i82615# + ImplMapRes aMapRes; + aMapRes.CalcMapResolution(rMapMode, GetDPIX(), GetDPIY()); + + basegfx::B2DHomMatrix aTransform; + + const double fScaleFactorX(static_cast(GetDPIX()) * aMapRes.mfMapScX); + const double fScaleFactorY(static_cast(GetDPIY()) * aMapRes.mfMapScY); + const double fZeroPointX((static_cast(aMapRes.mnMapOfsX) * fScaleFactorX) + + static_cast(GetPixelXOffset())); + const double fZeroPointY((static_cast(aMapRes.mnMapOfsY) * fScaleFactorY) + + static_cast(GetPixelYOffset())); + + aTransform.set(0, 0, fScaleFactorX); + aTransform.set(1, 1, fScaleFactorY); + aTransform.set(0, 2, fZeroPointX); + aTransform.set(1, 2, fZeroPointY); + + return aTransform; +} + +basegfx::B2DHomMatrix CoordinateMapper::GetInverseViewTransformation(const MapMode& rMapMode) const +{ + basegfx::B2DHomMatrix aMatrix(GetViewTransformation(rMapMode)); + aMatrix.invert(); + return aMatrix; +} + +tools::Long CoordinateMapper::LogicToOffsetLogicX(tools::Long nX) const +{ + return nX + maMapRes.mnMapOfsX; +} + +tools::Long CoordinateMapper::LogicToOffsetLogicY(tools::Long nY) const +{ + return nY + maMapRes.mnMapOfsY; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx index 0584b19c9d98..240ab3baecfd 100644 --- a/vcl/source/outdev/bitmap.cxx +++ b/vcl/source/outdev/bitmap.cxx @@ -299,7 +299,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const tools::Long nY = ImplLogicYToDevicePixel( rSrcPt.Y() ); tools::Long nWidth = LogicWidthToDevicePixel(rSize.Width()); tools::Long nHeight = LogicHeightToDevicePixel(rSize.Height()); - if ( nWidth <= 0 || nHeight <= 0 || nX > (GetOutputWidthPixel() + GetDeviceOriginX()) || nY > (GetOutputHeightPixel() + GetOutOffYPixel())) + if ( nWidth <= 0 || nHeight <= 0 || nX > (GetOutputWidthPixel() + GetDeviceOriginX()) || nY > (GetOutputHeightPixel() + GetDeviceOriginY())) return Bitmap(); tools::Rectangle aRect( Point( nX, nY ), Size( nWidth, nHeight ) ); @@ -314,10 +314,10 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const } // Y-Coordinate outside of draw area? - if ( nY < GetOutOffYPixel() ) + if ( nY < GetDeviceOriginY() ) { - nHeight -= ( GetOutOffYPixel() - nY ); - nY = GetOutOffYPixel(); + nHeight -= ( GetDeviceOriginY() - nY ); + nY = GetDeviceOriginY(); bClipped = true; } @@ -329,9 +329,9 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const } // Height outside of draw area? - if ( (nHeight + nY) > (GetOutputHeightPixel() + GetOutOffYPixel()) ) + if ( (nHeight + nY) > (GetOutputHeightPixel() + GetDeviceOriginY()) ) { - nHeight = GetOutOffYPixel() + GetOutputHeightPixel() - nY; + nHeight = GetDeviceOriginY() + GetOutputHeightPixel() - nY; bClipped = true; } @@ -350,7 +350,7 @@ Bitmap OutputDevice::GetBitmap( const Point& rSrcPt, const Size& rSize ) const { SalTwoRect aPosAry(nX, nY, nWidth, nHeight, (aRect.Left() < GetDeviceOriginX()) ? (GetDeviceOriginX() - aRect.Left()) : 0L, - (aRect.Top() < GetOutOffYPixel()) ? (GetOutOffYPixel() - aRect.Top()) : 0L, + (aRect.Top() < GetDeviceOriginY()) ? (GetDeviceOriginY() - aRect.Top()) : 0L, nWidth, nHeight); aVDev->mpGraphics->CopyBits(aPosAry, *mpGraphics, *this, *this); } @@ -413,7 +413,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, if (aDstRect.Intersection(tools::Rectangle(aOutPt, aOutSz)).IsEmpty()) return; - Point aRelPt = aOutPt + Point(GetDeviceOriginX(), GetOutOffYPixel()); + Point aRelPt = aOutPt + Point(GetDeviceOriginX(), GetDeviceOriginY()); SalTwoRect aTR( rSrcPtPixel.X(), rSrcPtPixel.Y(), rSrcSizePixel.Width(), rSrcSizePixel.Height(), diff --git a/vcl/source/outdev/bitmapex.cxx b/vcl/source/outdev/bitmapex.cxx index 835e1a933464..84a506f3fe5b 100644 --- a/vcl/source/outdev/bitmapex.cxx +++ b/vcl/source/outdev/bitmapex.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -239,7 +240,7 @@ void OutputDevice::DrawTransformedBitmapEx( // tdf#130768 CAUTION(!) using GetViewTransformation() is *not* enough here, it may // be that mnOutOffX/mnOutOffY is used - see AOO bug 75163, mentioned at // ImplGetDeviceTransformation declaration - basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rTransformation); + basegfx::B2DHomMatrix aFullTransform(mpMapper->GetDeviceTransformation() * rTransformation); // First try to handle additional alpha blending, either directly, or modify the bitmap. if(!rtl::math::approxEqual( fAlpha, 1.0 )) diff --git a/vcl/source/outdev/clipping.cxx b/vcl/source/outdev/clipping.cxx index eec0d1111c78..e5f39eea27b4 100644 --- a/vcl/source/outdev/clipping.cxx +++ b/vcl/source/outdev/clipping.cxx @@ -164,9 +164,9 @@ void OutputDevice::InitClipRegion() vcl::Region OutputDevice::ClipToDeviceBounds(vcl::Region aRegion) const { aRegion.Intersect(tools::Rectangle{GetDeviceOriginX(), - GetOutOffYPixel(), + GetDeviceOriginY(), GetDeviceOriginX() + GetOutputWidthPixel() - 1, - GetOutOffYPixel() + GetOutputHeightPixel() - 1 + GetDeviceOriginY() + GetOutputHeightPixel() - 1 }); return aRegion; } diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx index bb282401cdcf..e3a974f930b1 100644 --- a/vcl/source/outdev/font.cxx +++ b/vcl/source/outdev/font.cxx @@ -885,7 +885,7 @@ void OutputDevice::ImplDrawEmphasisMark( tools::Long nBaseX, tools::Long nX, too nX = nBaseX - (nX - nBaseX - 1); nX -= GetDeviceOriginX(); - nY -= GetOutOffYPixel(); + nY -= GetDeviceOriginY(); if ( rPolyPoly.Count() ) { diff --git a/vcl/source/outdev/line.cxx b/vcl/source/outdev/line.cxx index 40520b8ef4bb..bbe0822976c9 100644 --- a/vcl/source/outdev/line.cxx +++ b/vcl/source/outdev/line.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -166,7 +167,7 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt ) { // at least transform with double precision to device coordinates; this will // avoid pixel snap of single, appended lines - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation()); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation()); basegfx::B2DPolygon aB2DPolyLine; aB2DPolyLine.append(basegfx::B2DPoint(rStartPt.X(), rStartPt.Y())); diff --git a/vcl/source/outdev/map.cxx b/vcl/source/outdev/map.cxx index 4f8ca9210f8b..7fcce79a91ee 100644 --- a/vcl/source/outdev/map.cxx +++ b/vcl/source/outdev/map.cxx @@ -39,25 +39,6 @@ #include #include -// #i75163# -void OutputDevice::ImplInvalidateViewTransform() -{ - if(!mpOutDevData) - return; - - if(mpOutDevData->mpViewTransform) - { - delete mpOutDevData->mpViewTransform; - mpOutDevData->mpViewTransform = nullptr; - } - - if(mpOutDevData->mpInverseViewTransform) - { - delete mpOutDevData->mpInverseViewTransform; - mpOutDevData->mpInverseViewTransform = nullptr; - } -} - static tools::Long lcl_logicToPixel(tools::Long n, tools::Long nDPI, double fMap) { assert(nDPI > 0); @@ -105,17 +86,15 @@ tools::Long OutputDevice::ImplLogicXToDevicePixel( tools::Long nX ) const if ( !mpMapper->IsMapModeEnabled() ) return nX+GetDeviceOriginX(); - return lcl_logicToPixel( nX + mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(); + return lcl_logicToPixel(mpMapper->LogicToOffsetLogicX(nX), GetDPIX(), mpMapper->GetMapResolutionScaleX()) + GetDeviceOriginX() + mpMapper->GetPixelXOffset(); } tools::Long OutputDevice::ImplLogicYToDevicePixel( tools::Long nY ) const { if ( !mpMapper->IsMapModeEnabled() ) - return nY+GetOutOffYPixel(); + return nY+GetDeviceOriginY(); - return lcl_logicToPixel( nY + mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset(); + return lcl_logicToPixel(mpMapper->LogicToOffsetLogicY(nY), GetDPIY(), mpMapper->GetMapResolutionScaleY()) + GetDeviceOriginY() + mpMapper->GetPixelYOffset(); } tools::Long OutputDevice::LogicWidthToDevicePixel(tools::Long nWidth) const @@ -169,12 +148,10 @@ double OutputDevice::ImplDevicePixelToLogicHeightDouble(double nHeight) const Point OutputDevice::LogicToDevicePixel(const Point& rLogicPt) const { if ( !mpMapper->IsMapModeEnabled() ) - return Point( rLogicPt.X()+GetDeviceOriginX(), rLogicPt.Y()+GetOutOffYPixel() ); + return Point( rLogicPt.X()+GetDeviceOriginX(), rLogicPt.Y()+GetDeviceOriginY() ); - return Point( lcl_logicToPixel( rLogicPt.X() + mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( rLogicPt.Y() + mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset() ); + return Point(lcl_logicToPixel(rLogicPt.X() + mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX()) + GetDeviceOriginX() + mpMapper->GetPixelXOffset(), + lcl_logicToPixel(rLogicPt.Y() + mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY()) + GetDeviceOriginY() + mpMapper->GetPixelYOffset()); } Size OutputDevice::ImplLogicToDevicePixel( const Size& rLogicSize ) const @@ -182,10 +159,8 @@ Size OutputDevice::ImplLogicToDevicePixel( const Size& rLogicSize ) const if ( !mpMapper->IsMapModeEnabled() ) return rLogicSize; - return Size( lcl_logicToPixel( rLogicSize.Width(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() ), - lcl_logicToPixel( rLogicSize.Height(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() ) ); + return Size(lcl_logicToPixel(rLogicSize.Width(), GetDPIX(), mpMapper->GetMapResolutionScaleX()), + lcl_logicToPixel(rLogicSize.Height(), GetDPIY(), mpMapper->GetMapResolutionScaleY())); } tools::Rectangle OutputDevice::LogicToDevicePixel(const tools::Rectangle& rLogicRect) const @@ -212,17 +187,17 @@ tools::Rectangle OutputDevice::LogicToDevicePixel(const tools::Rectangle& rLogic { aRetval = tools::Rectangle( rLogicRect.Left()+GetDeviceOriginX(), - rLogicRect.Top()+GetOutOffYPixel(), + rLogicRect.Top()+GetDeviceOriginY(), rLogicRect.IsWidthEmpty() ? 0 : rLogicRect.Right()+GetDeviceOriginX(), - rLogicRect.IsHeightEmpty() ? 0 : rLogicRect.Bottom()+GetOutOffYPixel() ); + rLogicRect.IsHeightEmpty() ? 0 : rLogicRect.Bottom()+GetDeviceOriginY() ); } else { aRetval = tools::Rectangle( lcl_logicToPixel( rLogicRect.Left()+mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( rLogicRect.Top()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset(), + lcl_logicToPixel( rLogicRect.Top()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetDeviceOriginY()+mpMapper->GetPixelYOffset(), rLogicRect.IsWidthEmpty() ? 0 : lcl_logicToPixel( rLogicRect.Right()+mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - rLogicRect.IsHeightEmpty() ? 0 : lcl_logicToPixel( rLogicRect.Bottom()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset() ); + rLogicRect.IsHeightEmpty() ? 0 : lcl_logicToPixel( rLogicRect.Bottom()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetDeviceOriginY()+mpMapper->GetPixelYOffset() ); } if(rLogicRect.IsWidthEmpty()) @@ -236,7 +211,7 @@ tools::Rectangle OutputDevice::LogicToDevicePixel(const tools::Rectangle& rLogic tools::Polygon OutputDevice::ImplLogicToDevicePixel( const tools::Polygon& rLogicPoly ) const { - if ( !mpMapper->IsMapModeEnabled() && !GetDeviceOriginX() && !GetOutOffYPixel() ) + if ( !mpMapper->IsMapModeEnabled() && !GetDeviceOriginX() && !GetDeviceOriginY() ) return rLogicPoly; const sal_uInt16 nPoints = rLogicPoly.GetSize(); @@ -250,10 +225,8 @@ tools::Polygon OutputDevice::ImplLogicToDevicePixel( const tools::Polygon& rLogi for (sal_uInt16 i = 0; i < nPoints; i++) { const Point& rPt = pPointAry[i]; - Point aPt(lcl_logicToPixel( rPt.X()+mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( rPt.Y()+mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset()); + Point aPt(lcl_logicToPixel(rPt.X()+mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX())+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), + lcl_logicToPixel(rPt.Y()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY())+GetDeviceOriginY()+mpMapper->GetPixelYOffset()); aPoly[i] = aPt; } } @@ -263,7 +236,7 @@ tools::Polygon OutputDevice::ImplLogicToDevicePixel( const tools::Polygon& rLogi { Point aPt = pPointAry[i]; aPt.AdjustX(GetDeviceOriginX() ); - aPt.AdjustY(GetOutOffYPixel() ); + aPt.AdjustY(GetDeviceOriginY() ); aPoly[i] = aPt; } } @@ -273,7 +246,7 @@ tools::Polygon OutputDevice::ImplLogicToDevicePixel( const tools::Polygon& rLogi basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolygon& rLogicPoly) const { - if (!mpMapper->IsMapModeEnabled() && !GetDeviceOriginX() && !GetOutOffYPixel()) + if (!mpMapper->IsMapModeEnabled() && !GetDeviceOriginX() && !GetDeviceOriginY()) return rLogicPoly; const sal_uInt32 nPoints = rLogicPoly.count(); @@ -287,20 +260,16 @@ basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolyg for (sal_uInt32 i = 0; i < nPoints; ++i) { const basegfx::B2DPoint& rPt = aPoly.getB2DPoint(i); - basegfx::B2DPoint aPt(lcl_logicToPixel( rPt.getX()+mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( rPt.getY()+mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset()); + basegfx::B2DPoint aPt(lcl_logicToPixel( rPt.getX()+mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), + lcl_logicToPixel( rPt.getY()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetDeviceOriginY()+mpMapper->GetPixelYOffset()); const bool bC1 = aPoly.isPrevControlPointUsed(i); if (bC1) { const basegfx::B2DPoint aB2DC1(aPoly.getPrevControlPoint(i)); - aC1 = basegfx::B2DPoint(lcl_logicToPixel( aB2DC1.getX()+mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( aB2DC1.getY()+mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset()); + aC1 = basegfx::B2DPoint(lcl_logicToPixel( aB2DC1.getX()+mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), + lcl_logicToPixel( aB2DC1.getY()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetDeviceOriginY()+mpMapper->GetPixelYOffset()); } const bool bC2 = aPoly.isNextControlPointUsed(i); @@ -308,10 +277,8 @@ basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolyg { const basegfx::B2DPoint aB2DC2(aPoly.getNextControlPoint(i)); - aC2 = basegfx::B2DPoint(lcl_logicToPixel( aB2DC2.getX()+mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( aB2DC2.getY()+mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+GetOutOffYPixel()+mpMapper->GetPixelYOffset()); + aC2 = basegfx::B2DPoint(lcl_logicToPixel( aB2DC2.getX()+mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+GetDeviceOriginX()+mpMapper->GetPixelXOffset(), + lcl_logicToPixel( aB2DC2.getY()+mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+GetDeviceOriginY()+mpMapper->GetPixelYOffset()); } aPoly.setB2DPoint(i, aPt); @@ -329,14 +296,14 @@ basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolyg for (sal_uInt32 i = 0; i < nPoints; ++i) { const basegfx::B2DPoint& rPt = aPoly.getB2DPoint(i); - basegfx::B2DPoint aPt(rPt.getX() + GetDeviceOriginX(), rPt.getY() + GetOutOffYPixel()); + basegfx::B2DPoint aPt(rPt.getX() + GetDeviceOriginX(), rPt.getY() + GetDeviceOriginY()); const bool bC1 = aPoly.isPrevControlPointUsed(i); if (bC1) { const basegfx::B2DPoint aB2DC1(aPoly.getPrevControlPoint(i)); - aC1 = basegfx::B2DPoint(aB2DC1.getX() + GetDeviceOriginX(), aB2DC1.getY() + GetOutOffYPixel()); + aC1 = basegfx::B2DPoint(aB2DC1.getX() + GetDeviceOriginX(), aB2DC1.getY() + GetDeviceOriginY()); } const bool bC2 = aPoly.isNextControlPointUsed(i); @@ -344,7 +311,7 @@ basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolyg { const basegfx::B2DPoint aB2DC2(aPoly.getNextControlPoint(i)); - aC2 = basegfx::B2DPoint(aB2DC2.getX() + GetDeviceOriginX(), aB2DC2.getY() + GetOutOffYPixel()); + aC2 = basegfx::B2DPoint(aB2DC2.getX() + GetDeviceOriginX(), aB2DC2.getY() + GetDeviceOriginY()); } aPoly.setB2DPoint(i, aPt); @@ -361,7 +328,7 @@ basegfx::B2DPolygon OutputDevice::ImplLogicToDevicePixel(const basegfx::B2DPolyg tools::PolyPolygon OutputDevice::ImplLogicToDevicePixel( const tools::PolyPolygon& rLogicPolyPoly ) const { - if ( !mpMapper->IsMapModeEnabled() && !GetDeviceOriginX() && !GetOutOffYPixel() ) + if ( !mpMapper->IsMapModeEnabled() && !GetDeviceOriginX() && !GetDeviceOriginY() ) return rLogicPolyPoly; tools::PolyPolygon aPolyPoly( rLogicPolyPoly ); @@ -411,17 +378,17 @@ tools::Rectangle OutputDevice::ImplDevicePixelToLogic( const tools::Rectangle& r { aRetval = tools::Rectangle( rPixelRect.Left()-GetDeviceOriginX(), - rPixelRect.Top()-GetOutOffYPixel(), + rPixelRect.Top()-GetDeviceOriginY(), rPixelRect.IsWidthEmpty() ? 0 : rPixelRect.Right()-GetDeviceOriginX(), - rPixelRect.IsHeightEmpty() ? 0 : rPixelRect.Bottom()-GetOutOffYPixel() ); + rPixelRect.IsHeightEmpty() ? 0 : rPixelRect.Bottom()-GetDeviceOriginY() ); } else { aRetval = tools::Rectangle( lcl_pixelToLogic( rPixelRect.Left()-GetDeviceOriginX()-mpMapper->GetPixelXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )-mpMapper->GetMappingXOffset(), - lcl_pixelToLogic( rPixelRect.Top()-GetOutOffYPixel()-mpMapper->GetPixelYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )-mpMapper->GetMappingYOffset(), + lcl_pixelToLogic( rPixelRect.Top()-GetDeviceOriginY()-mpMapper->GetPixelYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )-mpMapper->GetMappingYOffset(), rPixelRect.IsWidthEmpty() ? 0 : lcl_pixelToLogic( rPixelRect.Right()-GetDeviceOriginX()-mpMapper->GetPixelXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )-mpMapper->GetMappingXOffset(), - rPixelRect.IsHeightEmpty() ? 0 : lcl_pixelToLogic( rPixelRect.Bottom()-GetOutOffYPixel()-mpMapper->GetPixelYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )-mpMapper->GetMappingYOffset() ); + rPixelRect.IsHeightEmpty() ? 0 : lcl_pixelToLogic( rPixelRect.Bottom()-GetDeviceOriginY()-mpMapper->GetPixelYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )-mpMapper->GetMappingYOffset() ); } if(rPixelRect.IsWidthEmpty()) @@ -435,11 +402,11 @@ tools::Rectangle OutputDevice::ImplDevicePixelToLogic( const tools::Rectangle& r vcl::Region OutputDevice::ImplPixelToDevicePixel( const vcl::Region& rRegion ) const { - if ( !GetDeviceOriginX() && !GetOutOffYPixel() ) + if ( !GetDeviceOriginX() && !GetDeviceOriginY() ) return rRegion; vcl::Region aRegion( rRegion ); - aRegion.Move( GetDeviceOriginX()+mpMapper->GetPixelXOffset(), GetOutOffYPixel()+mpMapper->GetPixelYOffset() ); + aRegion.Move( GetDeviceOriginX()+mpMapper->GetPixelXOffset(), GetDeviceOriginY()+mpMapper->GetPixelYOffset() ); return aRegion; } @@ -455,7 +422,7 @@ Size OutputDevice::GetOutputSizePixel() const { return Size(GetOutputWidthPixel( tools::Long OutputDevice::GetDeviceOriginX() const { return mpMapper->GetDeviceOriginX(); } -tools::Long OutputDevice::GetOutOffYPixel() const { return mpMapper->GetOutOffYPixel(); } +tools::Long OutputDevice::GetDeviceOriginY() const { return mpMapper->GetDeviceOriginY(); } void OutputDevice::SetDeviceOriginX(tools::Long nOutOffX) { return mpMapper->SetDeviceOriginX(nOutOffX); } @@ -491,7 +458,7 @@ void OutputDevice::SetMapMode() mpMapper->SetLogicalOffset(Size(mpMapper->GetPixelXOffset(), mpMapper->GetPixelYOffset())); // #i75163# - ImplInvalidateViewTransform(); + mpMapper->InvalidateViewTransform(); } void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) @@ -526,7 +493,7 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) mpMapper->ResetMapMode(rNewMapMode); // #i75163# - ImplInvalidateViewTransform(); + mpMapper->InvalidateViewTransform(); return; } @@ -564,7 +531,7 @@ void OutputDevice::SetMapMode( const MapMode& rNewMapMode ) lcl_pixelToLogic(mpMapper->GetPixelYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY()))); // #i75163# - ImplInvalidateViewTransform(); + mpMapper->InvalidateViewTransform(); } void OutputDevice::SetMetafileMapMode(const MapMode& rNewMapMode, bool bIsRecord) @@ -634,95 +601,14 @@ void OutputDevice::SetRelativeMapMode( const MapMode& rNewMapMode ) lcl_pixelToLogic(mpMapper->GetPixelYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY()))); } -// #i75163# -basegfx::B2DHomMatrix OutputDevice::GetViewTransformation() const -{ - if (!mpMapper->IsMapModeEnabled() || !mpOutDevData) - return basegfx::B2DHomMatrix(); - - if(!mpOutDevData->mpViewTransform) - { - mpOutDevData->mpViewTransform = new basegfx::B2DHomMatrix; - - const double fScaleFactorX(static_cast(GetDPIX()) * mpMapper->GetMapResolutionScaleX()); - const double fScaleFactorY(static_cast(GetDPIY()) * mpMapper->GetMapResolutionScaleY()); - const double fZeroPointX((static_cast(mpMapper->GetMappingXOffset()) * fScaleFactorX) + static_cast(mpMapper->GetPixelXOffset())); - const double fZeroPointY((static_cast(mpMapper->GetMappingYOffset()) * fScaleFactorY) + static_cast(mpMapper->GetPixelYOffset())); - - mpOutDevData->mpViewTransform->set(0, 0, fScaleFactorX); - mpOutDevData->mpViewTransform->set(1, 1, fScaleFactorY); - mpOutDevData->mpViewTransform->set(0, 2, fZeroPointX); - mpOutDevData->mpViewTransform->set(1, 2, fZeroPointY); - } - - return *mpOutDevData->mpViewTransform; -} - -// #i75163# -basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation() const -{ - if (!mpMapper->IsMapModeEnabled() || !mpOutDevData) - return basegfx::B2DHomMatrix(); - - if(!mpOutDevData->mpInverseViewTransform) - { - GetViewTransformation(); - mpOutDevData->mpInverseViewTransform = new basegfx::B2DHomMatrix(*mpOutDevData->mpViewTransform); - mpOutDevData->mpInverseViewTransform->invert(); - } - - return *mpOutDevData->mpInverseViewTransform; -} - -// #i75163# -basegfx::B2DHomMatrix OutputDevice::GetViewTransformation( const MapMode& rMapMode ) const -{ - // #i82615# - ImplMapRes aMapRes; - aMapRes.CalcMapResolution(rMapMode, GetDPIX(), GetDPIY()); - - basegfx::B2DHomMatrix aTransform; - - const double fScaleFactorX(static_cast(GetDPIX()) * aMapRes.mfMapScX); - const double fScaleFactorY(static_cast(GetDPIY()) * aMapRes.mfMapScY); - const double fZeroPointX((static_cast(aMapRes.mnMapOfsX) * fScaleFactorX) + static_cast(mpMapper->GetPixelXOffset())); - const double fZeroPointY((static_cast(aMapRes.mnMapOfsY) * fScaleFactorY) + static_cast(mpMapper->GetPixelYOffset())); - - aTransform.set(0, 0, fScaleFactorX); - aTransform.set(1, 1, fScaleFactorY); - aTransform.set(0, 2, fZeroPointX); - aTransform.set(1, 2, fZeroPointY); - - return aTransform; -} - -// #i75163# -basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation( const MapMode& rMapMode ) const -{ - basegfx::B2DHomMatrix aMatrix( GetViewTransformation( rMapMode ) ); - aMatrix.invert(); - return aMatrix; -} - -basegfx::B2DHomMatrix OutputDevice::ImplGetDeviceTransformation() const -{ - basegfx::B2DHomMatrix aTransformation = GetViewTransformation(); - // TODO: is it worth to cache the transformed result? - if( GetDeviceOriginX() || GetOutOffYPixel() ) - aTransformation.translate( GetDeviceOriginX(), GetOutOffYPixel() ); - return aTransformation; -} - Point OutputDevice::LogicToPixel( const Point& rLogicPt ) const { if ( !mpMapper->IsMapModeEnabled() ) return rLogicPt; - return Point( lcl_logicToPixel( rLogicPt.X() + mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( rLogicPt.Y() + mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+mpMapper->GetPixelYOffset() ); + return Point( lcl_logicToPixel( rLogicPt.X() + mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+mpMapper->GetPixelXOffset(), + lcl_logicToPixel( rLogicPt.Y() + mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+mpMapper->GetPixelYOffset() ); } Size OutputDevice::LogicToPixel( const Size& rLogicSize ) const @@ -731,10 +617,8 @@ Size OutputDevice::LogicToPixel( const Size& rLogicSize ) const if ( !mpMapper->IsMapModeEnabled() ) return rLogicSize; - return Size( lcl_logicToPixel( rLogicSize.Width(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() ), - lcl_logicToPixel( rLogicSize.Height(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() ) ); + return Size( lcl_logicToPixel( rLogicSize.Width(), GetDPIX(), mpMapper->GetMapResolutionScaleX() ), + lcl_logicToPixel( rLogicSize.Height(), GetDPIY(), mpMapper->GetMapResolutionScaleY() ) ); } tools::Rectangle OutputDevice::LogicToPixel( const tools::Rectangle& rLogicRect ) const @@ -774,10 +658,8 @@ tools::Polygon OutputDevice::LogicToPixel( const tools::Polygon& rLogicPoly ) co { const Point* pPt = &(pPointAry[i]); Point aPt; - aPt.setX( lcl_logicToPixel( pPt->X() + mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() )+mpMapper->GetPixelXOffset() ); - aPt.setY( lcl_logicToPixel( pPt->Y() + mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() )+mpMapper->GetPixelYOffset() ); + aPt.setX( lcl_logicToPixel( pPt->X() + mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX() )+mpMapper->GetPixelXOffset() ); + aPt.setY( lcl_logicToPixel( pPt->Y() + mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY() )+mpMapper->GetPixelYOffset() ); aPoly[i] = aPt; } @@ -804,7 +686,7 @@ tools::PolyPolygon OutputDevice::LogicToPixel( const tools::PolyPolygon& rLogicP basegfx::B2DPolyPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolyPolygon& rLogicPolyPoly ) const { basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly; - const basegfx::B2DHomMatrix aTransformationMatrix = GetViewTransformation(); + const basegfx::B2DHomMatrix aTransformationMatrix = mpMapper->GetViewTransformation(); aTransformedPoly.transform( aTransformationMatrix ); return aTransformedPoly; } @@ -854,10 +736,8 @@ Point OutputDevice::LogicToPixel( const Point& rLogicPt, ImplMapRes aMapRes; aMapRes.CalcMapResolution(rMapMode, GetDPIX(), GetDPIY()); - return Point( lcl_logicToPixel( rLogicPt.X() + aMapRes.mnMapOfsX, GetDPIX(), - aMapRes.mfMapScX )+mpMapper->GetPixelXOffset(), - lcl_logicToPixel( rLogicPt.Y() + aMapRes.mnMapOfsY, GetDPIY(), - aMapRes.mfMapScY )+mpMapper->GetPixelYOffset() ); + return Point(lcl_logicToPixel(rLogicPt.X() + aMapRes.mnMapOfsX, GetDPIX(), aMapRes.mfMapScX )+mpMapper->GetPixelXOffset(), + lcl_logicToPixel(rLogicPt.Y() + aMapRes.mnMapOfsY, GetDPIY(), aMapRes.mfMapScY )+mpMapper->GetPixelYOffset()); } Size OutputDevice::LogicToPixel( const Size& rLogicSize, @@ -924,10 +804,8 @@ tools::Polygon OutputDevice::LogicToPixel( const tools::Polygon& rLogicPoly, { const Point* pPt = &(pPointAry[i]); Point aPt; - aPt.setX( lcl_logicToPixel( pPt->X() + aMapRes.mnMapOfsX, GetDPIX(), - aMapRes.mfMapScX )+mpMapper->GetPixelXOffset() ); - aPt.setY( lcl_logicToPixel( pPt->Y() + aMapRes.mnMapOfsY, GetDPIY(), - aMapRes.mfMapScY )+mpMapper->GetPixelYOffset() ); + aPt.setX( lcl_logicToPixel( pPt->X() + aMapRes.mnMapOfsX, GetDPIX(), aMapRes.mfMapScX )+mpMapper->GetPixelXOffset() ); + aPt.setY( lcl_logicToPixel( pPt->Y() + aMapRes.mnMapOfsY, GetDPIY(), aMapRes.mfMapScY )+mpMapper->GetPixelYOffset() ); aPoly[i] = aPt; } @@ -938,7 +816,7 @@ basegfx::B2DPolyPolygon OutputDevice::LogicToPixel( const basegfx::B2DPolyPolygo const MapMode& rMapMode ) const { basegfx::B2DPolyPolygon aTransformedPoly = rLogicPolyPoly; - const basegfx::B2DHomMatrix aTransformationMatrix = GetViewTransformation( rMapMode ); + const basegfx::B2DHomMatrix aTransformationMatrix = mpMapper->GetViewTransformation( rMapMode ); aTransformedPoly.transform( aTransformationMatrix ); return aTransformedPoly; } @@ -949,10 +827,8 @@ Point OutputDevice::PixelToLogic( const Point& rDevicePt ) const if ( !mpMapper->IsMapModeEnabled() ) return rDevicePt; - return Point( lcl_pixelToLogic( rDevicePt.X(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() ) - mpMapper->GetMappingXOffset() - mpMapper->GetLogicalXOffset(), - lcl_pixelToLogic( rDevicePt.Y(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() ) - mpMapper->GetMappingYOffset() - mpMapper->GetLogicalYOffset() ); + return Point( lcl_pixelToLogic( rDevicePt.X(), GetDPIX(), mpMapper->GetMapResolutionScaleX() ) - mpMapper->GetMappingXOffset() - mpMapper->GetLogicalXOffset(), + lcl_pixelToLogic( rDevicePt.Y(), GetDPIY(), mpMapper->GetMapResolutionScaleY() ) - mpMapper->GetMappingYOffset() - mpMapper->GetLogicalYOffset() ); } Point OutputDevice::SubPixelToLogic(const basegfx::B2DPoint& rDevicePt) const @@ -963,10 +839,8 @@ Point OutputDevice::SubPixelToLogic(const basegfx::B2DPoint& rDevicePt) const return Point(rDevicePt.getX(), rDevicePt.getY()); } - return Point(ImplSubPixelToLogic(rDevicePt.getX(), GetDPIX(), - mpMapper->GetMapResolutionScaleX()) - mpMapper->GetMappingXOffset() - mpMapper->GetLogicalXOffset(), - ImplSubPixelToLogic(rDevicePt.getY(), GetDPIY(), - mpMapper->GetMapResolutionScaleY()) - mpMapper->GetMappingYOffset() - mpMapper->GetLogicalYOffset()); + return Point(ImplSubPixelToLogic(rDevicePt.getX(), GetDPIX(), mpMapper->GetMapResolutionScaleX()) - mpMapper->GetMappingXOffset() - mpMapper->GetLogicalXOffset(), + ImplSubPixelToLogic(rDevicePt.getY(), GetDPIY(), mpMapper->GetMapResolutionScaleY()) - mpMapper->GetMappingYOffset() - mpMapper->GetLogicalYOffset()); } Size OutputDevice::PixelToLogic( const Size& rDeviceSize ) const @@ -975,10 +849,8 @@ Size OutputDevice::PixelToLogic( const Size& rDeviceSize ) const if ( !mpMapper->IsMapModeEnabled() ) return rDeviceSize; - return Size( lcl_pixelToLogic( rDeviceSize.Width(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() ), - lcl_pixelToLogic( rDeviceSize.Height(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() ) ); + return Size( lcl_pixelToLogic( rDeviceSize.Width(), GetDPIX(), mpMapper->GetMapResolutionScaleX() ), + lcl_pixelToLogic( rDeviceSize.Height(), GetDPIY(), mpMapper->GetMapResolutionScaleY() ) ); } tools::Rectangle OutputDevice::PixelToLogic( const tools::Rectangle& rDeviceRect ) const @@ -1018,10 +890,8 @@ tools::Polygon OutputDevice::PixelToLogic( const tools::Polygon& rDevicePoly ) c { const Point* pPt = &(pPointAry[i]); Point aPt; - aPt.setX( lcl_pixelToLogic( pPt->X(), GetDPIX(), - mpMapper->GetMapResolutionScaleX() ) - mpMapper->GetMappingXOffset() - mpMapper->GetLogicalXOffset() ); - aPt.setY( lcl_pixelToLogic( pPt->Y(), GetDPIY(), - mpMapper->GetMapResolutionScaleY() ) - mpMapper->GetMappingYOffset() - mpMapper->GetLogicalYOffset() ); + aPt.setX( lcl_pixelToLogic( pPt->X(), GetDPIX(), mpMapper->GetMapResolutionScaleX() ) - mpMapper->GetMappingXOffset() - mpMapper->GetLogicalXOffset() ); + aPt.setY( lcl_pixelToLogic( pPt->Y(), GetDPIY(), mpMapper->GetMapResolutionScaleY() ) - mpMapper->GetMappingYOffset() - mpMapper->GetLogicalYOffset() ); aPoly[i] = aPt; } @@ -1048,7 +918,7 @@ tools::PolyPolygon OutputDevice::PixelToLogic( const tools::PolyPolygon& rDevice basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygon& rPixelPolyPoly ) const { basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly; - const basegfx::B2DHomMatrix aTransformationMatrix = GetInverseViewTransformation(); + const basegfx::B2DHomMatrix aTransformationMatrix = mpMapper->GetInverseViewTransformation(); aTransformedPoly.transform( aTransformationMatrix ); return aTransformedPoly; } @@ -1056,7 +926,7 @@ basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygo basegfx::B2DRectangle OutputDevice::PixelToLogic(const basegfx::B2DRectangle& rDeviceRect) const { basegfx::B2DRectangle aTransformedRect = rDeviceRect; - const basegfx::B2DHomMatrix aTransformationMatrix = GetInverseViewTransformation(); + const basegfx::B2DHomMatrix aTransformationMatrix = mpMapper->GetInverseViewTransformation(); aTransformedRect.transform(aTransformationMatrix); return aTransformedRect; } @@ -1107,10 +977,8 @@ Point OutputDevice::PixelToLogic( const Point& rDevicePt, ImplMapRes aMapRes; aMapRes.CalcMapResolution(rMapMode, GetDPIX(), GetDPIY()); - return Point( lcl_pixelToLogic( rDevicePt.X(), GetDPIX(), - aMapRes.mfMapScX ) - aMapRes.mnMapOfsX - mpMapper->GetLogicalXOffset(), - lcl_pixelToLogic( rDevicePt.Y(), GetDPIY(), - aMapRes.mfMapScY ) - aMapRes.mnMapOfsY - mpMapper->GetLogicalYOffset() ); + return Point( lcl_pixelToLogic( rDevicePt.X(), GetDPIX(), aMapRes.mfMapScX ) - aMapRes.mnMapOfsX - mpMapper->GetLogicalXOffset(), + lcl_pixelToLogic( rDevicePt.Y(), GetDPIY(), aMapRes.mfMapScY ) - aMapRes.mnMapOfsY - mpMapper->GetLogicalYOffset() ); } Size OutputDevice::PixelToLogic( const Size& rDeviceSize, @@ -1125,10 +993,8 @@ Size OutputDevice::PixelToLogic( const Size& rDeviceSize, ImplMapRes aMapRes; aMapRes.CalcMapResolution(rMapMode, GetDPIX(), GetDPIY()); - return Size( lcl_pixelToLogic( rDeviceSize.Width(), GetDPIX(), - aMapRes.mfMapScX ), - lcl_pixelToLogic( rDeviceSize.Height(), GetDPIY(), - aMapRes.mfMapScY ) ); + return Size( lcl_pixelToLogic( rDeviceSize.Width(), GetDPIX(), aMapRes.mfMapScX ), + lcl_pixelToLogic( rDeviceSize.Height(), GetDPIY(), aMapRes.mfMapScY ) ); } tools::Rectangle OutputDevice::PixelToLogic( const tools::Rectangle& rDeviceRect, @@ -1192,7 +1058,7 @@ basegfx::B2DPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolygon& rPixe const MapMode& rMapMode ) const { basegfx::B2DPolygon aTransformedPoly = rPixelPoly; - const basegfx::B2DHomMatrix aTransformationMatrix = GetInverseViewTransformation( rMapMode ); + const basegfx::B2DHomMatrix aTransformationMatrix = mpMapper->GetInverseViewTransformation( rMapMode ); aTransformedPoly.transform( aTransformationMatrix ); return aTransformedPoly; } @@ -1201,7 +1067,7 @@ basegfx::B2DPolyPolygon OutputDevice::PixelToLogic( const basegfx::B2DPolyPolygo const MapMode& rMapMode ) const { basegfx::B2DPolyPolygon aTransformedPoly = rPixelPolyPoly; - const basegfx::B2DHomMatrix aTransformationMatrix = GetInverseViewTransformation( rMapMode ); + const basegfx::B2DHomMatrix aTransformationMatrix = mpMapper->GetInverseViewTransformation( rMapMode ); aTransformedPoly.transform( aTransformationMatrix ); return aTransformedPoly; } @@ -1296,12 +1162,8 @@ Point OutputDevice::LogicToLogic( const Point& rPtSource, ImplMapRes aMapResSource = mpMapper->ResolveMapRes(pMapModeSource); ImplMapRes aMapResDest = mpMapper->ResolveMapRes(pMapModeDest); - return Point( lcl_scaleLogicValue( rPtSource.X() + aMapResSource.mnMapOfsX, - aMapResSource.mfMapScX, aMapResDest.mfMapScX ) - - aMapResDest.mnMapOfsX, - lcl_scaleLogicValue( rPtSource.Y() + aMapResSource.mnMapOfsY, - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) - - aMapResDest.mnMapOfsY ); + return Point(lcl_scaleLogicValue(rPtSource.X() + aMapResSource.mnMapOfsX, aMapResSource.mfMapScX, aMapResDest.mfMapScX) - aMapResDest.mnMapOfsX, + lcl_scaleLogicValue(rPtSource.Y() + aMapResSource.mnMapOfsY, aMapResSource.mfMapScY, aMapResDest.mfMapScY) - aMapResDest.mnMapOfsY); } Size OutputDevice::LogicToLogic( const Size& rSzSource, @@ -1317,10 +1179,8 @@ Size OutputDevice::LogicToLogic( const Size& rSzSource, ImplMapRes aMapResSource = mpMapper->ResolveMapRes(pMapModeSource); ImplMapRes aMapResDest = mpMapper->ResolveMapRes(pMapModeDest); - return Size( lcl_scaleLogicValue( rSzSource.Width(), - aMapResSource.mfMapScX, aMapResDest.mfMapScX ), - lcl_scaleLogicValue( rSzSource.Height(), - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) ); + return Size(lcl_scaleLogicValue(rSzSource.Width(), aMapResSource.mfMapScX, aMapResDest.mfMapScX), + lcl_scaleLogicValue(rSzSource.Height(), aMapResSource.mfMapScY, aMapResDest.mfMapScY)); } tools::Rectangle OutputDevice::LogicToLogic( const tools::Rectangle& rRectSource, @@ -1336,18 +1196,10 @@ tools::Rectangle OutputDevice::LogicToLogic( const tools::Rectangle& rRectSource ImplMapRes aMapResSource = mpMapper->ResolveMapRes(pMapModeSource); ImplMapRes aMapResDest = mpMapper->ResolveMapRes(pMapModeDest); - return tools::Rectangle( lcl_scaleLogicValue( rRectSource.Left() + aMapResSource.mnMapOfsX, - aMapResSource.mfMapScX, aMapResDest.mfMapScX ) - - aMapResDest.mnMapOfsX, - lcl_scaleLogicValue( rRectSource.Top() + aMapResSource.mnMapOfsY, - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) - - aMapResDest.mnMapOfsY, - lcl_scaleLogicValue( rRectSource.Right() + aMapResSource.mnMapOfsX, - aMapResSource.mfMapScX, aMapResDest.mfMapScX ) - - aMapResDest.mnMapOfsX, - lcl_scaleLogicValue( rRectSource.Bottom() + aMapResSource.mnMapOfsY, - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) - - aMapResDest.mnMapOfsY ); + return tools::Rectangle(lcl_scaleLogicValue(rRectSource.Left() + aMapResSource.mnMapOfsX, aMapResSource.mfMapScX, aMapResDest.mfMapScX) - aMapResDest.mnMapOfsX, + lcl_scaleLogicValue(rRectSource.Top() + aMapResSource.mnMapOfsY, aMapResSource.mfMapScY, aMapResDest.mfMapScY) - aMapResDest.mnMapOfsY, + lcl_scaleLogicValue(rRectSource.Right() + aMapResSource.mnMapOfsX, aMapResSource.mfMapScX, aMapResDest.mfMapScX) - aMapResDest.mnMapOfsX, + lcl_scaleLogicValue(rRectSource.Bottom() + aMapResSource.mnMapOfsY, aMapResSource.mfMapScY, aMapResDest.mfMapScY) - aMapResDest.mnMapOfsY); } Point OutputDevice::LogicToLogic( const Point& rPtSource, @@ -1369,12 +1221,8 @@ Point OutputDevice::LogicToLogic( const Point& rPtSource, const auto [aMapResSource, aMapResDest] = lcl_calcConversionMapRes( rMapModeSource, rMapModeDest ); - return Point( lcl_scaleLogicValue( rPtSource.X() + aMapResSource.mnMapOfsX, - aMapResSource.mfMapScX, aMapResDest.mfMapScX ) - - aMapResDest.mnMapOfsX, - lcl_scaleLogicValue( rPtSource.Y() + aMapResSource.mnMapOfsY, - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) - - aMapResDest.mnMapOfsY ); + return Point(lcl_scaleLogicValue(rPtSource.X() + aMapResSource.mnMapOfsX, aMapResSource.mfMapScX, aMapResDest.mfMapScX) - aMapResDest.mnMapOfsX, + lcl_scaleLogicValue(rPtSource.Y() + aMapResSource.mnMapOfsY, aMapResSource.mfMapScY, aMapResDest.mfMapScY) - aMapResDest.mnMapOfsY); } Size OutputDevice::LogicToLogic( const Size& rSzSource, @@ -1488,20 +1336,14 @@ tools::Rectangle OutputDevice::LogicToLogic( const tools::Rectangle& rRectSource { const auto [aMapResSource, aMapResDest] = lcl_calcConversionMapRes( rMapModeSource, rMapModeDest ); - auto left = lcl_scaleLogicValue( rRectSource.Left() + aMapResSource.mnMapOfsX, - aMapResSource.mfMapScX, aMapResDest.mfMapScX ) - - aMapResDest.mnMapOfsX; - auto top = lcl_scaleLogicValue( rRectSource.Top() + aMapResSource.mnMapOfsY, - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) - - aMapResDest.mnMapOfsY; + auto left = lcl_scaleLogicValue(rRectSource.Left() + aMapResSource.mnMapOfsX, aMapResSource.mfMapScX, aMapResDest.mfMapScX) - aMapResDest.mnMapOfsX; + auto top = lcl_scaleLogicValue(rRectSource.Top() + aMapResSource.mnMapOfsY, aMapResSource.mfMapScY, aMapResDest.mfMapScY) - aMapResDest.mnMapOfsY; // tdf#141761 see comments above, IsEmpty() removed - auto right = rRectSource.IsWidthEmpty() ? 0 : lcl_scaleLogicValue( rRectSource.Right() + aMapResSource.mnMapOfsX, - aMapResSource.mfMapScX, aMapResDest.mfMapScX ) - - aMapResDest.mnMapOfsX; - auto bottom = rRectSource.IsHeightEmpty() ? 0 : lcl_scaleLogicValue( rRectSource.Bottom() + aMapResSource.mnMapOfsY, - aMapResSource.mfMapScY, aMapResDest.mfMapScY ) - - aMapResDest.mnMapOfsY; + auto right = rRectSource.IsWidthEmpty() ? 0 : + lcl_scaleLogicValue(rRectSource.Right() + aMapResSource.mnMapOfsX, aMapResSource.mfMapScX, aMapResDest.mfMapScX) - aMapResDest.mnMapOfsX; + auto bottom = rRectSource.IsHeightEmpty() ? 0 : + lcl_scaleLogicValue(rRectSource.Bottom() + aMapResSource.mnMapOfsY, aMapResSource.mfMapScY, aMapResDest.mfMapScY) - aMapResDest.mnMapOfsY; aRetval = tools::Rectangle(left, top, right, bottom); } @@ -1539,8 +1381,7 @@ double OutputDevice::LogicWidthToDeviceSubPixel(tools::Long nWidth) const if (!mpMapper->IsMapModeEnabled()) return nWidth; - return ImplLogicToSubPixel(nWidth, GetDPIX(), - mpMapper->GetMapResolutionScaleX()); + return ImplLogicToSubPixel(nWidth, GetDPIX(), mpMapper->GetMapResolutionScaleX()); } double OutputDevice::LogicHeightToDeviceSubPixel(tools::Long nHeight) const @@ -1548,21 +1389,36 @@ double OutputDevice::LogicHeightToDeviceSubPixel(tools::Long nHeight) const if (!mpMapper->IsMapModeEnabled()) return nHeight; - return ImplLogicToSubPixel(nHeight, GetDPIY(), - mpMapper->GetMapResolutionScaleY()); + return ImplLogicToSubPixel(nHeight, GetDPIY(), mpMapper->GetMapResolutionScaleY()); } basegfx::B2DPoint OutputDevice::LogicToDeviceSubPixel(const Point& rPoint) const { if (!mpMapper->IsMapModeEnabled()) - return basegfx::B2DPoint(rPoint.X() + GetDeviceOriginX(), rPoint.Y() + GetOutOffYPixel()); + return basegfx::B2DPoint(rPoint.X() + GetDeviceOriginX(), rPoint.Y() + GetDeviceOriginY()); - return basegfx::B2DPoint(ImplLogicToSubPixel(rPoint.X() + mpMapper->GetMappingXOffset(), GetDPIX(), - mpMapper->GetMapResolutionScaleX()) - + GetDeviceOriginX() + mpMapper->GetPixelXOffset(), - ImplLogicToSubPixel(rPoint.Y() + mpMapper->GetMappingYOffset(), GetDPIY(), - mpMapper->GetMapResolutionScaleY()) - + GetOutOffYPixel() + mpMapper->GetPixelYOffset()); + return basegfx::B2DPoint(ImplLogicToSubPixel(rPoint.X() + mpMapper->GetMappingXOffset(), GetDPIX(), mpMapper->GetMapResolutionScaleX()) + GetDeviceOriginX() + mpMapper->GetPixelXOffset(), + ImplLogicToSubPixel(rPoint.Y() + mpMapper->GetMappingYOffset(), GetDPIY(), mpMapper->GetMapResolutionScaleY()) + GetDeviceOriginY() + mpMapper->GetPixelYOffset()); +} + +basegfx::B2DHomMatrix OutputDevice::GetViewTransformation() const +{ + return mpMapper->GetViewTransformation(); +} + +basegfx::B2DHomMatrix OutputDevice::GetViewTransformation(const MapMode& rMapMode) const +{ + return mpMapper->GetViewTransformation(rMapMode); +} + +basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation() const +{ + return mpMapper->GetInverseViewTransformation(); +} + +basegfx::B2DHomMatrix OutputDevice::GetInverseViewTransformation(const MapMode& rMapMode) const +{ + return mpMapper->GetInverseViewTransformation(rMapMode); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index c2f2c9e3bc2c..ec6f53158acc 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -142,7 +142,7 @@ void OutputDevice::dispose() mpOutDevData->mpRotateDev.disposeAndClear(); // #i75163# - ImplInvalidateViewTransform(); + mpMapper->InvalidateViewTransform(); mpOutDevData.reset(); @@ -745,7 +745,7 @@ css::uno::Reference< css::rendering::XCanvas > OutputDevice::ImplGetCanvas( bool */ Sequence< Any > aArg{ Any(reinterpret_cast(this)), - Any(css::awt::Rectangle( GetDeviceOriginX(), GetOutOffYPixel(), GetOutputWidthPixel(), GetOutputHeightPixel() )), + Any(css::awt::Rectangle( GetDeviceOriginX(), GetDeviceOriginY(), GetOutputWidthPixel(), GetOutputHeightPixel() )), Any(false), Any(Reference< css::awt::XWindow >()), GetSystemGfxDataAny() diff --git a/vcl/source/outdev/polygon.cxx b/vcl/source/outdev/polygon.cxx index c21bfef4a606..d8550dffa539 100644 --- a/vcl/source/outdev/polygon.cxx +++ b/vcl/source/outdev/polygon.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ void OutputDevice::DrawPolyPolygon( const tools::PolyPolygon& rPolyPoly ) // use b2dpolygon drawing if possible if (RasterOp::OverPaint == GetRasterOp() && (IsLineColor() || IsFillColor())) { - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation()); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation()); basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPoly.getB2DPolyPolygon()); // ensure closed - may be asserted, will prevent buffering @@ -176,7 +177,7 @@ void OutputDevice::DrawPolygon( const tools::Polygon& rPoly ) // use b2dpolygon drawing if possible if (RasterOp::OverPaint == GetRasterOp() && (IsLineColor() || IsFillColor())) { - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation()); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation()); basegfx::B2DPolygon aB2DPolygon(rPoly.getB2DPolygon()); // ensure closed - maybe assert, hinders buffering @@ -278,7 +279,7 @@ void OutputDevice::ImplDrawPolyPolygonWithB2DPolyPolygon(const basegfx::B2DPolyP if (RasterOp::OverPaint == GetRasterOp() && (IsLineColor() || IsFillColor())) { - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation()); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation()); basegfx::B2DPolyPolygon aB2DPolyPolygon(rB2DPolyPoly); bSuccess = true; diff --git a/vcl/source/outdev/polyline.cxx b/vcl/source/outdev/polyline.cxx index 5d14bd0dbc5a..15a938e17acf 100644 --- a/vcl/source/outdev/polyline.cxx +++ b/vcl/source/outdev/polyline.cxx @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -64,7 +65,7 @@ void OutputDevice::DrawPolyLine( const tools::Polygon& rPoly ) } const basegfx::B2DPolygon aB2DPolyLine(rPoly.getB2DPolygon()); - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation()); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation()); const bool bPixelSnapHairline(mnAntialiasing & AntialiasingFlags::PixelSnapHairline); bool bDrawn = mpGraphics->DrawPolyLine( @@ -366,7 +367,7 @@ bool OutputDevice::DrawPolyLineDirectInternal( if(bTryB2d) { // combine rObjectTransform with WorldToDevice - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation() * rObjectTransform); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation() * rObjectTransform); const bool bPixelSnapHairline((mnAntialiasing & AntialiasingFlags::PixelSnapHairline) && rB2DPolygon.count() < 1000); // draw the polyline diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx index 13bfc68417d9..5702c4df4060 100644 --- a/vcl/source/outdev/text.cxx +++ b/vcl/source/outdev/text.cxx @@ -265,7 +265,7 @@ bool OutputDevice::ImplDrawRotateText( SalLayout& rSalLayout ) // mask output with text colored bitmap GDIMetaFile* pOldMetaFile = mpMetaFile; tools::Long nOldOffX = GetDeviceOriginX(); - tools::Long nOldOffY = GetOutOffYPixel(); + tools::Long nOldOffY = GetDeviceOriginY(); bool bOldMap = mpMapper->IsMapModeEnabled(); SetDeviceOriginX(0); @@ -1594,7 +1594,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta Point aTempPos = rTargetDevice.LogicToPixel( aPos ); nMnemonicX = rTargetDevice.GetDeviceOriginX() + aTempPos.X() + rTargetDevice.LogicWidthToDevicePixel(std::min(lc_x1, lc_x2)); - nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.LogicWidthToDevicePixel(rTargetDevice.GetFontMetric().GetAscent()); + nMnemonicY = rTargetDevice.GetDeviceOriginY() + aTempPos.Y() + rTargetDevice.LogicWidthToDevicePixel(rTargetDevice.GetFontMetric().GetAscent()); rTargetDevice.ImplDrawMnemonicLine( nMnemonicX, nMnemonicY, nMnemonicWidth ); } } @@ -1662,7 +1662,7 @@ void OutputDevice::ImplDrawText( OutputDevice& rTargetDevice, const tools::Recta Point aTempPos = rTargetDevice.LogicToPixel( aPos ); nMnemonicX = rTargetDevice.GetDeviceOriginX() + aTempPos.X() + rTargetDevice.LogicWidthToDevicePixel( std::min(lc_x1, lc_x2) ); - nMnemonicY = rTargetDevice.GetOutOffYPixel() + aTempPos.Y() + rTargetDevice.LogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); + nMnemonicY = rTargetDevice.GetDeviceOriginY() + aTempPos.Y() + rTargetDevice.LogicWidthToDevicePixel( rTargetDevice.GetFontMetric().GetAscent() ); } if ( nStyle & DrawTextFlags::Clip ) @@ -1968,7 +1968,7 @@ void OutputDevice::DrawCtrlText( const Point& rPos, const OUString& rStr, aTempPos += rPos; aTempPos = LogicToPixel( aTempPos ); nMnemonicX = GetDeviceOriginX() + aTempPos.X(); - nMnemonicY = GetOutOffYPixel() + aTempPos.Y(); + nMnemonicY = GetDeviceOriginY() + aTempPos.Y(); } else nMnemonicPos = -1; // Reset - we don't show the mnemonic diff --git a/vcl/source/outdev/transparent.cxx b/vcl/source/outdev/transparent.cxx index 17000b4d3d2a..65ccad248182 100644 --- a/vcl/source/outdev/transparent.cxx +++ b/vcl/source/outdev/transparent.cxx @@ -131,7 +131,7 @@ void OutputDevice::DrawTransparent( } // create ObjectToDevice transformation - const basegfx::B2DHomMatrix aFullTransform(ImplGetDeviceTransformation() * rObjectTransform); + const basegfx::B2DHomMatrix aFullTransform(mpMapper->GetDeviceTransformation() * rObjectTransform); // TODO: this must not drop transparency for mpAlphaVDev case, but instead use premultiplied // alpha... but that requires using premultiplied alpha also for already drawn data @@ -219,7 +219,7 @@ bool OutputDevice::DrawTransparentNatively ( const tools::PolyPolygon& rPolyPoly // get the polygon in device coordinates basegfx::B2DPolyPolygon aB2DPolyPolygon(rPolyPoly.getB2DPolyPolygon()); - const basegfx::B2DHomMatrix aTransform(ImplGetDeviceTransformation()); + const basegfx::B2DHomMatrix aTransform(mpMapper->GetDeviceTransformation()); const double fTransparency = 0.01 * nTransparencePercent; if( mbFillColor ) diff --git a/vcl/source/window/clipping.cxx b/vcl/source/window/clipping.cxx index 3576ad4bc9a4..a80e86b70b59 100644 --- a/vcl/source/window/clipping.cxx +++ b/vcl/source/window/clipping.cxx @@ -125,7 +125,7 @@ vcl::Region Window::GetWindowClipRegionPixel() const if ( aWinRegion == aWinClipRegion ) aWinClipRegion.SetNull(); - aWinClipRegion.Move( -GetOutDev()->GetDeviceOriginX(), -GetOutDev()->GetOutOffYPixel() ); + aWinClipRegion.Move( -GetOutDev()->GetDeviceOriginX(), -GetOutDev()->GetDeviceOriginY() ); return aWinClipRegion; } @@ -138,7 +138,7 @@ vcl::Region WindowOutputDevice::GetActiveClipRegion() const if ( mxOwnerWindow->mpWindowImpl->mbInPaint ) { aRegion = *(mxOwnerWindow->mpWindowImpl->mpPaintRegion); - aRegion.Move( -GetDeviceOriginX(), -GetOutOffYPixel() ); + aRegion.Move( -GetDeviceOriginX(), -GetDeviceOriginY() ); } if ( mbClipRegion ) @@ -325,7 +325,7 @@ bool Window::ImplSysObjClip( const vcl::Region* pOldRegion ) mpWindowImpl->mpSysObj->ResetClipRegion(); else { - aRegion.Move( -GetOutDev()->GetDeviceOriginX(), -GetOutDev()->GetOutOffYPixel() ); + aRegion.Move( -GetOutDev()->GetDeviceOriginX(), -GetOutDev()->GetDeviceOriginY() ); // set/update clip region RectangleVector aRectangles; @@ -676,7 +676,7 @@ void WindowOutputDevice::SaveBackground(VirtualDevice& rSaveDevice, const Point& vcl::Region aClip( *mxOwnerWindow->mpWindowImpl->mpPaintRegion ); const Point aPixPos( LogicToPixel( rPos ) ); - aClip.Move( -GetDeviceOriginX(), -GetOutOffYPixel() ); + aClip.Move( -GetDeviceOriginX(), -GetDeviceOriginY() ); aClip.Intersect( tools::Rectangle( aPixPos, LogicToPixel( rSize ) ) ); if ( !aClip.IsEmpty() ) diff --git a/vcl/source/window/cursor.cxx b/vcl/source/window/cursor.cxx index 737164277a6a..f5694b432307 100644 --- a/vcl/source/window/cursor.cxx +++ b/vcl/source/window/cursor.cxx @@ -274,7 +274,7 @@ tools::Rectangle calcualteCursorRect(Point const& rPosition, Size const rSize, v { Point aPositionPixel = pWindow->LogicToPixel(rPosition); const tools::Long nX = pWindow->GetDeviceOriginX() + aPositionPixel.X() - pParent->GetDeviceOriginX(); - const tools::Long nY = pWindow->GetOutOffYPixel() + aPositionPixel.Y() - pParent->GetOutOffYPixel(); + const tools::Long nY = pWindow->GetDeviceOriginY() + aPositionPixel.Y() - pParent->GetDeviceOriginY(); Size aSizePixel = pWindow->LogicToPixel(rSize); if (!aSizePixel.Width()) diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 22a6fc310e05..090cbb691d68 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -69,7 +69,7 @@ WindowHitTest Window::ImplHitTest( const Point& rFramePos ) { Point aTempPos = aFramePos; aTempPos.AdjustX( -GetOutDev()->GetDeviceOriginX() ); - aTempPos.AdjustY( -GetOutDev()->GetOutOffYPixel() ); + aTempPos.AdjustY( -GetOutDev()->GetDeviceOriginY() ); if ( !mpWindowImpl->maWinRegion.Contains( aTempPos ) ) return WindowHitTest::NONE; } diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index 6f668ffe8d47..1f1dc289c313 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -104,9 +104,9 @@ PaintBufferGuard::PaintBufferGuard(ImplFrameData* pFrameData, vcl::Window* pWind pFrameData->mpBuffer->SetDigitLanguage(rDev.GetDigitLanguage()); mnOutOffX = pFrameData->mpBuffer->GetDeviceOriginX(); - mnOutOffY = pFrameData->mpBuffer->GetOutOffYPixel(); + mnOutOffY = pFrameData->mpBuffer->GetDeviceOriginY(); pFrameData->mpBuffer->SetDeviceOriginX(pWindow->GetDeviceOriginX()); - pFrameData->mpBuffer->SetDeviceOriginY(pWindow->GetOutOffYPixel()); + pFrameData->mpBuffer->SetDeviceOriginY(pWindow->GetDeviceOriginY()); pFrameData->mpBuffer->EnableRTL(pWindow->IsRTLEnabled()); } @@ -985,7 +985,7 @@ vcl::Region Window::GetPaintRegion() const if ( mpWindowImpl->mpPaintRegion ) { vcl::Region aRegion = *mpWindowImpl->mpPaintRegion; - aRegion.Move( -GetOutDev()->GetDeviceOriginX(), -GetOutDev()->GetOutOffYPixel() ); + aRegion.Move( -GetOutDev()->GetDeviceOriginX(), -GetOutDev()->GetDeviceOriginY() ); return PixelToLogic( aRegion ); } else @@ -1097,7 +1097,7 @@ void Window::PixelInvalidate(const tools::Rectangle* pRectangle) // Added for dialog items. Pass invalidation to the parent window. else if (VclPtr pParent = GetParentWithLOKNotifier()) { - const tools::Rectangle aRect(Point(GetDeviceOriginX(), GetOutOffYPixel()), GetSizePixel()); + const tools::Rectangle aRect(Point(GetDeviceOriginX(), GetDeviceOriginY()), GetSizePixel()); pParent->PixelInvalidate(&aRect); } } @@ -1295,7 +1295,7 @@ void Window::ImplPaintToDevice(OutputDevice& rTargetOutDev, const Point& i_rPos) if( bHasMirroredGraphics ) nDeltaX = GetOutDev()->GetOutputWidthPixel() - nDeltaX - pChild->GetOutDev()->GetOutputWidthPixel(); - tools::Long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); + tools::Long nDeltaY = pChild->GetDeviceOriginY() - GetDeviceOriginY(); Point aPos( i_rPos ); aPos += Point(nDeltaX, nDeltaY); @@ -1415,7 +1415,7 @@ void Window::ImplPaintToDevice(OutputDevice& rTargetOutDev, const Point& i_rPos) if( pOutDev->HasMirroredGraphics() ) nDeltaX = GetOutDev()->GetOutputWidthPixel() - nDeltaX - pChild->GetOutDev()->GetOutputWidthPixel(); - tools::Long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); + tools::Long nDeltaY = pChild->GetDeviceOriginY() - GetDeviceOriginY(); Point aPos( i_rPos ); // tdf#165706 those delta values are in pixels, but aPos copied from // i_rPos *may* be in logical coordinates if a MapMode is set at diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 91bb51f5c3a1..63d91a58c51b 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -1422,7 +1422,7 @@ bool Window::ImplUpdatePos() vcl::Window* pParent = ImplGetParent(); GetOutDev()->SetDeviceOriginX(mpWindowImpl->mnX + pParent->GetOutDev()->GetDeviceOriginX()); - GetOutDev()->SetDeviceOriginY(mpWindowImpl->mnY + pParent->GetOutDev()->GetOutOffYPixel()); + GetOutDev()->SetDeviceOriginY(mpWindowImpl->mnY + pParent->GetOutDev()->GetDeviceOriginY()); } VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild; @@ -1442,7 +1442,7 @@ bool Window::ImplUpdatePos() void Window::ImplUpdateSysObjPos() { if ( mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->GetDeviceOriginX(), GetOutDev()->GetOutOffYPixel(), GetOutDev()->GetOutputWidthPixel(), GetOutDev()->GetOutputHeightPixel() ); + mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->GetDeviceOriginX(), GetOutDev()->GetDeviceOriginY(), GetOutDev()->GetOutputWidthPixel(), GetOutDev()->GetOutputHeightPixel() ); VclPtr< vcl::Window > pChild = mpWindowImpl->mpFirstChild; while ( pChild ) @@ -1459,7 +1459,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, bool bNewSize = false; bool bCopyBits = false; tools::Long nOldOutOffX = GetOutDev()->GetDeviceOriginX(); - tools::Long nOldOutOffY = GetOutDev()->GetOutOffYPixel(); + tools::Long nOldOutOffY = GetOutDev()->GetDeviceOriginY(); tools::Long nOldOutWidth = GetOutDev()->GetOutputWidthPixel(); tools::Long nOldOutHeight = GetOutDev()->GetOutputHeightPixel(); std::unique_ptr pOverlapRegion; @@ -1658,7 +1658,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, ImplClipBoundaries( aRegion, false, true ); if ( !pOverlapRegion->IsEmpty() ) { - pOverlapRegion->Move( GetOutDev()->GetDeviceOriginX() - nOldOutOffX, GetOutDev()->GetOutOffYPixel() - nOldOutOffY ); + pOverlapRegion->Move( GetOutDev()->GetDeviceOriginX() - nOldOutOffX, GetOutDev()->GetDeviceOriginY() - nOldOutOffY ); aRegion.Exclude( *pOverlapRegion ); } if ( !aRegion.IsEmpty() ) @@ -1666,7 +1666,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, // adapt Paint areas ImplMoveAllInvalidateRegions( tools::Rectangle( Point( nOldOutOffX, nOldOutOffY ), Size( nOldOutWidth, nOldOutHeight ) ), - GetOutDev()->GetDeviceOriginX() - nOldOutOffX, GetOutDev()->GetOutOffYPixel() - nOldOutOffY, + GetOutDev()->GetDeviceOriginX() - nOldOutOffX, GetOutDev()->GetDeviceOriginY() - nOldOutOffY, true ); SalGraphics* pGraphics = ImplGetFrameGraphics(); if ( pGraphics ) @@ -1676,7 +1676,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, const bool bSelectClipRegion = pOutDev->SelectClipRegion( aRegion, pGraphics ); if ( bSelectClipRegion ) { - pGraphics->CopyArea( GetOutDev()->GetDeviceOriginX(), GetOutDev()->GetOutOffYPixel(), + pGraphics->CopyArea( GetOutDev()->GetDeviceOriginX(), GetOutDev()->GetDeviceOriginY(), nOldOutOffX, nOldOutOffY, nOldOutWidth, nOldOutHeight, *GetOutDev() ); @@ -1731,7 +1731,7 @@ void Window::ImplPosSizeWindow( tools::Long nX, tools::Long nY, if ( bUpdateSysObjPos ) ImplUpdateSysObjPos(); if ( bNewSize && mpWindowImpl->mpSysObj ) - mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->GetDeviceOriginX(), GetOutDev()->GetOutOffYPixel(), GetOutDev()->GetOutputWidthPixel(), GetOutDev()->GetOutputHeightPixel() ); + mpWindowImpl->mpSysObj->SetPosSize( GetOutDev()->GetDeviceOriginX(), GetOutDev()->GetDeviceOriginY(), GetOutDev()->GetOutputWidthPixel(), GetOutDev()->GetOutputHeightPixel() ); } void Window::ImplNewInputContext() @@ -2748,7 +2748,7 @@ void Window::setPosSizePixel( tools::Long nX, tools::Long nY, nSysFlags |= SAL_FRAME_POSSIZE_Y; if( pWinParent && (pWindow->GetStyle() & WB_SYSTEMCHILDWINDOW) ) { - nY += pWinParent->GetOutDev()->GetOutOffYPixel(); + nY += pWinParent->GetOutDev()->GetDeviceOriginY(); } } @@ -2809,13 +2809,13 @@ AbsoluteScreenPixelRectangle Window::GetDesktopRectPixel() const Point Window::OutputToScreenPixel( const Point& rPos ) const { // relative to top level parent - return Point( rPos.X() + GetOutDev()->GetDeviceOriginX(), rPos.Y() + GetOutDev()->GetOutOffYPixel() ); + return Point( rPos.X() + GetOutDev()->GetDeviceOriginX(), rPos.Y() + GetOutDev()->GetDeviceOriginY() ); } Point Window::ScreenToOutputPixel( const Point& rPos ) const { // relative to top level parent - return Point( rPos.X() - GetOutDev()->GetDeviceOriginX(), rPos.Y() - GetOutDev()->GetOutOffYPixel() ); + return Point( rPos.X() - GetOutDev()->GetDeviceOriginX(), rPos.Y() - GetOutDev()->GetDeviceOriginY() ); } tools::Long Window::ImplGetUnmirroredOutOffX() const @@ -2845,14 +2845,14 @@ Point Window::OutputToNormalizedScreenPixel( const Point& rPos ) const { // relative to top level parent tools::Long offx = ImplGetUnmirroredOutOffX(); - return Point( rPos.X()+offx, rPos.Y() + GetOutDev()->GetOutOffYPixel() ); + return Point( rPos.X()+offx, rPos.Y() + GetOutDev()->GetDeviceOriginY() ); } Point Window::NormalizedScreenToOutputPixel( const Point& rPos ) const { // relative to top level parent tools::Long offx = ImplGetUnmirroredOutOffX(); - return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->GetOutOffYPixel() ); + return Point( rPos.X()-offx, rPos.Y() - GetOutDev()->GetDeviceOriginY() ); } AbsoluteScreenPixelPoint Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const @@ -3472,7 +3472,7 @@ Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSp // common: first any is VCL pointer to window (for VCL canvas) Sequence< Any > aArg{ Any(reinterpret_cast(this)), - Any(css::awt::Rectangle( GetDeviceOriginX(), GetOutOffYPixel(), GetOutputWidthPixel(), GetOutputHeightPixel() )), + Any(css::awt::Rectangle( GetDeviceOriginX(), GetDeviceOriginY(), GetOutputWidthPixel(), GetOutputHeightPixel() )), Any(mxOwnerWindow->mpWindowImpl->mbAlwaysOnTop), Any(Reference< css::awt::XWindow >( mxOwnerWindow->GetComponentInterface(), diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index b831b8ad4707..ca9380318e65 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1241,7 +1241,7 @@ bool Window::IsDefaultSize() const Point Window::GetOffsetPixelFrom(const vcl::Window& rWindow) const { - return Point(GetDeviceOriginX() - rWindow.GetDeviceOriginX(), GetOutOffYPixel() - rWindow.GetOutOffYPixel()); + return Point(GetDeviceOriginX() - rWindow.GetDeviceOriginX(), GetDeviceOriginY() - rWindow.GetDeviceOriginY()); } void Window::EnablePaint( bool bEnable ) diff --git a/vcl/source/window/window3.cxx b/vcl/source/window/window3.cxx index e0dfa6d0f542..e9c09b39faa6 100644 --- a/vcl/source/window/window3.cxx +++ b/vcl/source/window/window3.cxx @@ -130,7 +130,7 @@ void Window::SetTextAlign(TextAlign eAlign) { GetOutDev()->SetTextAlign(eAlign); float Window::GetDPIScaleFactor() const { return GetOutDev()->GetDPIScaleFactor(); } tools::Long Window::GetDeviceOriginX() const { return GetOutDev()->GetDeviceOriginX(); } -tools::Long Window::GetOutOffYPixel() const { return GetOutDev()->GetOutOffYPixel(); } +tools::Long Window::GetDeviceOriginY() const { return GetOutDev()->GetDeviceOriginY(); } void Window::SetMapMode() { GetOutDev()->SetMapMode(); } void Window::SetMapMode(const MapMode& rNewMapMode) { GetOutDev()->SetMapMode(rNewMapMode); } bool Window::IsRTLEnabled() const { return GetOutDev()->IsRTLEnabled(); } diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index e789d5801e17..8db402d2bf3a 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -1505,7 +1505,7 @@ static void ImplHandleExtTextInputPos( vcl::Window* pWindow, rRect = tools::Rectangle( aPos, aSize ); } else - rRect = tools::Rectangle( Point( pChild->GetDeviceOriginX(), pChild->GetOutOffYPixel() ), Size() ); + rRect = tools::Rectangle( Point( pChild->GetDeviceOriginX(), pChild->GetDeviceOriginY() ), Size() ); } rInputWidth = pChild->GetOutDev()->LogicWidthToDevicePixel(pChild->GetCursorExtTextInputWidth()); if ( !rInputWidth )