Permalink
Browse files

Update center drawing code

  • Loading branch information...
1 parent 4dfee3a commit 0dd647d32e3a33ef268f926ab2991b85cae661e6 @kgn committed Apr 5, 2012
Showing with 6 additions and 6 deletions.
  1. +6 −6 OSX/KGMenuBarPopup.m
View
@@ -183,12 +183,12 @@ - (void)dealloc{
self.menuBarPopupPanel = nil;
}
-- (void)drawImage:(NSImage *)aImage centeredInRect:(NSRect)aRect{
- NSRect imageRect = NSMakeRect((CGFloat)round(aRect.size.width*0.5f-aImage.size.width*0.5f),
- (CGFloat)round(aRect.size.height*0.5f-aImage.size.height*0.5f),
- aImage.size.width,
- aImage.size.height);
- [aImage drawInRect:imageRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f];
+- (void)drawImage:(NSImage *)image centeredInRect:(NSRect)rect{
+ NSRect imageRect = NSZeroRect;
+ imageRect.origin.x = round(KGMidWidth(rect)-image.size.width*0.5f);
+ imageRect.origin.y = round(KGMidHeight(rect)-image.size.height*0.5f);
+ imageRect.size = image.size;
+ [image drawInRect:imageRect fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0f];
}
- (void)drawRect:(NSRect)rect{

0 comments on commit 0dd647d

Please sign in to comment.