vcl/inc/ilstbox.hxx | 8 +- vcl/source/control/combobox.cxx | 2 vcl/source/control/ilstbox.cxx | 135 +++++++++++----------------------------- vcl/source/control/lstbox.cxx | 6 - vcl/source/window/split.cxx | 16 ++-- vcl/source/window/status.cxx | 6 - 6 files changed, 57 insertions(+), 116 deletions(-)
New commits: commit 0359a59b6dec4a3c1e8fdc6e51d179fd6db4aad7 Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Mon May 25 16:29:20 2015 +0900 forward RenderCOntext to UserDraw, remove obsolete draw call Change-Id: I29dcc22a6840e7104bdf68d050b616c8e06226fa diff --git a/vcl/source/window/status.cxx b/vcl/source/window/status.cxx index a3273ec..b9669d7 100644 --- a/vcl/source/window/status.cxx +++ b/vcl/source/window/status.cxx @@ -462,7 +462,7 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen } else { - UserDrawEvent aODEvt(this, aTextRect, pItem->mnId); + UserDrawEvent aODEvt(&rRenderContext, aTextRect, pItem->mnId); UserDraw(aODEvt); } } @@ -505,8 +505,7 @@ void StatusBar::ImplDrawItem(vcl::RenderContext& rRenderContext, bool bOffScreen } } - const OutputDevice* pOutDev = GetOutDev(); - if (!pOutDev->ImplIsRecordLayout()) + if (!rRenderContext.ImplIsRecordLayout()) CallEventListeners(VCLEVENT_STATUSBAR_DRAWITEM, reinterpret_cast<void*>(pItem->mnId)); } @@ -1260,7 +1259,6 @@ void StatusBar::SetItemData( sal_uInt16 nItemId, void* pNewData ) Update(); Rectangle aRect = ImplGetItemRectPos(nPos); Invalidate(aRect); - ImplDrawItem(*this, true, nPos, false, false); Flush(); } } commit dd0996f7b230e76f35cc3464b85dd46e90098c3d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Mon May 25 16:18:23 2015 +0900 use RenderContext in user draw, use ApplySettings Change-Id: I6cc22677000459a5f19bfb207007f5c246f187e0 diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx index 8a5bca2..363483e 100644 --- a/vcl/inc/ilstbox.hxx +++ b/vcl/inc/ilstbox.hxx @@ -564,11 +564,11 @@ private: bool mbInUserDraw : 1; bool mbEdgeBlending : 1; - void ImplDraw( bool bLayout = false ); + void ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout = false); protected: virtual void FillLayoutData() const SAL_OVERRIDE; -public: +public: ImplWin( vcl::Window* pParent, WinBits nWinStyle = 0 ); virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE; @@ -598,7 +598,8 @@ public: void EnableUserDraw( bool bUserDraw ) { mbUserDrawEnabled = bUserDraw; } bool IsUserDrawEnabled() const { return mbUserDrawEnabled; } - void DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos = false, bool bLayout = false ); + void DrawEntry(vcl::RenderContext& rRenderContext, bool bDrawImage, bool bDrawText, + bool bDrawTextAtImagePos = false, bool bLayout = false); bool GetEdgeBlending() const { return mbEdgeBlending; } void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; } @@ -606,7 +607,6 @@ public: virtual void ShowFocus(const Rectangle& rRect) SAL_OVERRIDE; using Control::ImplInitSettings; - void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); virtual void ApplySettings(vcl::RenderContext& rRenderContext) SAL_OVERRIDE; }; diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 59656c9..f16fd05 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -1131,7 +1131,7 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines void ComboBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true ); + mpImplLB->GetMainWindow()->ApplySettings(*pDev); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index 28e5889..5bdc36b 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -502,7 +502,7 @@ ImplListBoxWindow::ImplListBoxWindow( vcl::Window* pParent, WinBits nWinStyle ) SetTextFillColor(); SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) ); - ImplInitSettings( true, true, true ); + ApplySettings(*this); ImplCalcMetrics(); } @@ -537,35 +537,6 @@ void ImplListBoxWindow::ApplySettings(vcl::RenderContext& rRenderContext) rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); } -void ImplListBoxWindow::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) -{ - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if (bFont) - { - vcl::Font aFont = rStyleSettings.GetFieldFont(); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(*this, aFont); - } - - if (bFont || bForeground) - { - Color aTextColor = rStyleSettings.GetFieldTextColor(); - if (IsControlForeground()) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if (bBackground) - { - if (IsControlBackground()) - SetBackground(GetControlBackground()); - else - SetBackground(rStyleSettings.GetFieldColor()); - } -} - void ImplListBoxWindow::ImplCalcMetrics() { mnMaxWidth = 0; @@ -1743,7 +1714,7 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 } else { - ImplInitSettings(false, true, false); + ApplySettings(*this); if (!IsEnabled()) rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); rRenderContext.SetTextFillColor(); @@ -1765,7 +1736,7 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32 nCurr = GetEntryList()->FindEntry(GetEntryList()->GetEntryText(nCurr)); nCurr = sal::static_int_cast<sal_Int32>(nCurr - GetEntryList()->GetMRUCount()); - UserDrawEvent aUDEvt(this, aRect, nPos, nCurr); + UserDrawEvent aUDEvt(&rRenderContext, aRect, nPos, nCurr); userDrawSignal(&aUDEvt); mbInUserDraw = false; } @@ -2088,7 +2059,7 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) if ( nType == StateChangedType::Zoom ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); ImplCalcMetrics(); Invalidate(); } @@ -2099,18 +2070,18 @@ void ImplListBoxWindow::StateChanged( StateChangedType nType ) } else if ( nType == StateChangedType::ControlFont ) { - ImplInitSettings( true, false, false ); + ApplySettings(*this); ImplCalcMetrics(); Invalidate(); } else if ( nType == StateChangedType::ControlForeground ) { - ImplInitSettings( false, true, false ); + ApplySettings(*this); Invalidate(); } else if ( nType == StateChangedType::ControlBackground ) { - ImplInitSettings( false, false, true ); + ApplySettings(*this); Invalidate(); } else if( nType == StateChangedType::Enable ) @@ -2131,7 +2102,7 @@ void ImplListBoxWindow::DataChanged( const DataChangedEvent& rDCEvt ) (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) ) { ImplClearLayoutData(); - ImplInitSettings( true, true, true ); + ApplySettings(*this); ImplCalcMetrics(); Invalidate(); } @@ -2652,7 +2623,8 @@ void ImplWin::MouseButtonDown( const MouseEvent& ) void ImplWin::FillLayoutData() const { mpControlData->mpLayoutData = new vcl::ControlLayoutData(); - const_cast<ImplWin*>(this)->ImplDraw( true ); + ImplWin* pThis = const_cast<ImplWin*>(this); + pThis->ImplDraw(*pThis, true); } bool ImplWin::PreNotify( NotifyEvent& rNEvt ) @@ -2676,17 +2648,17 @@ bool ImplWin::PreNotify( NotifyEvent& rNEvt ) return Control::PreNotify(rNEvt); } -void ImplWin::ImplDraw( bool bLayout ) +void ImplWin::ImplDraw(vcl::RenderContext& rRenderContext, bool bLayout) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - if( ! bLayout ) + if (!bLayout) { bool bNativeOK = false; ControlState nState = ControlState::ENABLED; - if ( IsNativeControlSupported(CTRL_LISTBOX, PART_ENTIRE_CONTROL) - && IsNativeControlSupported(CTRL_LISTBOX, HAS_BACKGROUND_TEXTURE) ) + if (rRenderContext.IsNativeControlSupported(CTRL_LISTBOX, PART_ENTIRE_CONTROL) + && rRenderContext.IsNativeControlSupported(CTRL_LISTBOX, HAS_BACKGROUND_TEXTURE) ) { // Repaint the (focused) area similarly to // ImplSmallBorderWindowView::DrawWindow() in @@ -2728,17 +2700,17 @@ void ImplWin::ImplDraw( bool bLayout ) nState, aControlValue, OUString() ); } - bNativeOK = DrawNativeControl( CTRL_LISTBOX, PART_ENTIRE_CONTROL, aCtrlRegion, nState, - aControlValue, OUString() ); + bNativeOK = rRenderContext.DrawNativeControl(CTRL_LISTBOX, PART_ENTIRE_CONTROL, aCtrlRegion, + nState, aControlValue, OUString()); } - if( IsEnabled() ) + if (IsEnabled()) { if (HasFocus() && !ImplGetSVData()->maNWFData.mbDDListBoxNoTextArea) { - SetTextColor( rStyleSettings.GetHighlightTextColor() ); - SetFillColor( rStyleSettings.GetHighlightColor() ); - DrawRect( maFocusRect ); + rRenderContext.SetTextColor( rStyleSettings.GetHighlightTextColor() ); + rRenderContext.SetFillColor( rStyleSettings.GetHighlightColor() ); + rRenderContext.DrawRect( maFocusRect ); } else { @@ -2757,31 +2729,31 @@ void ImplWin::ImplDraw( bool bLayout ) else aColor = rStyleSettings.GetFieldTextColor(); } - if( IsControlForeground() ) + if (IsControlForeground()) aColor = GetControlForeground(); - SetTextColor( aColor ); - if ( !bNativeOK ) - Erase( maFocusRect ); + rRenderContext.SetTextColor(aColor); + if (!bNativeOK) + rRenderContext.Erase(maFocusRect); } } else // Disabled { - SetTextColor( rStyleSettings.GetDisableColor() ); - if ( !bNativeOK ) - Erase( maFocusRect ); + rRenderContext.SetTextColor(rStyleSettings.GetDisableColor()); + if (!bNativeOK) + rRenderContext.Erase(maFocusRect); } } if ( IsUserDrawEnabled() ) { mbInUserDraw = true; - UserDrawEvent aUDEvt( this, maFocusRect, mnItemPos, 0 ); + UserDrawEvent aUDEvt(&rRenderContext, maFocusRect, mnItemPos, 0); userDrawSignal( &aUDEvt ); mbInUserDraw = false; } else { - DrawEntry( true, true, false, bLayout ); + DrawEntry(rRenderContext, true, true, false, bLayout); } } @@ -2805,47 +2777,18 @@ void ImplWin::ApplySettings(vcl::RenderContext& rRenderContext) rRenderContext.SetBackground(rStyleSettings.GetFieldColor()); } -void ImplWin::ImplInitSettings(bool bFont, bool bForeground, bool bBackground) +void ImplWin::Paint( vcl::RenderContext& rRenderContext, const Rectangle& ) { - const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); - - if (bFont) - { - vcl::Font aFont = rStyleSettings.GetFieldFont(); - if (IsControlFont()) - aFont.Merge(GetControlFont()); - SetZoomedPointFont(*this, aFont); - } - - if (bFont || bForeground) - { - Color aTextColor = rStyleSettings.GetFieldTextColor(); - if (IsControlForeground()) - aTextColor = GetControlForeground(); - SetTextColor( aTextColor ); - } - - if (bBackground) - { - if (IsControlBackground()) - SetBackground(GetControlBackground()); - else - SetBackground(rStyleSettings.GetFieldColor()); - } + ImplDraw(rRenderContext); } -void ImplWin::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& ) -{ - ImplDraw(); -} - -void ImplWin::DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos, bool bLayout ) +void ImplWin::DrawEntry(vcl::RenderContext& rRenderContext, bool bDrawImage, bool bDrawText, bool bDrawTextAtImagePos, bool bLayout) { long nBorder = 1; - Size aOutSz = GetOutputSizePixel(); + Size aOutSz = rRenderContext.GetOutputSizePixel(); bool bImage = !!maImage; - if( bDrawImage && bImage && !bLayout ) + if (bDrawImage && bImage && !bLayout) { DrawImageFlags nStyle = DrawImageFlags::NONE; Size aImgSz = maImage.GetSizePixel(); @@ -2857,13 +2800,13 @@ void ImplWin::DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImageP if ( !IsZoom() ) { - DrawImage( aPtImg, *pImage, nStyle ); + rRenderContext.DrawImage( aPtImg, *pImage, nStyle ); } else { aImgSz.Width() = CalcZoom( aImgSz.Width() ); aImgSz.Height() = CalcZoom( aImgSz.Height() ); - DrawImage( aPtImg, aImgSz, *pImage, nStyle ); + rRenderContext.DrawImage( aPtImg, aImgSz, *pImage, nStyle ); } const sal_uInt16 nEdgeBlendingPercent(GetEdgeBlending() ? rStyleSettings.GetEdgeBlending() : 0); @@ -2877,7 +2820,7 @@ void ImplWin::DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImageP if(!aBlendFrame.IsEmpty()) { - DrawBitmapEx(aPtImg, aBlendFrame); + rRenderContext.DrawBitmapEx(aPtImg, aBlendFrame); } } } @@ -2905,7 +2848,7 @@ void ImplWin::DrawEntry( bool bDrawImage, bool bDrawText, bool bDrawTextAtImageP MetricVector* pVector = bLayout ? &mpControlData->mpLayoutData->m_aUnicodeBoundRects : NULL; OUString* pDisplayText = bLayout ? &mpControlData->mpLayoutData->m_aDisplayText : NULL; - DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText ); + rRenderContext.DrawText( aTextRect, maString, nTextStyle, pVector, pDisplayText ); } if( HasFocus() && !bLayout ) diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 857f78f..bd5bb65 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -375,7 +375,7 @@ void ListBox::ApplySettings(vcl::RenderContext& rRenderContext) void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) { - mpImplLB->GetMainWindow()->ImplInitSettings( true, true, true ); + mpImplLB->GetMainWindow()->ApplySettings(*pDev); Point aPos = pDev->LogicToPixel( rPos ); Size aSize = pDev->LogicToPixel( rSize ); @@ -555,7 +555,7 @@ void ListBox::DataChanged( const DataChangedEvent& rDCEvt ) if ( mpImplWin ) { mpImplWin->SetSettings( GetSettings() ); // If not yet set... - mpImplWin->ImplInitSettings(true, true, true); + mpImplWin->ApplySettings(*this); mpBtn->SetSettings( GetSettings() ); ImplInitDropDownButton( mpBtn ); @@ -1386,7 +1386,7 @@ void ListBox::DrawEntry(const UserDrawEvent& rEvt, bool bDrawImage, bool bDrawTe if (rEvt.GetDevice() == mpImplLB->GetMainWindow()) mpImplLB->GetMainWindow()->DrawEntry(*rEvt.GetDevice(), rEvt.GetItemId(), bDrawImage, bDrawText, bDrawTextAtImagePos ); else if (rEvt.GetDevice() == mpImplWin) - mpImplWin->DrawEntry(bDrawImage, bDrawText, bDrawTextAtImagePos); + mpImplWin->DrawEntry(*rEvt.GetDevice(), bDrawImage, bDrawText, bDrawTextAtImagePos); } void ListBox::SetUserItemSize( const Size& rSz ) commit 950b6046c7618cf4792d9f70c4fab9a6a8dde5cf Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Mon May 25 16:15:36 2015 +0900 convert splitter to use RenderContext Change-Id: Ia010aa7daf14fcaeee5d46cc4e5b8ed21e00efcf diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index ff30617..002a0e0 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -697,15 +697,15 @@ void Splitter::DataChanged( const DataChangedEvent& rDCEvt ) } } -void Splitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& rPaintRect ) +void Splitter::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rPaintRect) { - DrawRect( rPaintRect ); + rRenderContext.DrawRect(rPaintRect); - Polygon aPoly( rPaintRect ); - tools::PolyPolygon aPolyPoly( aPoly ); - DrawTransparent( aPolyPoly, 85 ); + Polygon aPoly(rPaintRect); + tools::PolyPolygon aPolyPoly(aPoly); + rRenderContext.DrawTransparent(aPolyPoly, 85); - if( mbKbdSplitting ) + if (mbKbdSplitting) { LineInfo aInfo( LINE_DASH ); //aInfo.SetDashLen( 2 ); @@ -714,11 +714,11 @@ void Splitter::Paint( vcl::RenderContext& /*rRenderContext*/, const Rectangle& r aInfo.SetDotLen( 2 ); aInfo.SetDotCount( 3 ); - DrawPolyLine( aPoly, aInfo ); + rRenderContext.DrawPolyLine( aPoly, aInfo ); } else { - DrawRect( rPaintRect ); + rRenderContext.DrawRect(rPaintRect); } }
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits