diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2015-08-06 18:11:44 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-07 08:12:48 +0000 |
commit | 207edc05ceadda49e311758cae67be1ea2d0e49d (patch) | |
tree | 4a5ac18788c57bc2785f9259c1c688670451f46d | |
parent | c0b75759ace5d0aca033504bc1cb2179fcce47d1 (diff) |
tdf#92982 vcl rendercontext: fix missing background repaint of Edit
Change-Id: Ic45f65d10835eb39b6709e7adeed1392905ea631
(cherry picked from commit f4a2c604c73337cd21cd98d975b4f2b943fbab60)
Reviewed-on: https://gerrit.libreoffice.org/17564
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | vcl/source/control/edit.cxx | 21 | ||||
-rw-r--r-- | vcl/source/window/paint.cxx | 12 |
2 files changed, 21 insertions, 12 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 7ddad42aaa99..e9f5c82ee42e 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1023,6 +1023,27 @@ void Edit::ImplClearBackground(vcl::RenderContext& rRenderContext, long nXStart, if( !(ImplUseNativeBorder(rRenderContext, GetStyle()) || IsPaintTransparent())) rRenderContext.Erase(aRect); + else if (SupportsDoubleBuffering() && mbIsSubEdit) + { + // 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(); + } } void Edit::ImplPaintBorder(vcl::RenderContext& rRenderContext, long nXStart, long nXEnd) diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index a02d60065b09..81f601ddcec2 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -190,18 +190,6 @@ void PaintHelper::StartBufferedPaint() ImplFrameData* pFrameData = m_pWindow->mpWindowImpl->mpFrameData; assert(!pFrameData->mbInBufferedPaint); - // Instead of creating a new VirtualDevice, just erase the area we'll be - // 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))); - { - PaintBufferGuard g(pFrameData, m_pWindow); - if (m_aPaintRect.IsEmpty()) - pFrameData->mpBuffer->Erase(Rectangle(Point(0, 0), m_pWindow->GetOutputSize())); - else - pFrameData->mpBuffer->Erase(m_aPaintRect); - } - pFrameData->mbInBufferedPaint = true; m_bStartedBufferedPaint = true; } |