summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdpntv.cxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2007-06-26 11:09:03 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2007-06-26 11:09:03 +0000
commit2c5fd80cb725e35c9e0c2fb839225df8a488543f (patch)
tree62224eba587c32e066a6ef0162794c21393a6d69 /svx/source/svdraw/svdpntv.cxx
parentcd3dea032ff1e70be472c0a6a87263f67c6d18ce (diff)
INTEGRATION: CWS aw046 (1.34.2); FILE MERGED
2007/05/30 14:35:46 aw 1.34.2.8: #i74769# code cleanups 2007/05/08 15:45:00 aw 1.34.2.7: #i74769# 2007/04/26 10:26:01 aw 1.34.2.6: #i74769# 2007/04/05 14:21:07 aw 1.34.2.5: #i74769# Scroll needs to move the child windows which are FormControls 2007/04/03 11:33:27 aw 1.34.2.4: #i74769# Added support for PaintBuffer 2007/04/03 10:02:31 aw 1.34.2.3: #i74769# removed ExpandPaintClipRegion 2007/03/06 16:01:48 aw 1.34.2.2: #i74769# in-between progess state 2007/02/26 17:18:24 aw 1.34.2.1: #i74769# Changed Begin/EndDrawLayer() to support direct use of SdrPaintWindow and PreRenderDevice
Diffstat (limited to 'svx/source/svdraw/svdpntv.cxx')
-rw-r--r--svx/source/svdraw/svdpntv.cxx182
1 files changed, 139 insertions, 43 deletions
diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx
index 1fdbb59587d8..ff5aceaf21bf 100644
--- a/svx/source/svdraw/svdpntv.cxx
+++ b/svx/source/svdraw/svdpntv.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: svdpntv.cxx,v $
*
- * $Revision: 1.34 $
+ * $Revision: 1.35 $
*
- * last change: $Author: kz $ $Date: 2007-02-12 14:41:23 $
+ * last change: $Author: hr $ $Date: 2007-06-26 12:09:03 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -848,11 +848,49 @@ void SdrPaintView::CompleteRedraw(OutputDevice* pOut, const Region& rReg, USHORT
{
#endif // SVX_REPAINT_TIMER_TEST
+ // #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
+ // rReg may be made more granular (fine) with using it. Normally, rReg
+ // does come from Window::Paint() anyways and thus is based on a single
+ // rectangle which was derived from exactly that repaint region
+ Region aOptimizedRepaintRegion(rReg);
+
+ if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType())
+ {
+ Window* pWindow = (Window*)pOut;
+
+ if(pWindow->IsInPaint())
+ {
+ if(!pWindow->GetPaintRegion().IsEmpty())
+ {
+ aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
+
+#ifdef DBG_UTIL
+ // #i74769# test-paint repaint region
+ static bool bDoPaintForVisualControl(false);
+ if(bDoPaintForVisualControl)
+ {
+ RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
+ Rectangle aRegionRectangle;
+
+ while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
+ {
+ pWindow->SetLineColor(COL_LIGHTGREEN);
+ pWindow->SetFillColor();
+ pWindow->DrawRect(aRegionRectangle);
+ }
+
+ aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
+ }
+#endif
+ }
+ }
+ }
+
SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
OSL_ENSURE(pPaintWindow, "SdrPaintView::CompleteRedraw: No OutDev (!)");
- DoCompleteRedraw(*pPaintWindow, rReg, nPaintMod, pRedirector);
- EndCompleteRedraw(*pPaintWindow, rReg);
+ DoCompleteRedraw(*pPaintWindow, aOptimizedRepaintRegion, nPaintMod, pRedirector);
+ EndCompleteRedraw(*pPaintWindow);
#ifdef SVX_REPAINT_TIMER_TEST
}
@@ -942,7 +980,7 @@ void SdrPaintView::DoCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region&
}
}
-void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg)
+void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow)
{
if(rPaintWindow.getTemporaryTarget())
{
@@ -952,52 +990,45 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region&
else
{
// draw postprocessing, only for known devices
- bool bFormControlsUsed(false);
- bool bTextEditActive(false);
- if(mpPageView)
- {
- bFormControlsUsed = mpPageView->AreFormControlsUsed(rPaintWindow);
- }
-
- if(IsTextEdit() && GetTextEditPageView())
- {
- bTextEditActive = true;
- }
-
- if(bFormControlsUsed || bTextEditActive)
+ // #i74769# it is necessary to always paint FormLayer:
+ //
+ // - AreFormControlsUsed() is not very reliable since ATM ShouldPaintObject may create the
+ // objects, so XControlContainer may be empty
+ // - In life mode (and thus always since we have controls which even exist as a child window
+ // when not in life mode) the child windows always need to be positioned and scaled, even
+ // when not visible (to not stay at their last visible position, but move outside reliably)
+ // - last but not least: There may be other objects on the form layer (an error, but happened)
+ ImpFormLayerDrawing(rPaintWindow);
+
+ // look for active TextEdit. As long as this cannot be painted to a VDev,
+ // it cannot get part of buffering. In that case, output evtl. prerender
+ // early and paint text edit to window.
+ const bool bTextEditActive(IsTextEdit() && GetTextEditPageView());
+
+ if(bTextEditActive)
{
// output PreRendering and destroy it so that it is not used for FormLayer
// or overlay
rPaintWindow.OutputPreRenderDevice(rPaintWindow.GetRedrawRegion());
- // #i73602# do not destroy PreRenderDevice, this will be bad for performance.
- // To not use it when drawing overlay, better give a flag for that purpose
- // rPaintWindow.DestroyPreRenderDevice();
-
- // draw form layer directly to window.
- if(bFormControlsUsed)
- {
- ImpFormLayerDrawing(rPaintWindow);
- }
-
// draw old text edit stuff before overlay to have it as part of the background
// ATM. This will be changed to have the text editing on the overlay, bit it
// is not an easy thing to do, see BegTextEdit and the OutlinerView stuff used...
if(bTextEditActive)
{
- ImpTextEditDrawing(rReg, rPaintWindow);
+ ImpTextEditDrawing(rPaintWindow);
}
// draw Overlay directly to window. This will save the contents of the window
// in the RedrawRegion to the overlay background buffer, too.
- // #i73602# pass flag if buffer shall be used
+ // This may lead to problems when reading from the screen is slow from the
+ // graphics driver/graphiccard combination.
rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion(), false);
}
else
{
// draw Overlay, also to PreRender device if exists
- // #i73602# add flag if buffer shall be used
rPaintWindow.DrawOverlay(rPaintWindow.GetRedrawRegion(), true);
// output PreRendering
@@ -1008,27 +1039,82 @@ void SdrPaintView::EndCompleteRedraw(SdrPaintWindow& rPaintWindow, const Region&
////////////////////////////////////////////////////////////////////////////////////////////////////
-void SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region& rReg, sal_Bool bPrepareBuffered)
+SdrPaintWindow* SdrPaintView::BeginDrawLayers(OutputDevice* pOut, const Region& rReg)
{
- // prepare the Paint.
+ // #i74769# use BeginCompleteRedraw() as common base
+ SdrPaintWindow* pPaintWindow = BeginCompleteRedraw(pOut);
+ OSL_ENSURE(pPaintWindow, "SdrPaintView::BeginDrawLayers: No SdrPaintWindow (!)");
+
if(mpPageView)
{
- mpPageView->BeginDrawLayer(pOut, rReg, bPrepareBuffered);
+ SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(*pPaintWindow);
+
+ if(pKnownTarget)
+ {
+ // #i74769# check if pOut is a win and has a ClipRegion. If Yes, the Region
+ // rReg may be made more granular (fine) with using it. Normally, rReg
+ // does come from Window::Paint() anyways and thus is based on a single
+ // rectangle which was derived from exactly that repaint region
+ Region aOptimizedRepaintRegion(rReg);
+
+ if(pOut && OUTDEV_WINDOW == pOut->GetOutDevType())
+ {
+ Window* pWindow = (Window*)pOut;
+
+ if(pWindow->IsInPaint())
+ {
+ if(!pWindow->GetPaintRegion().IsEmpty())
+ {
+ aOptimizedRepaintRegion.Intersect(pWindow->GetPaintRegion());
+
+#ifdef DBG_UTIL
+ // #i74769# test-paint repaint region
+ static bool bDoPaintForVisualControl(false);
+ if(bDoPaintForVisualControl)
+ {
+ RegionHandle aRegionHandle(aOptimizedRepaintRegion.BeginEnumRects());
+ Rectangle aRegionRectangle;
+
+ while(aOptimizedRepaintRegion.GetEnumRects(aRegionHandle, aRegionRectangle))
+ {
+ pWindow->SetLineColor(COL_LIGHTGREEN);
+ pWindow->SetFillColor();
+ pWindow->DrawRect(aRegionRectangle);
+ }
+
+ aOptimizedRepaintRegion.EndEnumRects(aRegionHandle);
+ }
+#endif
+ }
+ }
+ }
+
+ // prepare redraw
+ pKnownTarget->PrepareRedraw(aOptimizedRepaintRegion);
+
+ // remember prepared SdrPageWindow
+ mpPageView->setPreparedPageWindow(pKnownTarget);
+ }
}
+
+ return pPaintWindow;
}
-void SdrPaintView::EndDrawLayers(OutputDevice* pOut)
+void SdrPaintView::EndDrawLayers(SdrPaintWindow& rPaintWindow)
{
- // close the Paint.
+ // #i74769# use EndCompleteRedraw() as common base
+ EndCompleteRedraw(rPaintWindow);
+
if(mpPageView)
{
- mpPageView->EndDrawLayer(pOut);
+ // forget prepared SdrPageWindow
+ mpPageView->setPreparedPageWindow(0);
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////
-void SdrPaintView::ImpTextEditDrawing(const Region& rReg, SdrPaintWindow& rPaintWindow) const
+void SdrPaintView::ImpTextEditDrawing(SdrPaintWindow& rPaintWindow) const
{
// draw old text edit stuff
if(IsTextEdit())
@@ -1038,7 +1124,8 @@ void SdrPaintView::ImpTextEditDrawing(const Region& rReg, SdrPaintWindow& rPaint
if(pPageView)
{
// paint TextEdit directly to the destination OutDev
- Rectangle aCheckRect(rReg.GetBoundRect());
+ const Region& rRedrawRegion = rPaintWindow.GetRedrawRegion();
+ const Rectangle aCheckRect(rRedrawRegion.GetBoundRect());
pPageView->PaintOutlinerView(&rPaintWindow.GetOutputDevice(), aCheckRect);
}
}
@@ -1048,11 +1135,20 @@ void SdrPaintView::ImpFormLayerDrawing(SdrPaintWindow& rPaintWindow) const
{
if(mpPageView)
{
- const SdrModel& rModel = *(GetModel());
- const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
- const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
+ SdrPageWindow* pKnownTarget = mpPageView->FindPageWindow(rPaintWindow);
- mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetOutputDevice());
+ if(pKnownTarget)
+ {
+ const SdrModel& rModel = *(GetModel());
+ const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin();
+ const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName(), sal_False);
+
+ // BUFFERED use GetTargetOutputDevice() now, it may be targeted to VDevs, too
+ // need to set PreparedPageWindow to make DrawLayer use the correct ObjectContact
+ mpPageView->setPreparedPageWindow(pKnownTarget);
+ mpPageView->DrawLayer(nControlLayerId, &rPaintWindow.GetTargetOutputDevice());
+ mpPageView->setPreparedPageWindow(0);
+ }
}
}