- onoff = (x < x3);
- endCapPos = ((style && onoff) ? x3 : (kProgressBarWidth * vc_uiscale));
- if (x < (kProgressBarCapWidth * vc_uiscale))
- {
- if (x2 < (kProgressBarCapWidth * vc_uiscale))
- w = x2 - x;
- else
- w = (kProgressBarCapWidth * vc_uiscale) - x;
- data = progressmeter_leftcap[vc_uiscale >= 2][onoff];
- data += x;
- vc_blit_rect(ox + x, oy, x, w,
- (kProgressBarHeight * vc_uiscale),
- (kProgressBarCapWidth * vc_uiscale),
- (kProgressBarWidth * vc_uiscale),
- data, vc_progressmeter_backbuffer, flags);
- }
- else if (x < (endCapPos - (kProgressBarCapWidth * vc_uiscale)))
- {
- if (x2 < (endCapPos - (kProgressBarCapWidth * vc_uiscale)))
- w = x2 - x;
- else
- w = (endCapPos - (kProgressBarCapWidth * vc_uiscale)) - x;
- data = progressmeter_middle[vc_uiscale >= 2][onoff];
- vc_blit_rect(ox + x, oy, x, w,
- (kProgressBarHeight * vc_uiscale),
- 1,
- (kProgressBarWidth * vc_uiscale),
- data, vc_progressmeter_backbuffer, flags);
- }
- else
- {
- w = endCapPos - x;
- data = progressmeter_rightcap[vc_uiscale >= 2][onoff];
- data += x - (endCapPos - (kProgressBarCapWidth * vc_uiscale));
- vc_blit_rect(ox + x, oy, x, w,
- (kProgressBarHeight * vc_uiscale),
- (kProgressBarCapWidth * vc_uiscale),
- (kProgressBarWidth * vc_uiscale),
- data, vc_progressmeter_backbuffer, flags);
+ onoff = (i < pos);
+ endCapPos = ((style && onoff) ? pos : barWidth);
+ endCapStart = endCapPos - capWidth;
+ if (flags & kDataBack) { // restore back bits
+ width = end; // loop done after this iteration
+ data = NULL;
+ srcRow = 0;
+ } else if (i < capWidth) { // drawing the left cap
+ width = (end < capWidth) ? (end - i) : (capWidth - i);
+ data = progressmeter_leftcap[vc_uiscale >= 2][onoff];
+ data += i;
+ srcRow = capWidth;
+ } else if (i < endCapStart) { // drawing the middle
+ width = (end < endCapStart) ? (end - i) : (endCapStart - i);
+ data = progressmeter_middle[vc_uiscale >= 2][onoff];
+ srcRow = 1;
+ } else { // drawing the right cap
+ width = endCapPos - i;
+ data = progressmeter_rightcap[vc_uiscale >= 2][onoff];
+ data += i - endCapStart;
+ srcRow = capWidth;
+ }
+
+ switch (flags & kDataRotate) {
+ case kDataRotate90: // left middle, bar goes down
+ rectW = barHeight;
+ rectH = width;
+ rectX = ((vinfo.v_width / 3) - (barHeight / 2));
+ rectY = ((vinfo.v_height - barWidth) / 2) + i;
+ bx = i * barHeight;
+ backRow = barHeight;
+ break;
+ case kDataRotate180: // middle upper, bar goes left
+ rectW = width;
+ rectH = barHeight;
+ rectX = ((vinfo.v_width - barWidth) / 2) + barWidth - width - i;
+ rectY = (vinfo.v_height / 3) - (barHeight / 2);
+ bx = barWidth - width - i;
+ backRow = barWidth;
+ break;
+ case kDataRotate270: // right middle, bar goes up
+ rectW = barHeight;
+ rectH = width;
+ rectX = (vinfo.v_width - (vinfo.v_width / 3) - (barHeight / 2));
+ rectY = ((vinfo.v_height - barWidth) / 2) + barWidth - width - i;
+ bx = (barWidth - width - i) * barHeight;
+ backRow = barHeight;
+ break;
+ default:
+ case kDataRotate0: // middle lower, bar goes right
+ rectW = width;
+ rectH = barHeight;
+ rectX = ((vinfo.v_width - barWidth) / 2) + i;
+ rectY = vinfo.v_height - (vinfo.v_height / 3) - (barHeight / 2);
+ bx = i;
+ backRow = barWidth;
+ break;