Kaydet (Commit) 70492ce8 authored tarafından Caolán McNamara's avatar Caolán McNamara

match preview buffer device mapmode and pixel size

Change-Id: Ie5ac758b788357e1d54ea3dc5abd233ff9e4abf0
Reviewed-on: https://gerrit.libreoffice.org/59762
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 16970001
...@@ -2213,13 +2213,8 @@ void PreviewBase::LocalPrePaint(vcl::RenderContext const & rRenderContext) ...@@ -2213,13 +2213,8 @@ void PreviewBase::LocalPrePaint(vcl::RenderContext const & rRenderContext)
{ {
// init BufferDevice // init BufferDevice
if (mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel()) if (mpBufferDevice->GetOutputSizePixel() != GetOutputSizePixel())
{
mpBufferDevice->SetDrawMode(rRenderContext.GetDrawMode());
mpBufferDevice->SetSettings(rRenderContext.GetSettings());
mpBufferDevice->SetAntialiasing(rRenderContext.GetAntialiasing());
mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel()); mpBufferDevice->SetOutputSizePixel(GetOutputSizePixel());
mpBufferDevice->SetMapMode(rRenderContext.GetMapMode()); mpBufferDevice->SetAntialiasing(rRenderContext.GetAntialiasing());
}
const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
...@@ -2275,9 +2270,7 @@ XRectPreview::XRectPreview() ...@@ -2275,9 +2270,7 @@ XRectPreview::XRectPreview()
// in e.g. page dialog // in e.g. page dialog
tools::Rectangle XRectPreview::GetPreviewSize() const tools::Rectangle XRectPreview::GetPreviewSize() const
{ {
tools::Rectangle aObjectSize(Point(), GetOutputSizePixel()); tools::Rectangle aObjectSize(Point(), getBufferDevice().PixelToLogic(GetOutputSizePixel()));
aObjectSize.AdjustRight(1);
aObjectSize.AdjustBottom(1);
return aObjectSize; return aObjectSize;
} }
...@@ -2287,9 +2280,7 @@ void XRectPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea) ...@@ -2287,9 +2280,7 @@ void XRectPreview::SetDrawingArea(weld::DrawingArea* pDrawingArea)
InitSettings(); InitSettings();
// create RectangleObject // create RectangleObject
mpRectangleObject = new SdrRectObj( mpRectangleObject = new SdrRectObj(getModel(), GetPreviewSize());
getModel(),
GetPreviewSize());
} }
void XRectPreview::Resize() void XRectPreview::Resize()
...@@ -2297,9 +2288,7 @@ void XRectPreview::Resize() ...@@ -2297,9 +2288,7 @@ void XRectPreview::Resize()
SdrObject *pOrigObject = mpRectangleObject; SdrObject *pOrigObject = mpRectangleObject;
if (pOrigObject) if (pOrigObject)
{ {
mpRectangleObject = new SdrRectObj( mpRectangleObject = new SdrRectObj(getModel(), GetPreviewSize());
getModel(),
GetPreviewSize());
SetAttributes(pOrigObject->GetMergedItemSet()); SetAttributes(pOrigObject->GetMergedItemSet());
SdrObject::Free(pOrigObject); SdrObject::Free(pOrigObject);
} }
...@@ -2319,6 +2308,8 @@ void XRectPreview::SetAttributes(const SfxItemSet& rItemSet) ...@@ -2319,6 +2308,8 @@ void XRectPreview::SetAttributes(const SfxItemSet& rItemSet)
void XRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) void XRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&)
{ {
rRenderContext.Push(PushFlags::MAPMODE);
rRenderContext.SetMapMode(MapMode(MapUnit::Map100thMM));
LocalPrePaint(rRenderContext); LocalPrePaint(rRenderContext);
sdr::contact::SdrObjectVector aObjectVector; sdr::contact::SdrObjectVector aObjectVector;
...@@ -2331,6 +2322,7 @@ void XRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan ...@@ -2331,6 +2322,7 @@ void XRectPreview::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
aPainter.ProcessDisplay(aDisplayInfo); aPainter.ProcessDisplay(aDisplayInfo);
LocalPostPaint(rRenderContext); LocalPostPaint(rRenderContext);
rRenderContext.Pop();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment