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

Unified Diff: ui/message_center/cocoa/opaque_views.mm

Issue 240703004: Fix the remaining subpixel antialiasing bugs in the notification center. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address nits. Created 6 years, 8 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 | « ui/message_center/cocoa/opaque_views.h ('k') | ui/message_center/cocoa/settings_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/cocoa/opaque_views.mm
diff --git a/ui/message_center/cocoa/opaque_views.mm b/ui/message_center/cocoa/opaque_views.mm
new file mode 100644
index 0000000000000000000000000000000000000000..a404850339e65fd572c2417b80456d3445a60cc4
--- /dev/null
+++ b/ui/message_center/cocoa/opaque_views.mm
@@ -0,0 +1,63 @@
+// Copyright (c) 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ui/message_center/cocoa/opaque_views.h"
+
+@implementation MCDropDown
+// The view must be opaque to render subpixel antialiasing.
+- (BOOL)isOpaque {
+ return YES;
+}
+
+// The view must also fill its background to render subpixel antialiasing.
+- (void)drawRect:(NSRect)dirtyRect {
+ [backgroundColor_ set];
+ NSRectFill(dirtyRect);
+ [super drawRect:dirtyRect];
+}
+
+- (NSColor*)backgroundColor {
+ return backgroundColor_;
+}
+
+- (void)setBackgroundColor:(NSColor*)backgroundColor {
+ backgroundColor_.reset([backgroundColor retain]);
+}
+@end
+
+@implementation MCTextField
+- (id)initWithFrame:(NSRect)frameRect backgroundColor:(NSColor*)color {
+ self = [self initWithFrame:frameRect];
+ if (self) {
+ [self setBackgroundColor:color];
+ backgroundColor_.reset([color retain]);
+ }
+ return self;
+}
+
+- (id)initWithFrame:(NSRect)frameRect {
+ self = [super initWithFrame:frameRect];
+ if (self) {
+ [self setAutoresizingMask:NSViewMinYMargin];
+ [self setBezeled:NO];
+ [self setBordered:NO];
+ [self setEditable:NO];
+ [self setSelectable:NO];
+ [self setDrawsBackground:YES];
+ }
+ return self;
+}
+
+// The view must be opaque to render subpixel antialiasing.
+- (BOOL)isOpaque {
+ return YES;
+}
+
+// The view must also fill its background to render subpixel antialiasing.
+- (void)drawRect:(NSRect)dirtyRect {
+ [backgroundColor_ set];
+ NSRectFill(dirtyRect);
+ [super drawRect:dirtyRect];
+}
+@end
« no previous file with comments | « ui/message_center/cocoa/opaque_views.h ('k') | ui/message_center/cocoa/settings_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698