diff options
author | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-12 13:13:21 -0800 |
---|---|---|
committer | Jay Freeman (saurik) <saurik@saurik.com> | 2011-03-14 05:09:08 -0700 |
commit | 7e1f9f6a377c44c295f676e245fdc19c4d3ffae3 (patch) | |
tree | 8b78c4e78b8af9038926d7d7b63c80e728a6f77b | |
parent | c83678e8f52adad8ee379161700b0e9ef802779b (diff) |
Constrain the dimensions of icons rendered from repositories.
-rw-r--r-- | MobileCydia.mm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm index eb33e74..fb483a8 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -5531,8 +5531,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { CGRect rect; rect.size = [(UIImage *) icon_ size]; - rect.size.width /= 4; - rect.size.height /= 4; + while (rect.size.width > 32 || rect.size.height > 32) { + rect.size.width /= 2; + rect.size.height /= 2; + } rect.origin.x = 14 - rect.size.width / 4; rect.origin.y = 14 - rect.size.height / 4; @@ -5572,8 +5574,10 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { CGRect rect; rect.size = [(UIImage *) icon_ size]; - rect.size.width /= 2; - rect.size.height /= 2; + while (rect.size.width > 64 || rect.size.height > 64) { + rect.size.width /= 2; + rect.size.height /= 2; + } rect.origin.x = 25 - rect.size.width / 2; rect.origin.y = 25 - rect.size.height / 2; @@ -7124,15 +7128,6 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [package parse]; UIImage *icon([package icon]); [self _returnPNGWithImage:icon forRequest:request]; - } else if ([command isEqualToString:@"source-icon"]) { - if (path == nil) - goto fail; - path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSString *source(Simplify(path)); - UIImage *icon([UIImage imageAtPath:[NSString stringWithFormat:@"%@/Sources/%@.png", App_, source]]); - if (icon == nil) - icon = [UIImage applicationImageNamed:@"unknown.png"]; - [self _returnPNGWithImage:icon forRequest:request]; } else if ([command isEqualToString:@"uikit-image"]) { if (path == nil) goto fail; |