Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1290)

Unified Diff: chrome/browser/cocoa/browser_frame_view.mm

Issue 879003: Fix resolution independence in theming. Improve from "pretty broken" to "brok... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/browser_frame_view.mm
===================================================================
--- chrome/browser/cocoa/browser_frame_view.mm (revision 41337)
+++ chrome/browser/cocoa/browser_frame_view.mm (working copy)
@@ -130,7 +130,7 @@
// Only paint the top of the window.
NSWindow* window = [self window];
- NSRect windowRect = [window frame];
+ NSRect windowRect = [self convertRect:[window frame] fromView:nil];
windowRect.origin = NSMakePoint(0, 0);
NSRect paintRect = windowRect;
@@ -162,16 +162,18 @@
// Pinstripe the top.
if (themed) {
- windowRect = [window frame];
+ NSSize windowPixel = [self convertSizeFromBase:NSMakeSize(1, 1)];
+
+ windowRect = [self convertRect:[window frame] fromView:nil];
windowRect.origin = NSMakePoint(0, 0);
- windowRect.origin.y -= 0.5;
- windowRect.origin.x -= 0.5;
- windowRect.size.width += 1.0;
+ windowRect.origin.y -= 0.5 * windowPixel.height;
+ windowRect.origin.x -= 0.5 * windowPixel.width;
+ windowRect.size.width += windowPixel.width;
[[NSColor colorWithCalibratedWhite:1.0 alpha:0.5] set];
NSBezierPath* path = [NSBezierPath bezierPathWithRoundedRect:windowRect
xRadius:cornerRadius
yRadius:cornerRadius];
- [path setLineWidth:1.0];
+ [path setLineWidth:windowPixel.width];
[path stroke];
}
}
@@ -232,7 +234,12 @@
NSPoint phase = kBrowserFrameViewPatternPhaseOffset;
phase.y += NSHeight(bounds);
- phase = [view convertPoint:phase toView:nil];
+ // Align the phase to physical pixels so resizing the window under HiDPI
+ // doesn't cause wiggling of the theme.
+ phase = [view convertPointToBase:phase];
+ phase.x = floor(phase.x);
+ phase.y = floor(phase.y);
+ phase = [view convertPointFromBase:phase];
Nico 2010/03/11 23:38:32 :-)
[[NSGraphicsContext currentContext] setPatternPhase:phase];
[themeImageColor set];
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698