summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2015-06-23 10:29:48 +0200
committerJan Holesovsky <kendy@collabora.com>2015-06-23 10:32:28 +0200
commit5ca1936975148ae3bdc87edb69f812347f1ecb92 (patch)
tree408758d75ef07d02ffa9f2781ccb83dd614cf53d /vcl
parent4ec27ad35f00fbf5f5bc903cabe0692dc257f1e2 (diff)
rendercontext: Mass fix of using the wrong size.
In the paints, we must use the size of the Window for the computations, not of the RenderContext - the RenderContext can be much bigger than the Window in the double-buffering case. Fixes for example the list boxes, and many others. Change-Id: I4c7607569f88b2d097587140858d0862e54b5ea6
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/edit.cxx6
-rw-r--r--vcl/source/control/ilstbox.cxx8
-rw-r--r--vcl/source/control/prgsbar.cxx2
-rw-r--r--vcl/source/control/scrbar.cxx2
-rw-r--r--vcl/source/control/slider.cxx2
-rw-r--r--vcl/source/window/dockingarea.cxx3
-rw-r--r--vcl/source/window/dockmgr.cxx2
-rw-r--r--vcl/source/window/menubarwindow.cxx14
-rw-r--r--vcl/source/window/menufloatingwindow.cxx8
-rw-r--r--vcl/source/window/paint.cxx2
-rw-r--r--vcl/source/window/printdlg.cxx2
-rw-r--r--vcl/source/window/toolbox.cxx13
12 files changed, 32 insertions, 32 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index fe95bbc0df5c..4feeb2d02b0a 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1062,7 +1062,7 @@ void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, lon
// mirror
Rectangle aBounds(aClipRgn.GetBoundRect());
- int xNew = rRenderContext.GetOutputSizePixel().Width() - aBounds.GetWidth() - aBounds.Left();
+ int xNew = GetOutputSizePixel().Width() - aBounds.GetWidth() - aBounds.Left();
aClipRgn.Move(xNew - aBounds.Left(), 0);
// move offset of border window
@@ -1081,13 +1081,13 @@ void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, lon
vcl::Region oldRgn(pBorder->GetClipRegion());
pBorder->SetClipRegion(aClipRgn);
- pBorder->Paint(*pBorder, Rectangle()); // FIXME
+ pBorder->Paint(*pBorder, Rectangle());
pBorder->SetClipRegion(oldRgn);
}
else
{
- pBorder->Paint(*pBorder, Rectangle()); // FIXME
+ pBorder->Paint(*pBorder, Rectangle());
}
}
}
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index 7f6d17e2c3db..a0ff8724fd62 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -1699,7 +1699,7 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32
if (!pEntry)
return;
- long nWidth = rRenderContext.GetOutputSizePixel().Width();
+ long nWidth = GetOutputSizePixel().Width();
long nY = mpEntryList->GetAddedHeight(nPos, mnTop);
Rectangle aRect(Point(0, nY), Size(nWidth, pEntry->mnHeight));
@@ -1809,10 +1809,10 @@ void ImplListBoxWindow::DrawEntry(vcl::RenderContext& rRenderContext, sal_Int32
OUString aStr(mpEntryList->GetEntryText(nPos));
if (!aStr.isEmpty())
{
- long nMaxWidth = std::max(static_cast< long >(mnMaxWidth), rRenderContext.GetOutputSizePixel().Width() - 2 * mnBorder);
+ long nMaxWidth = std::max(static_cast< long >(mnMaxWidth), GetOutputSizePixel().Width() - 2 * mnBorder);
// a multiline entry should only be as wide a the window
if ((pEntry->mnFlags & ListBoxEntryFlags::MultiLine))
- nMaxWidth = rRenderContext.GetOutputSizePixel().Width() - 2 * mnBorder;
+ nMaxWidth = GetOutputSizePixel().Width() - 2 * mnBorder;
Rectangle aTextRect(Point(mnBorder - mnLeft, nY),
Size(nMaxWidth, pEntry->mnHeight));
@@ -2785,7 +2785,7 @@ void ImplWin::Paint( vcl::RenderContext& rRenderContext, const Rectangle& )
void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos, bool bLayout)
{
long nBorder = 1;
- Size aOutSz = rRenderContext.GetOutputSizePixel();
+ Size aOutSz(GetOutputSizePixel());
bool bImage = !!maImage;
if (bDrawImage && bImage && !bLayout)
diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx
index 723a5e87ad20..f069b4341d78 100644
--- a/vcl/source/control/prgsbar.cxx
+++ b/vcl/source/control/prgsbar.cxx
@@ -123,7 +123,7 @@ void ProgressBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt1
{
mbCalcNew = false;
- Size aSize = rRenderContext.GetOutputSizePixel();
+ Size aSize(GetOutputSizePixel());
mnPrgsHeight = aSize.Height() - (PROGRESSBAR_WIN_OFFSET * 2);
mnPrgsWidth = (mnPrgsHeight * 2) / 3;
maPos.Y() = PROGRESSBAR_WIN_OFFSET;
diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx
index 31986b9025e7..b786ddd9621a 100644
--- a/vcl/source/control/scrbar.cxx
+++ b/vcl/source/control/scrbar.cxx
@@ -509,7 +509,7 @@ bool ScrollBar::ImplDrawNative(vcl::RenderContext& rRenderContext, sal_uInt16 nD
aCtrlRegion.Union(maPage2Rect);
aCtrlRegion.Union(maThumbRect);
- Rectangle aRequestedRegion(Point(0,0), rRenderContext.GetOutputSizePixel());
+ Rectangle aRequestedRegion(Point(0,0), GetOutputSizePixel());
// if the actual native control region is smaller then the region that
// we requested the control to draw in, then draw a background rectangle
// to avoid drawing artifacts in the uncovered region
diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx
index 4feabab84e7e..02fa450540d5 100644
--- a/vcl/source/control/slider.cxx
+++ b/vcl/source/control/slider.cxx
@@ -373,7 +373,7 @@ void Slider::ImplDraw(vcl::RenderContext& rRenderContext, sal_uInt16 nDrawFlags)
sldValue.mnThumbState |= ControlState::ROLLOVER;
}
- const Rectangle aCtrlRegion(Point(0,0), rRenderContext.GetOutputSizePixel());
+ const Rectangle aCtrlRegion(Point(0,0), GetOutputSizePixel());
bool bNativeOK = rRenderContext.DrawNativeControl(CTRL_SLIDER, nPart, aCtrlRegion, nState, sldValue, OUString());
if (bNativeOK)
return;
diff --git a/vcl/source/window/dockingarea.cxx b/vcl/source/window/dockingarea.cxx
index 25519f9bb46f..f60292be9dc0 100644
--- a/vcl/source/window/dockingarea.cxx
+++ b/vcl/source/window/dockingarea.cxx
@@ -162,7 +162,6 @@ void DockingAreaWindow::ApplySettings(vcl::RenderContext& rRenderContext)
void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
-
const StyleSettings rSetting = rRenderContext.GetSettings().GetStyleSettings();
EnableNativeWidget(true); // only required because the toolkit currently switches this flag off
@@ -217,7 +216,7 @@ void DockingAreaWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangl
else
{
// create map to find toolbar lines
- Size aOutSz = rRenderContext.GetOutputSizePixel();
+ Size aOutSz(GetOutputSizePixel());
std::map<int, int> ranges;
sal_uInt16 nChildren = GetChildCount();
for (sal_uInt16 n = 0; n < nChildren; n++)
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index a1cd73420418..d23b08de6de1 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -713,7 +713,7 @@ void ImplPopupFloatWin::DrawGrip(vcl::RenderContext& rRenderContext)
void ImplPopupFloatWin::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
{
- Rectangle aRect(Point(), rRenderContext.GetOutputSizePixel());
+ Rectangle aRect(Point(), GetOutputSizePixel());
rRenderContext.DrawWallpaper(aRect, Wallpaper(rRenderContext.GetSettings().GetStyleSettings().GetFaceGradientColor()));
DrawBorder(rRenderContext);
if (hasGrip())
diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx
index 3a5d8fb7f706..3bc064a7b54f 100644
--- a/vcl/source/window/menubarwindow.cxx
+++ b/vcl/source/window/menubarwindow.cxx
@@ -562,7 +562,7 @@ static int ImplGetTopDockingAreaHeight( vcl::Window *pWindow )
return 0;
}
-static void ImplAddNWFSeparator( vcl::RenderContext& rRenderContext, const MenubarValue& rMenubarValue )
+static void ImplAddNWFSeparator(vcl::RenderContext& rRenderContext, const Size& rSize, const MenubarValue& rMenubarValue)
{
// add a separator if
// - we have an adjacent docking area
@@ -575,7 +575,7 @@ static void ImplAddNWFSeparator( vcl::RenderContext& rRenderContext, const Menub
rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetSeparatorColor());
Point aPt;
- Rectangle aRect(aPt, rRenderContext.GetOutputSizePixel());
+ Rectangle aRect(aPt, rSize);
rRenderContext.DrawLine(aRect.BottomLeft(), aRect.BottomRight());
}
}
@@ -612,12 +612,12 @@ void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16
Erase(rRenderContext);
else
{
- Rectangle aBgRegion(Point(), rRenderContext.GetOutputSizePixel());
+ Rectangle aBgRegion(Point(), GetOutputSizePixel());
rRenderContext.DrawNativeControl(CTRL_MENUBAR, PART_ENTIRE_CONTROL, aBgRegion,
ControlState::ENABLED, aControlValue, OUString());
}
- ImplAddNWFSeparator(rRenderContext, aControlValue);
+ ImplAddNWFSeparator(rRenderContext, GetOutputSizePixel(), aControlValue);
// draw selected item
ControlState nState = ControlState::ENABLED;
@@ -652,13 +652,13 @@ void MenuBarWindow::HighlightItem(vcl::RenderContext& rRenderContext, sal_uInt16
// use full window size to get proper gradient
// but clip accordingly
Point aPt;
- Rectangle aCtrlRect(aPt, rRenderContext.GetOutputSizePixel());
+ Rectangle aCtrlRect(aPt, GetOutputSizePixel());
rRenderContext.DrawNativeControl(CTRL_MENUBAR, PART_ENTIRE_CONTROL,
aCtrlRect, ControlState::ENABLED, aMenubarValue, OUString());
}
- ImplAddNWFSeparator(rRenderContext, aMenubarValue);
+ ImplAddNWFSeparator(rRenderContext, GetOutputSizePixel(), aMenubarValue);
}
else
rRenderContext.Erase(aRect);
@@ -895,7 +895,7 @@ void MenuBarWindow::Paint(vcl::RenderContext& rRenderContext, const Rectangle&)
ControlState::ENABLED, aMenubarValue, OUString());
}
- ImplAddNWFSeparator(rRenderContext, aMenubarValue);
+ ImplAddNWFSeparator(rRenderContext, GetOutputSizePixel(), aMenubarValue);
}
rRenderContext.SetFillColor(rStyleSettings.GetMenuColor());
diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx
index 8af281b47cfc..065b9dcec388 100644
--- a/vcl/source/window/menufloatingwindow.cxx
+++ b/vcl/source/window/menufloatingwindow.cxx
@@ -769,7 +769,7 @@ void MenuFloatingWindow::RenderHighlightItem(vcl::RenderContext& rRenderContext,
if (!pMenu)
return;
- Size aSz = rRenderContext.GetOutputSizePixel();
+ Size aSz(GetOutputSizePixel());
long nX = 0;
long nStartY;
@@ -802,7 +802,7 @@ void MenuFloatingWindow::RenderHighlightItem(vcl::RenderContext& rRenderContext,
if (rRenderContext.IsNativeControlSupported(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL))
{
- Size aPxSize(rRenderContext.GetOutputSizePixel());
+ Size aPxSize(GetOutputSizePixel());
rRenderContext.Push(PushFlags::CLIPREGION);
rRenderContext.IntersectClipRegion(Rectangle(Point(nX, nY), Size(aSz.Width(), pData->aSz.Height())));
Rectangle aCtrlRect(Point(nX, 0), Size(aPxSize.Width()-nX, aPxSize.Height()));
@@ -1146,7 +1146,7 @@ void MenuFloatingWindow::Paint(vcl::RenderContext& rRenderContext, const Rectang
{
rRenderContext.SetClipRegion();
long nX = pMenu->pLogo ? pMenu->pLogo->aBitmap.GetSizePixel().Width() : 0;
- Size aPxSize(rRenderContext.GetOutputSizePixel());
+ Size aPxSize(GetOutputSizePixel());
aPxSize.Width() -= nX;
ImplControlValue aVal(pMenu->nTextPos - GUTTERBORDER);
rRenderContext.DrawNativeControl(CTRL_MENU_POPUP, PART_ENTIRE_CONTROL,
@@ -1174,7 +1174,7 @@ void MenuFloatingWindow::ImplDrawScroller(vcl::RenderContext& rRenderContext, bo
rRenderContext.SetClipRegion();
- Size aOutSz = rRenderContext.GetOutputSizePixel();
+ Size aOutSz(GetOutputSizePixel());
long nY = bUp ? 0 : (aOutSz.Height() - nScrollerHeight);
long nX = pMenu->pLogo ? pMenu->pLogo->aBitmap.GetSizePixel().Width() : 0;
Rectangle aRect(Point(nX, nY), Size(aOutSz.Width() - nX, nScrollerHeight));
diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx
index 518e21c795e6..49f20a4c9f2d 100644
--- a/vcl/source/window/paint.cxx
+++ b/vcl/source/window/paint.cxx
@@ -1457,7 +1457,7 @@ void Window::Erase(vcl::RenderContext& rRenderContext)
ControlPart aCtrlPart = ImplGetWindowImpl()->mnNativeBackground;
if (aCtrlPart != 0 && ! IsControlBackground())
{
- Rectangle aCtrlRegion(Point(), rRenderContext.GetOutputSizePixel());
+ Rectangle aCtrlRegion(Point(), GetOutputSizePixel());
ControlState nState = ControlState::NONE;
if (IsEnabled())
diff --git a/vcl/source/window/printdlg.cxx b/vcl/source/window/printdlg.cxx
index 2d06c3b416b8..381489f8b5e8 100644
--- a/vcl/source/window/printdlg.cxx
+++ b/vcl/source/window/printdlg.cxx
@@ -335,7 +335,7 @@ void PrintDialog::ShowNupOrderWindow::Paint(vcl::RenderContext& rRenderContext,
aFont.SetSize(Size(0, 24));
rRenderContext.SetFont(aFont);
Size aSampleTextSize(rRenderContext.GetTextWidth(OUString::number(nPages + 1)), rRenderContext.GetTextHeight());
- Size aOutSize(rRenderContext.GetOutputSizePixel());
+ Size aOutSize(GetOutputSizePixel());
Size aSubSize(aOutSize.Width() / mnColumns, aOutSize.Height() / mnRows);
// calculate font size: shrink the sample text so it fits
double fX = double(aSubSize.Width()) / double(aSampleTextSize.Width());
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index c003b9ada646..d1369658dfef 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -268,11 +268,12 @@ void ToolBox::ImplDrawGrip(vcl::RenderContext& rRenderContext)
bool bNativeOk = false;
if (rRenderContext.IsNativeControlSupported(CTRL_TOOLBAR, mbHorz ? PART_THUMB_HORZ : PART_THUMB_VERT))
{
- ToolbarValue aToolbarValue;
+ ToolbarValue aToolbarValue;
aToolbarValue.maGripRect = pWrapper->GetDragArea();
+
Point aPt;
- Rectangle aCtrlRegion( aPt, rRenderContext.GetOutputSizePixel() );
- ControlState nState = ControlState::ENABLED;
+ Rectangle aCtrlRegion(aPt, GetOutputSizePixel());
+ ControlState nState = ControlState::ENABLED;
bNativeOk = rRenderContext.DrawNativeControl( CTRL_TOOLBAR, mbHorz ? PART_THUMB_VERT : PART_THUMB_HORZ,
aCtrlRegion, nState, aToolbarValue, OUString() );
@@ -284,7 +285,7 @@ void ToolBox::ImplDrawGrip(vcl::RenderContext& rRenderContext)
const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings();
rRenderContext.SetLineColor(rStyleSettings.GetShadowColor());
- Size aSz (rRenderContext.GetOutputSizePixel());
+ Size aSz(GetOutputSizePixel());
if (meAlign == WINDOWALIGN_TOP || meAlign == WINDOWALIGN_BOTTOM)
{
@@ -355,7 +356,7 @@ void ToolBox::ImplDrawGradientBackground(vcl::RenderContext& rRenderContext, Imp
Color aOldCol = rRenderContext.GetLineColor();
rRenderContext.SetLineColor(rRenderContext.GetSettings().GetStyleSettings().GetShadowColor());
- Size aFullSz(rRenderContext.GetOutputSizePixel());
+ Size aFullSz(GetOutputSizePixel());
Size aLineSz(aFullSz);
// use the linesize only when floating
@@ -460,7 +461,7 @@ bool ToolBox::ImplDrawNativeBackground(vcl::RenderContext& rRenderContext, const
{
// use NWF
Point aPt;
- Rectangle aCtrlRegion(aPt, rRenderContext.GetOutputSizePixel());
+ Rectangle aCtrlRegion(aPt, GetOutputSizePixel());
ControlState nState = ControlState::ENABLED;
return rRenderContext.DrawNativeControl( CTRL_TOOLBAR, mbHorz ? PART_DRAW_BACKGROUND_HORZ : PART_DRAW_BACKGROUND_VERT,