[ui] improve progress bar refresh

* Closes #699
This commit is contained in:
Pete Batard 2016-03-10 16:13:16 +00:00
parent a10a207790
commit b82462bb7d
6 changed files with 21 additions and 17 deletions

View file

@ -612,7 +612,7 @@ static BOOL FormatFAT32(DWORD DriveIndex)
format_percent = 0.0f;
for (i=0; i<(SystemAreaSize+BurstSize-1); i+=BurstSize) {
if (_GetTickCount64() > LastRefresh + 25) {
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
format_percent = (100.0f*i)/(1.0f*(SystemAreaSize+BurstSize));
PrintInfo(0, MSG_217, format_percent);
@ -1449,7 +1449,7 @@ static DWORD WINAPI CloseFormatPromptThread(LPVOID param) {
static void update_progress(const uint64_t processed_bytes)
{
if (_GetTickCount64() > LastRefresh + 25) {
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
format_percent = (100.0f*processed_bytes)/(1.0f*img_report.projected_size);
PrintInfo(0, MSG_261, format_percent);
@ -1497,7 +1497,7 @@ static BOOL WriteDrive(HANDLE hPhysicalDrive, HANDLE hSourceImage)
// will be as fast, if not faster, than whatever async scheme you can come up with.
rSize = BufSize;
for (wb = 0, wSize = 0; wb < (uint64_t)SelectedDrive.DiskSize; wb += wSize) {
if (_GetTickCount64() > LastRefresh + 25) {
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
format_percent = (100.0f*wb) / (1.0f*target_size);
PrintInfo(0, hSourceImage?MSG_261:MSG_286, format_percent);
@ -2043,7 +2043,7 @@ DWORD WINAPI SaveImageThread(void* param)
}
if (rSize == 0)
break;
if (_GetTickCount64() > LastRefresh + 25) {
if (_GetTickCount64() > LastRefresh + MAX_REFRESH) {
LastRefresh = _GetTickCount64();
format_percent = (100.0f*wb)/(1.0f*SelectedDrive.DiskSize);
PrintInfo(0, MSG_261, format_percent);