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

Unified Diff: src/views/mac/skia_mac.mm

Issue 2229853002: Sample app uses Ganesh before calling SkGraphics::Init(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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 | src/views/unix/skia_unix.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/views/mac/skia_mac.mm
diff --git a/src/views/mac/skia_mac.mm b/src/views/mac/skia_mac.mm
index 2a794071e1ea6a14091ad5e3d6530f35ae119922..98d4c4bd924429afe8860656620e735eb5a40090 100644
--- a/src/views/mac/skia_mac.mm
+++ b/src/views/mac/skia_mac.mm
@@ -9,6 +9,7 @@
#include <crt_externs.h>
#import <Cocoa/Cocoa.h>
#include "SkApplication.h"
+#include "SkGraphics.h"
#include "SkNSView.h"
@interface MainView : SkNSView {
@@ -55,48 +56,49 @@
@end
int main(int argc, char *argv[]) {
+ SkGraphics::Init();
signal(SIGPIPE, SIG_IGN);
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
-
+
NSApplication* app = [NSApplication sharedApplication];
NSUInteger windowStyle = (NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask | NSMiniaturizableWindowMask);
-
+
NSRect windowRect = NSMakeRect(100, 100, 1000, 1000);
NSWindow* window = [[NSWindow alloc] initWithContentRect:windowRect styleMask:windowStyle backing:NSBackingStoreBuffered defer:NO];
-
+
NSRect rect = [NSWindow contentRectForFrameRect:windowRect styleMask:windowStyle];
MainView* customView = [[MainView alloc] initWithFrame:rect];
[customView setTranslatesAutoresizingMaskIntoConstraints:NO];
NSView* contentView = window.contentView;
[contentView addSubview:customView];
NSDictionary *views = NSDictionaryOfVariableBindings(customView);
-
+
[contentView addConstraints:
[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[customView]|"
options:0
metrics:nil
views:views]];
-
+
[contentView addConstraints:
[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[customView]|"
options:0
metrics:nil
views:views]];
-
+
[customView begin];
[customView release];
-
+
[window makeKeyAndOrderFront:NSApp];
AppDelegate * appDelegate = [[[AppDelegate alloc] init] autorelease];
app.delegate = appDelegate;
-
+
NSMenu* menu=[[NSMenu alloc] initWithTitle:@"AMainMenu"];
NSMenuItem* item;
NSMenu* subMenu;
-
+
//Create the application menu.
item=[[NSMenuItem alloc] initWithTitle:@"Apple" action:NULL keyEquivalent:@""];
[menu addItem:item];
@@ -107,18 +109,18 @@ int main(int argc, char *argv[]) {
[subMenu addItem:item];
[item release];
[subMenu release];
-
+
//Add the menu to the app.
[app setMenu:menu];
-
+
[app setActivationPolicy:NSApplicationActivationPolicyRegular];
-
+
[app run];
[menu release];
[appDelegate release];
[window release];
[pool release];
-
+
return EXIT_SUCCESS;
}
« no previous file with comments | « no previous file | src/views/unix/skia_unix.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698