summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-08-04 08:48:08 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-08-04 11:29:26 +0200
commit94a6daa068f75c7196e79a8a4295c2a069ff4530 (patch)
treef744deb54416f090b085b47869c11c33d508b7f5
parent9ce9b66eb241986a9d40d0385d0cdc73caf3b036 (diff)
tdf#92982 vcl rendercontext: set correct offset for the frame-level buffer
In case we had a toplevel window W1, the paint was triggered for window W2 and we had a sub-widget W3, then previously the buffer was created for W2, so the pixel offsets had to be set relative to W2 when rendering W3. As a consequence, if a single window was painted, then it was always painted in the top left corner. Now that the buffer is persistent and is always created for W1, make sure that we paint to the correct offset, and W3 is always painted at the same offset, regardless if it was painted directly, or just because it's a child of W2. With this, the buffer conents is closer to what is on the screen, even if it's not perfect yet. Change-Id: Ibf0e89ad18e5763bd2a01e69d91da163c24a309d
-rw-r--r--vcl/source/window/paint.cxx34
1 files changed, 14 insertions, 20 deletions
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index b4965e512903..4545ae951f4d 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -116,24 +116,22 @@ void PaintHelper::StartBufferedPaint()
// painting over, as VirtualDevice::ImplInitVirDev() would do.
// The painted area is m_aPaintRect, or in case it's empty, then the whole window.
pFrameData->mpBuffer->SetBackground(Wallpaper(Color(COL_WHITE)));
+ long nOutOffX = pFrameData->mpBuffer->GetOutOffXPixel();
+ long nOutOffY = pFrameData->mpBuffer->GetOutOffYPixel();
+ pFrameData->mpBuffer->mnOutOffX = m_pWindow->GetOutOffXPixel();
+ pFrameData->mpBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel();
if (m_aPaintRect.IsEmpty())
pFrameData->mpBuffer->Erase(Rectangle(Point(0, 0), m_pWindow->GetOutputSize()));
else
pFrameData->mpBuffer->Erase(m_aPaintRect);
+ pFrameData->mpBuffer->mnOutOffX = nOutOffX;
+ pFrameData->mpBuffer->mnOutOffY = nOutOffY;
pFrameData->mbInBufferedPaint = true;
m_bStartedBufferedPaint = true;
// Remember what was the map mode of m_aPaintRect.
m_aPaintRectMapMode = m_pWindow->GetMapMode();
-
- // we need to remember the mnOutOffX / mnOutOffY, but actually really
- // set it just temporarily for the subwidgets - so we are setting it here
- // only to remember the value & to be able to pass it to the descendants
- // FIXME: once everything's double-buffered, this is (hopefully) not
- // necessary as the buffer is always created for the main window.
- pFrameData->mpBuffer->mnOutOffX = m_pWindow->GetOutOffXPixel();
- pFrameData->mpBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel();
}
void PaintHelper::SetupBuffer()
@@ -171,9 +169,6 @@ void PaintHelper::PaintBuffer()
assert(pFrameData->mbInBufferedPaint);
assert(m_bStartedBufferedPaint);
- pFrameData->mpBuffer->mnOutOffX = 0;
- pFrameData->mpBuffer->mnOutOffY = 0;
-
// copy the buffer content to the actual window
// export VCL_DOUBLEBUFFERING_AVOID_PAINT=1 to see where we are
// painting directly instead of using Invalidate()
@@ -199,7 +194,13 @@ void PaintHelper::PaintBuffer()
aPaintRectSize = m_pWindow->PixelToLogic(aRectanglePixel.GetSize());
}
+ long nOutOffX = pFrameData->mpBuffer->GetOutOffXPixel();
+ long nOutOffY = pFrameData->mpBuffer->GetOutOffYPixel();
+ pFrameData->mpBuffer->mnOutOffX = m_pWindow->GetOutOffXPixel();
+ pFrameData->mpBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel();
m_pWindow->DrawOutDev(m_aPaintRect.TopLeft(), aPaintRectSize, m_aPaintRect.TopLeft(), aPaintRectSize, *pFrameData->mpBuffer.get());
+ pFrameData->mpBuffer->mnOutOffX = nOutOffX;
+ pFrameData->mpBuffer->mnOutOffY = nOutOffY;
}
}
@@ -250,19 +251,12 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion)
SetupBuffer();
m_pWindow->ApplySettings(*pFrameData->mpBuffer.get());
- // temporarily decrease the mnOutOffX/Y of the buffer for the
- // subwidgets (because the buffer is our base here)
- // FIXME: once everything's double-buffered, this is (hopefully) not
- // necessary as the buffer is always created for the main window.
long nOutOffX = pFrameData->mpBuffer->mnOutOffX;
long nOutOffY = pFrameData->mpBuffer->mnOutOffY;
- pFrameData->mpBuffer->mnOutOffX = m_pWindow->GetOutOffXPixel() - pFrameData->mpBuffer->mnOutOffX;
- pFrameData->mpBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel() - pFrameData->mpBuffer->mnOutOffY;
-
+ pFrameData->mpBuffer->mnOutOffX = m_pWindow->GetOutOffXPixel();
+ pFrameData->mpBuffer->mnOutOffY = m_pWindow->GetOutOffYPixel();
m_pWindow->PushPaintHelper(this, *pFrameData->mpBuffer.get());
m_pWindow->Paint(*pFrameData->mpBuffer.get(), m_aPaintRect);
-
- // restore the mnOutOffX/Y value
pFrameData->mpBuffer->mnOutOffX = nOutOffX;
pFrameData->mpBuffer->mnOutOffY = nOutOffY;
}