diff --git a/third_party/apple_sample_code/ImageAndTextCell.m b/third_party/apple_sample_code/ImageAndTextCell.m index e7e66640f8b60d..349cd454e6ff3f 100644 --- a/third_party/apple_sample_code/ImageAndTextCell.m +++ b/third_party/apple_sample_code/ImageAndTextCell.m @@ -122,15 +122,15 @@ - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { NSRectFill(imageFrame); } imageFrame.origin.x += 3; + imageFrame.origin.y += ceil((cellFrame.size.height - imageSize.height) / 2); imageFrame.size = imageSize; - if ([controlView isFlipped]) { - imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2); - } else { - imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2); - } - - [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver]; + [image drawInRect:imageFrame + fromRect:NSZeroRect + operation:NSCompositeSourceOver + fraction:1.0 + respectFlipped:YES + hints:nil]; } [super drawWithFrame:cellFrame inView:controlView]; } diff --git a/third_party/apple_sample_code/README.chromium b/third_party/apple_sample_code/README.chromium index a1adc03608fba8..09d2982bf732a2 100644 --- a/third_party/apple_sample_code/README.chromium +++ b/third_party/apple_sample_code/README.chromium @@ -1,7 +1,13 @@ Name: Apple sample code URL: http://developer.apple.com/ +Version: unknown +Security Critical: Yes Local changes: * ImageAndTextCell.h: Changed 'image' property to 'retain' mode to fix a crash. * ImageAndTextCell.m: Moved '@synthesize' to to the top of '@implementation' as suggested by a clang warning. +* ImageAndTextCell.m: Switched from -[NSImage compositeToPoint:operation:] to + -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:] + as the former is deprecated and doesn't work properly in + HiDPI.