diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-10 18:38:16 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-10 20:19:20 +0000 |
commit | 4532ea42904e4a7d6c50f7f8ea53aaa97ec72c5e (patch) | |
tree | 6f59fe77e198568d59c5ba569bc69eba63931aee /vcl | |
parent | e12dc8fe8de1099fb1d34ac88d198ff623dbb4be (diff) |
tdf#92982 vcl rendercontext: simplify Edit::ImplClearBackground() logic
This fixes the vertical rendering artifacts visible on the bug
screenshot with the oxygen-gtk Gtk theme, and also is a lot simpler than
what we did here before.
Change-Id: I21a167452f14ae52bd0d899b3ed467ce40540dec
Reviewed-on: https://gerrit.libreoffice.org/17631
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Jenkins <ci@libreoffice.org>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/edit.cxx | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 8d64c5e33e4f..39f5bf0c683d 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -501,7 +501,7 @@ long Edit::ImplGetTextYPosition() const return ( GetOutputSizePixel().Height() - GetTextHeight() ) / 2; } -void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout) +void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle, bool bLayout) { if (!IsReallyVisible()) return; @@ -543,7 +543,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, bool bLayout) if (pCursor) pCursor->Hide(); - ImplClearBackground(rRenderContext, 0, GetOutputSizePixel().Width()); + ImplClearBackground(rRenderContext, rRectangle, 0, GetOutputSizePixel().Width()); bool bPaintPlaceholderText = aText.isEmpty() && !maPlaceholderText.isEmpty(); @@ -1022,7 +1022,7 @@ int Edit::ImplGetNativeControlType() const return nCtrl; } -void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd ) +void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle, long nXStart, long nXEnd ) { /* * note: at this point the cursor must be switched off already @@ -1038,22 +1038,8 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, { // ImplPaintBorder() is a NOP, we have a native border, and this is a sub-edit of a control. // That means we have to draw the parent native widget to paint the edit area to clear our background. - long nLeft = mnXOffset + ImplGetExtraXOffset(); - long nTop = ImplGetTextYPosition(); - long nRight = GetOutputWidthPixel(); - long nHeight = GetTextHeight(); - Rectangle aEditArea(nLeft, nTop, nRight, nTop + nHeight); - - ControlType aCtrlType = ImplGetNativeControlType(); - ControlPart aCtrlPart = PART_ENTIRE_CONTROL; - Rectangle aCtrlRegion(0, 0, GetParent()->GetOutputWidthPixel(), GetParent()->GetOutputHeightPixel()); - ControlState nState = ControlState::ENABLED; - ImplControlValue aControlValue; - - rRenderContext.Push(PushFlags::CLIPREGION); - rRenderContext.SetClipRegion(vcl::Region(aEditArea)); - rRenderContext.DrawNativeControl(aCtrlType, aCtrlPart, aCtrlRegion, nState, aControlValue, OUString()); - rRenderContext.Pop(); + PaintBufferGuard g(ImplGetWindowImpl()->mpFrameData, GetParent()); + GetParent()->Paint(rRenderContext, rRectangle); } } @@ -1806,10 +1792,10 @@ void Edit::FillLayoutData() const const_cast<Edit*>(this)->Invalidate(); } -void Edit::Paint(vcl::RenderContext& rRenderContext, const Rectangle&) +void Edit::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRectangle) { if (!mpSubEdit) - ImplRepaint(rRenderContext); + ImplRepaint(rRenderContext, rRectangle); } void Edit::Resize() |