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

Unified Diff: chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm

Issue 15729008: [OSX] ConstrainedWindow with "proper" background color. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Alternate version: Window Server draws background, NSView draws transparency. Created 7 years, 7 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/ui/cocoa/constrained_window/constrained_window_custom_window.mm
diff --git a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
index a875eac5a6ae10e7fb163d974485eb1d9627dd70..984b1765af364b31476c61ea18c7ab28c9f58577 100644
--- a/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
+++ b/chrome/browser/ui/cocoa/constrained_window/constrained_window_custom_window.mm
@@ -8,6 +8,7 @@
#import "chrome/browser/ui/chrome_style.h"
#import "chrome/browser/ui/cocoa/constrained_window/constrained_window_sheet_controller.h"
#include "skia/ext/skia_utils_mac.h"
+#include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h"
@implementation ConstrainedWindowCustomWindow
@@ -33,7 +34,8 @@
backing:bufferingType
defer:NO])) {
[self setHasShadow:YES];
- [self setBackgroundColor:[NSColor clearColor]];
+ [self setBackgroundColor:gfx::SkColorToCalibratedNSColor(
+ chrome_style::GetBackgroundColor())];
[self setOpaque:NO];
[self setReleasedWhenClosed:NO];
}
@@ -66,12 +68,19 @@
@implementation ConstrainedWindowCustomWindowContentView
- (void)drawRect:(NSRect)rect {
- NSBezierPath* path = [NSBezierPath
+ gfx::ScopedNSGraphicsContextSaveGState state;
+
+ // Draw symmetric difference between rect path and oval path as "clear".
+ NSBezierPath* ovalPath = [NSBezierPath
bezierPathWithRoundedRect:[self bounds]
xRadius:chrome_style::kBorderRadius
yRadius:chrome_style::kBorderRadius];
- [gfx::SkColorToCalibratedNSColor(
- chrome_style::GetBackgroundColor()) set];
+ NSBezierPath* path = [NSBezierPath bezierPathWithRect:[self bounds]];
+ [path appendBezierPath:ovalPath];
+ [path setWindingRule:NSEvenOddWindingRule];
+ [[NSGraphicsContext currentContext] setCompositingOperation:
+ NSCompositeCopy];
+ [[NSColor clearColor] set];
[path fill];
[[self window] invalidateShadow];
« 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