@@ -187,10 +187,10 @@ - (void)drawRect:(CGRect)rect
187
187
- (UIImage *)createImageForCurrentProgress
188
188
{
189
189
const int ALPHA = 0 ;
190
- const int RED = 1 ;
190
+ const int RED = 3 ;
191
191
const int GREEN = 2 ;
192
- const int BLUE = 3 ;
193
-
192
+ const int BLUE = 1 ;
193
+
194
194
// Create image rectangle with current image width/height
195
195
CGRect imageRect = CGRectMake (0 , 0 , _progressImage.size .width * _progressImage.scale , _progressImage.size .height * _progressImage.scale );
196
196
@@ -218,23 +218,23 @@ - (UIImage *)createImageForCurrentProgress
218
218
int yTo = height;
219
219
220
220
if (_progressDirection == M13ProgressViewImageProgressDirectionBottomToTop) {
221
- yTo = height * (int )( 1 - self.progress );
221
+ yTo = ( int )( height * (1 - self.progress ) );
222
222
} else if (_progressDirection == M13ProgressViewImageProgressDirectionTopToBottom) {
223
- yFrom = height * ( int ) self.progress ;
223
+ yFrom = ( int )( height * self.progress ) ;
224
224
} else if (_progressDirection == M13ProgressViewImageProgressDirectionLeftToRight) {
225
- xFrom = width * ( int ) self.progress ;
225
+ xFrom = ( int )( width * self.progress ) ;
226
226
} else if (_progressDirection == M13ProgressViewImageProgressDirectionRightToLeft) {
227
- xTo = width * (int )( 1 - self.progress );
227
+ xTo = ( int )( width * (1 - self.progress ) );
228
228
}
229
229
230
230
for (int x = xFrom; x < xTo; x++) {
231
231
for (int y = yFrom; y < yTo; y++) {
232
232
// Get the pixel
233
- uint32_t *rgbaPixel = (uint32_t *) &pixels[y * width + x];
233
+ uint8_t *rgbaPixel = (uint8_t *) &pixels[y * width + x];
234
234
// Convert
235
235
if (_drawGreyscaleBackground) {
236
236
// Convert to grayscale using luma coding: http://en.wikipedia.org/wiki/Grayscale#Converting_color_to_grayscale
237
- uint32_t gray = (uint32_t )(0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE]);
237
+ uint8_t gray = (uint8_t )(0.3 * rgbaPixel[RED] + 0.59 * rgbaPixel[GREEN] + 0.11 * rgbaPixel[BLUE]);
238
238
// set the pixels to gray
239
239
rgbaPixel[RED] = gray;
240
240
rgbaPixel[GREEN] = gray;
0 commit comments