From: Jay Freeman (saurik) Date: Thu, 4 Dec 2014 09:03:56 +0000 (-0800) Subject: Always prioritize "native" scale images, even @1x. X-Git-Tag: v0.9.3918~1 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/bb8b9a374320fe390c97740ad03cbecba5bf5f10 Always prioritize "native" scale images, even @1x. --- diff --git a/Library.mm b/Library.mm index b902d4a..573a9dd 100644 --- a/Library.mm +++ b/Library.mm @@ -304,25 +304,23 @@ static NSArray *$useScale$(NSArray *files, bool use = true) { NSString *base([file stringByDeletingPathExtension]); NSString *extension([file pathExtension]); - if (use) { - if (Scale_ != 1) { - [scaled addObject:[NSString stringWithFormat:@"%@@%ux~%@.%@", base, Scale_, idiom, extension]]; - [scaled addObject:[NSString stringWithFormat:@"%@@%ux.%@", base, Scale_, extension]]; - } - - for (unsigned scale(3); scale >= 2; --scale) - if (scale != Scale_) { - [scaled addObject:[NSString stringWithFormat:@"%@@%ux~%@.%@", base, scale, idiom, extension]]; - [scaled addObject:[NSString stringWithFormat:@"%@@%ux.%@", base, scale, extension]]; - } +#define WBScaleImage(scale) \ + if (scale == 1) { \ + [scaled addObject:[NSString stringWithFormat:@"%@~%@.%@", base, idiom, extension]]; \ + [scaled addObject:file]; \ + } else { \ + [scaled addObject:[NSString stringWithFormat:@"%@@%ux~%@.%@", base, scale, idiom, extension]]; \ + [scaled addObject:[NSString stringWithFormat:@"%@@%ux.%@", base, scale, extension]]; \ + } - [scaled addObject:[NSString stringWithFormat:@"%@~%@.%@", base, idiom, extension]]; + if (use) { + WBScaleImage(Scale_); - // if (!IsWild_) <- support old themes - [scaled addObject:file]; + for (unsigned scale(3); scale >= 1; --scale) + if (scale != Scale_) + WBScaleImage(scale); } else if ([base hasSuffix: @"@2x"] || [base hasSuffix:@"@3x"]) { - [scaled addObject:[NSString stringWithFormat:@"%@~%@.%@", base, idiom, extension]]; - [scaled addObject:file]; + WBScaleImage(1); // XXX: this actually can't be used, as the person loading the file doesn't realize that the @2x changed /*NSString *rest([base substringWithRange:NSMakeRange(0, [base length] - 3)]);