TrackControl overflow problem |
Post Reply |
Author | |
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
Posted: 20 June 2010 at 11:17pm |
Hi there.
I was getting strange behaviour with my TrackControl where the slider would jump to the end of my time line range when I reached a certain position. I tracked the issue down to an overflow in the CXTPTrackControlHeader OnMoveSlider (~line 180) method.
With large timelines, as I had, the initial multiplication overflowed into negative. The fromPosition and toPosition can actually be removed and the delta performed before the multiplication and division. Even better would be to divide first, as I don't think the difference in rounding would matter. I have made the change in my code and all is working well. As an aside to this, I would suggest that CXTPTrackControl handled unsigned. Aaron |
|
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3 Language: Visual C++ 6 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks, replaced to
int fromPosition = MulDiv(m_ptStartDrag.x, (pControl->GetTimeLineMax() - pControl->GetTimeLineMin()), rcSliderArea.Width()); int toPosition = MulDiv(pt.x, (pControl->GetTimeLineMax() - pControl->GetTimeLineMin()), rcSliderArea.Width()); |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Aaron Koolen
Groupie Joined: 22 July 2009 Status: Offline Points: 32 |
Post Options
Thanks(0)
|
No problem. I also found a couple of other places where the same thing occurs.
XTPrackPaintManager::DrawTrackHeader, around line 305. XTPTrackHeader::OnLButtonDown, around line 418. Both of those perform out of range multiplications. Cheers Aaron |
|
Product: Xtreme ToolkitPro v13.3.0 (MFC)
Platform: Windows XP (32bit) - SP 3 Language: Visual C++ 6 |
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Thanks, replaced also.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |