Support images larger than self.bounds
This commit is contained in:
parent
f9644463a9
commit
91457fe739
1 changed files with 6 additions and 6 deletions
|
@ -86,24 +86,24 @@ const CGFloat kVerticalTitleMargin = 2;
|
||||||
if (inMouseEventSequence_ && alternateImage_) {
|
if (inMouseEventSequence_ && alternateImage_) {
|
||||||
image = alternateImage_.get();
|
image = alternateImage_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply the higlight color if the image is a template image. When this moves
|
// Apply the higlight color if the image is a template image. When this moves
|
||||||
// to using the new [NSStatusItem button] API, this should work automagically.
|
// to using the new [NSStatusItem button] API, this should work automagically.
|
||||||
if ([image isTemplate] == YES) {
|
if ([image isTemplate] == YES) {
|
||||||
NSImage * imageWithColor = [image copy];
|
NSImage * imageWithColor = [image copy];
|
||||||
[imageWithColor lockFocus];
|
[imageWithColor lockFocus];
|
||||||
[[self colorWithHighlight: highlightContent] set];
|
[[self colorWithHighlight: highlightContent] set];
|
||||||
NSRectFillUsingOperation(self.bounds, NSCompositeSourceAtop);
|
CGRect imageBounds = CGRectMake(0,0, image.size.width, image.size.height);
|
||||||
|
NSRectFillUsingOperation(imageBounds, NSCompositeSourceAtop);
|
||||||
[imageWithColor unlockFocus];
|
[imageWithColor unlockFocus];
|
||||||
image = imageWithColor;
|
image = imageWithColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the image
|
// Draw the image
|
||||||
[image drawInRect: CGRectMake(
|
[image drawInRect: CGRectMake(
|
||||||
roundf(([self iconWidth] - [image size].width) / 2),
|
roundf(([self iconWidth] - image.size.width) / 2),
|
||||||
roundf((thickness - [image size].height) / 2),
|
roundf((thickness - image.size.height) / 2),
|
||||||
[image size].width,
|
image.size.width,
|
||||||
[image size].height
|
image.size.height
|
||||||
)];
|
)];
|
||||||
|
|
||||||
if (title_) {
|
if (title_) {
|
||||||
|
|
Loading…
Reference in a new issue