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 <dcbw@libreoffice.org>
This commit is contained in:
committed by
Dan Williams
parent
90951d958c
commit
c928d5bc07
@@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -117,10 +117,10 @@ std::unique_ptr<BaseProcessor2D> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<tools::PolyPolygon> &
|
||||
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<tools::Rectangle> aRectangles;
|
||||
aRegion.GetRegionRectangles(aRectangles);
|
||||
@@ -362,7 +362,7 @@ void ImpEditView::lokSelectionCallback(const std::optional<tools::PolyPolygon> &
|
||||
vcl::Window* parent = mpOutputWindow->GetParent();
|
||||
while (parent &&
|
||||
parent->GetDeviceOriginX() == mpOutputWindow->GetDeviceOriginX() &&
|
||||
parent->GetOutOffYPixel() == mpOutputWindow->GetOutOffYPixel())
|
||||
parent->GetDeviceOriginY() == mpOutputWindow->GetDeviceOriginY())
|
||||
{
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
+6
-21
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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: */
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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<double>(GetDPIX()) * maMapRes.mfMapScX);
|
||||
const double fScaleFactorY(static_cast<double>(GetDPIY()) * maMapRes.mfMapScY);
|
||||
const double fZeroPointX((static_cast<double>(maMapRes.mnMapOfsX) * fScaleFactorX)
|
||||
+ static_cast<double>(GetPixelXOffset()));
|
||||
const double fZeroPointY((static_cast<double>(maMapRes.mnMapOfsY) * fScaleFactorY)
|
||||
+ static_cast<double>(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<double>(GetDPIX()) * aMapRes.mfMapScX);
|
||||
const double fScaleFactorY(static_cast<double>(GetDPIY()) * aMapRes.mfMapScY);
|
||||
const double fZeroPointX((static_cast<double>(aMapRes.mnMapOfsX) * fScaleFactorX)
|
||||
+ static_cast<double>(GetPixelXOffset()));
|
||||
const double fZeroPointY((static_cast<double>(aMapRes.mnMapOfsY) * fScaleFactorY)
|
||||
+ static_cast<double>(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: */
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
|
||||
#include <CoordinateMapper.hxx>
|
||||
#include <drawmode.hxx>
|
||||
#include <salgdi.hxx>
|
||||
|
||||
@@ -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 ))
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() )
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <vcl/rendercontext/AntialiasingFlags.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
|
||||
#include <CoordinateMapper.hxx>
|
||||
#include <drawmode.hxx>
|
||||
#include <salgdi.hxx>
|
||||
|
||||
@@ -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()));
|
||||
|
||||
+106
-250
@@ -39,25 +39,6 @@
|
||||
#include <basegfx/matrix/b2dhommatrix.hxx>
|
||||
#include <tools/UnitConversion.hxx>
|
||||
|
||||
// #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<double>(GetDPIX()) * mpMapper->GetMapResolutionScaleX());
|
||||
const double fScaleFactorY(static_cast<double>(GetDPIY()) * mpMapper->GetMapResolutionScaleY());
|
||||
const double fZeroPointX((static_cast<double>(mpMapper->GetMappingXOffset()) * fScaleFactorX) + static_cast<double>(mpMapper->GetPixelXOffset()));
|
||||
const double fZeroPointY((static_cast<double>(mpMapper->GetMappingYOffset()) * fScaleFactorY) + static_cast<double>(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<double>(GetDPIX()) * aMapRes.mfMapScX);
|
||||
const double fScaleFactorY(static_cast<double>(GetDPIY()) * aMapRes.mfMapScY);
|
||||
const double fZeroPointX((static_cast<double>(aMapRes.mnMapOfsX) * fScaleFactorX) + static_cast<double>(mpMapper->GetPixelXOffset()));
|
||||
const double fZeroPointY((static_cast<double>(aMapRes.mnMapOfsY) * fScaleFactorY) + static_cast<double>(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: */
|
||||
|
||||
@@ -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<sal_Int64>(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()
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
|
||||
#include <CoordinateMapper.hxx>
|
||||
#include <salgdi.hxx>
|
||||
|
||||
#include <cassert>
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <vcl/metaact.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
|
||||
#include <CoordinateMapper.hxx>
|
||||
#include <salgdi.hxx>
|
||||
|
||||
#include <cassert>
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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() )
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<vcl::Window> 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
|
||||
|
||||
@@ -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<vcl::Region> 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<sal_Int64>(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(),
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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(); }
|
||||
|
||||
@@ -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 )
|
||||
|
||||
Reference in New Issue
Block a user