]> git.saurik.com Git - cydia.git/commitdiff
Constrain the dimensions of icons rendered from repositories.
authorJay Freeman (saurik) <saurik@saurik.com>
Sat, 12 Mar 2011 21:13:21 +0000 (13:13 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Mon, 14 Mar 2011 12:09:08 +0000 (05:09 -0700)
MobileCydia.mm

index eb33e74e9a5900ec72cc28f62fa5f4ba96221bb6..fb483a8623e92064de311e90d1e7abe71d13babe 100644 (file)
@@ -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;