Skip to content

Commit 43cc308

Browse files
committed
Merge pull request #66 from ajsecord/conversion-errors-b64
Fixes more floating-point conversion warnings.
2 parents b15d169 + 1c34c26 commit 43cc308

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

components/Switch/src/MDCSwitch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ + (UIColor *)defaultOnTintColor {
297297

298298
+ (UIColor *)defaultOffThumbColor {
299299
// Original MDCSwitchStyleLight Color
300-
return [UIColor colorWithWhite:0.980 alpha:1.0];
300+
return [UIColor colorWithWhite:0.980f alpha:1];
301301
}
302302

303303
+ (UIColor *)defaultOffTrackColor {
@@ -306,7 +306,7 @@ + (UIColor *)defaultOffTrackColor {
306306

307307
+ (UIColor *)defaultDisabledThumbColor {
308308
// Original MDCSwitchStyleLight Color
309-
return [UIColor colorWithWhite:0.741 alpha:1.0];
309+
return [UIColor colorWithWhite:0.741f alpha:1];
310310
}
311311

312312
+ (UIColor *)defaultDisabledTrackColor {

components/private/Color/src/UIColor+MDC.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ + (UIColor *)mdc_colorInterpolatedFromColor:(UIColor *)fromColor
2222
toColor:(UIColor *)toColor
2323
percent:(CGFloat)percent {
2424
// Clamp percent to [0.0, 1.0]
25-
percent = MAX(0.0, percent);
26-
percent = MIN(1.0, percent);
25+
percent = MAX(0, percent);
26+
percent = MIN(1, percent);
2727

2828
CGFloat r1, g1, b1, a1;
29-
r1 = g1 = b1 = a1 = 1.0;
29+
r1 = g1 = b1 = a1 = 1;
3030
if (![fromColor getRed:&r1 green:&g1 blue:&b1 alpha:&a1]) {
3131
[fromColor getWhite:&r1 alpha:&a1];
3232
g1 = b1 = r1;
3333
};
3434

3535
CGFloat r2, g2, b2, a2;
36-
r2 = g2 = b2 = a2 = 1.0;
36+
r2 = g2 = b2 = a2 = 1;
3737
if (![toColor getRed:&r2 green:&g2 blue:&b2 alpha:&a2]) {
3838
[toColor getWhite:&r2 alpha:&a2];
3939
g2 = b2 = r2;
4040
}
4141

42-
CGFloat rfinal = r1 * (1.0 - percent) + r2 * percent;
43-
CGFloat gfinal = g1 * (1.0 - percent) + g2 * percent;
44-
CGFloat bfinal = b1 * (1.0 - percent) + b2 * percent;
45-
CGFloat afinal = a1 * (1.0 - percent) + a2 * percent;
42+
CGFloat rfinal = r1 * (1 - percent) + r2 * percent;
43+
CGFloat gfinal = g1 * (1 - percent) + g2 * percent;
44+
CGFloat bfinal = b1 * (1 - percent) + b2 * percent;
45+
CGFloat afinal = a1 * (1 - percent) + a2 * percent;
4646

4747
return [UIColor colorWithRed:rfinal green:gfinal blue:bfinal alpha:afinal];
4848
}

0 commit comments

Comments
 (0)