tdf#95173 vcl: fix partially drawn progressbar widget
Commit e6c2951f19 (delegate RenderContext,
invalidate - prgsbar, scrbar, 2015-04-29) switched
ProgressBar::SetValue() from direct partial paint to invalidate + full
paint. This means that ProgressBar::ImplDrawProgress() has to paint the
whole progressbar, not only just the delta between the old and the new
value.
Remove the not needed mnPreviousPercent member and just paint from 0 to
the percent value, like we did before the above commit, that does the
needed full paint.
Change-Id: Id45ee918248b5fa6647bd766a49b707da1e5846f
Reviewed-on: https://gerrit.libreoffice.org/73886
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
@@ -54,13 +54,12 @@ private:
|
||||
long mnPrgsHeight;
|
||||
sal_uInt16 mnPercent;
|
||||
sal_uInt16 mnPercentCount;
|
||||
sal_uInt16 mnPreviousPercent;
|
||||
bool mbCalcNew;
|
||||
|
||||
using Window::ImplInit;
|
||||
SAL_DLLPRIVATE void ImplInit();
|
||||
SAL_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
|
||||
SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nOldPerc, sal_uInt16 nNewPerc);
|
||||
SAL_DLLPRIVATE void ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nNewPerc);
|
||||
|
||||
public:
|
||||
ProgressBar( vcl::Window* pParent, WinBits nWinBits );
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
void ProgressBar::ImplInit()
|
||||
{
|
||||
mnPercent = 0;
|
||||
mnPreviousPercent = 0;
|
||||
mbCalcNew = true;
|
||||
|
||||
ImplInitSettings( true, true, true );
|
||||
@@ -112,7 +111,7 @@ void ProgressBar::ImplInitSettings( bool bFont,
|
||||
}
|
||||
}
|
||||
|
||||
void ProgressBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nOldPerc, sal_uInt16 nNewPerc)
|
||||
void ProgressBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt16 nNewPerc)
|
||||
{
|
||||
if (mbCalcNew)
|
||||
{
|
||||
@@ -141,13 +140,13 @@ void ProgressBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt1
|
||||
}
|
||||
|
||||
::DrawProgress(this, rRenderContext, maPos, PROGRESSBAR_OFFSET, mnPrgsWidth, mnPrgsHeight,
|
||||
nOldPerc * 100, nNewPerc * 100, mnPercentCount,
|
||||
/*nPercent1=*/0, nNewPerc * 100, mnPercentCount,
|
||||
tools::Rectangle(Point(), GetSizePixel()));
|
||||
}
|
||||
|
||||
void ProgressBar::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/)
|
||||
{
|
||||
ImplDrawProgress(rRenderContext, mnPreviousPercent, mnPercent);
|
||||
ImplDrawProgress(rRenderContext, mnPercent);
|
||||
}
|
||||
|
||||
void ProgressBar::Resize()
|
||||
@@ -165,7 +164,6 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
|
||||
{
|
||||
mbCalcNew = true;
|
||||
mnPercent = nNewPercent;
|
||||
mnPreviousPercent = 0;
|
||||
if ( IsReallyVisible() )
|
||||
{
|
||||
Invalidate();
|
||||
@@ -174,7 +172,6 @@ void ProgressBar::SetValue( sal_uInt16 nNewPercent )
|
||||
}
|
||||
else if ( mnPercent != nNewPercent )
|
||||
{
|
||||
mnPreviousPercent = mnPercent;
|
||||
mnPercent = nNewPercent;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user