OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #import "SkNSView.h" | 8 #import "SkNSView.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkSurface.h" | 10 #include "SkSurface.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 [[NSNotificationCenter defaultCenter] addObserver:self | 49 [[NSNotificationCenter defaultCenter] addObserver:self |
50 selector:@selector(backingPropertiesCh
anged:) | 50 selector:@selector(backingPropertiesCh
anged:) |
51 name:@"NSWindowDidChangeBackingPropert
iesNotification" | 51 name:@"NSWindowDidChangeBackingPropert
iesNotification" |
52 object:[self window]]; | 52 object:[self window]]; |
53 if (fWind) { | 53 if (fWind) { |
54 fWind->setVisibleP(true); | 54 fWind->setVisibleP(true); |
55 NSSize size = self.frame.size; | 55 NSSize size = self.frame.size; |
56 #if RETINA_API_AVAILABLE | 56 #if RETINA_API_AVAILABLE |
57 size = [self convertSizeToBacking:self.frame.size]; | 57 size = [self convertSizeToBacking:self.frame.size]; |
58 #endif | 58 #endif |
59 fWind->resize((int) size.width, (int) size.height, | 59 fWind->resize((int) size.width, (int) size.height); |
60 kN32_SkColorType); | |
61 [[self window] setAcceptsMouseMovedEvents:YES]; | 60 [[self window] setAcceptsMouseMovedEvents:YES]; |
62 } | 61 } |
63 } | 62 } |
64 | 63 |
65 -(BOOL) isFlipped { | 64 -(BOOL) isFlipped { |
66 return YES; | 65 return YES; |
67 } | 66 } |
68 | 67 |
69 - (BOOL)acceptsFirstResponder { | 68 - (BOOL)acceptsFirstResponder { |
70 return YES; | 69 return YES; |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 420 } |
422 | 421 |
423 - (void)setVSync:(bool)enable { | 422 - (void)setVSync:(bool)enable { |
424 if (fGLContext) { | 423 if (fGLContext) { |
425 GLint interval = enable ? 1 : 0; | 424 GLint interval = enable ? 1 : 0; |
426 CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; | 425 CGLContextObj ctx = (CGLContextObj)[fGLContext CGLContextObj]; |
427 CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); | 426 CGLSetParameter(ctx, kCGLCPSwapInterval, &interval); |
428 } | 427 } |
429 } | 428 } |
430 @end | 429 @end |
OLD | NEW |