Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update center drawing code

  • Loading branch information...
commit 0dd647d32e3a33ef268f926ab2991b85cae661e6 1 parent 4dfee3a
@kgn authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 OSX/KGMenuBarPopup.m
View
12 OSX/KGMenuBarPopup.m
@@ -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{
Please sign in to comment.
Something went wrong with that request. Please try again.