Permalink
Browse files

fix merge issues

  • Loading branch information...
2 parents c57e31b + 2ba43a8 commit 8059a2ab76d6ab81e7c205e479899b7b1253e285 @comex committed Jul 6, 2010
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -31,5 +31,6 @@
- (void)displaySyncInRect:(CGRect *)rect;
- (CGSize)movieSize;
- (void)diedWithError:(NSString *)error;
+- (UIImage *)scaleImage:(UIImage *) image maxWidth:(float) maxWidth maxHeight:(float) maxHeight;
@end
@@ -88,6 +88,8 @@ - (void)initialUp {
}
- (id)initWithArguments:(NSDictionary *)arguments_ {
+ UIImage *logo;
+
if(self = [super init]) {
arguments = [arguments_ retain];
id attributes = [arguments objectForKey:@"WebPlugInAttributesKey"];
@@ -102,17 +104,19 @@ - (id)initWithArguments:(NSDictionary *)arguments_ {
return self;
}
}
+ logo = [UIImage imageWithContentsOfFile:@"/System/Library/Internet Plug-Ins/Frash.webplugin/logo.jpg"];
initialButton = [[UIButton alloc] initWithFrame:self.frame];
- initialButton.backgroundColor = [UIColor colorWithWhite:(0xc3/256.0) alpha:1.0];
- [initialButton setTitleColor:[UIColor colorWithWhite:(0x3c/256.0) alpha:1.0] forState:UIControlStateNormal];
- [initialButton setTitleShadowColor:[UIColor colorWithWhite:1.0 alpha:0.53] forState:UIControlStateNormal];
- initialButton.titleLabel.shadowOffset = CGSizeMake(0.0, 1.0);
- [initialButton setTitle:@"Flash" forState:UIControlStateNormal];
- initialButton.reversesTitleShadowWhenHighlighted = YES;
+
initialButton.hidden = NO;
+ initialButton.backgroundColor = [UIColor whiteColor];
+
+ [initialButton setImage: [self scaleImage:logo maxWidth:self.frame.size.width maxHeight:self.frame.size.height] forState:UIControlStateNormal];
+ [initialButton setContentMode:UIViewContentModeCenter];
+
[initialButton addTarget:self action:@selector(initialClicked) forControlEvents:UIControlEventTouchUpInside];
[initialButton addTarget:self action:@selector(initialDown) forControlEvents:UIControlEventTouchDown];
[initialButton addTarget:self action:@selector(initialUp) forControlEvents:UIControlEventTouchUpOutside];
+
[self addSubview:initialButton];
//self.contentMode = UIViewContentModeRedraw;
//self.backgroundColor = [UIColor grayColor];
@@ -235,7 +239,7 @@ - (void)dealloc {
- (id)initWithFrame:(CGRect)frame {
if ((self = [super initWithFrame:frame])) {
CALayer *lyr = self.layer;
- lyr.backgroundColor = [[UIColor blackColor] CGColor];
+ lyr.backgroundColor = [[UIColor clearColor] CGColor];
self.multipleTouchEnabled = YES;
}
return self;
@@ -266,5 +270,50 @@ - (void)goToURL:(NSURL *)URL inFrame:(NSString *)frameName {
[frame loadRequest:[NSURLRequest requestWithURL:URL]];
}
+- (UIImage *)scaleImage:(UIImage *) image maxWidth:(float) maxWidth maxHeight:(float) maxHeight
+{
+ CGImageRef imgRef = image.CGImage;
+ CGFloat width = CGImageGetWidth(imgRef);
+ CGFloat height = CGImageGetHeight(imgRef);
+
+ if (width <= maxWidth && height <= maxHeight)
+ {
+ return image;
+ }
+
+ CGAffineTransform transform = CGAffineTransformIdentity;
+ CGRect bounds = CGRectMake(0, 0, width, height);
+
+ if (width > maxWidth || height > maxHeight)
+ {
+ CGFloat ratio = width/height;
+
+ if (ratio > 1)
+ {
+ bounds.size.width = maxWidth;
+ bounds.size.height = bounds.size.width / ratio;
+ }
+ else
+ {
+ bounds.size.height = maxHeight;
+ bounds.size.width = bounds.size.height * ratio;
+ }
+ }
+
+ CGFloat scaleRatio = bounds.size.width / width;
+ UIGraphicsBeginImageContext(bounds.size);
+ CGContextRef context = UIGraphicsGetCurrentContext();
+ CGContextScaleCTM(context, scaleRatio, -scaleRatio);
+ CGContextTranslateCTM(context, 0, -height);
+ CGContextConcatCTM(context, transform);
+ CGContextDrawImage(UIGraphicsGetCurrentContext(), CGRectMake(0, 0, width, height), imgRef);
+
+ UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();
+ UIGraphicsEndImageContext();
+
+ return imageCopy;
+
+}
+
@synthesize server;
@end
View
@@ -54,7 +54,6 @@ - (id)initWithStream:(stream_t)stream_ URL:(NSURL *)url rpc_fd:(int)rpc_fd_ {
stream = stream_;
rpc_fd = rpc_fd_;
request = [[NSMutableURLRequest alloc] initWithURL:url];
-
}
return self;
}
@@ -259,8 +258,7 @@ int new_post_connection(int rpc_fd, stream_t stream, void *url, size_t url_len,
int new_get_connection(int rpc_fd, stream_t stream, void *url, size_t url_len, void *target, size_t target_len, void **url_abs, size_t *url_abs_len) {
Server *self = get_server(rpc_fd);
NSString *str = [[[NSString alloc] initWithBytes:url length:url_len encoding:NSUTF8StringEncoding] autorelease];
- NSURL *nsurl = [NSURL URLWithString:str
- relativeToURL:[self->delegate baseURL]];
+ NSURL *nsurl = [NSURL URLWithString:str relativeToURL:[self->delegate baseURL]];
if(target_len > 0) {
// This is wrong.
NSLog(@"new_connection with target %s", target);
View
@@ -6,7 +6,9 @@
(allow mach-lookup
(global-name "com.apple.mediaserverd")
(global-name "com.apple.audio.AudioQueueServer")
+ (global-name "com.apple.coremedia.admin")
(global-name "com.apple.system.logger")
+ (global-name "com.apple.SystemConfiguration.configd")
)
(allow ipc-posix-shm)
@@ -15,6 +17,10 @@
(allow file-ioctl)
+(allow file-read-metadata
+ (literal "/")
+ )
+
(allow file-read*
(regex #"/usr/lib(/|$)")
(regex #"/usr/share(/|$)")
@@ -24,6 +30,7 @@
(regex #"/private/var/mobile$")
(regex #"/private/var/mobile/Library/Preferences/\.GlobalPreferences\.plist")
(regex #"/dev/urandom")
+ (regex #"/etc(/|$)")
(regex #"/var$")
(regex #"/var/stash.*icu[^/]*\.dat$")
(regex #"/private/var/db/timezone(/|$)")

0 comments on commit 8059a2a

Please sign in to comment.