OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 #import "SkNSView.h" | 8 #import "SkNSView.h" |
10 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkSurface.h" |
11 #include "SkCGUtils.h" | 11 #include "SkCGUtils.h" |
12 #include "SkEvent.h" | 12 #include "SkEvent.h" |
13 SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build); | 13 SK_COMPILE_ASSERT(SK_SUPPORT_GPU, not_implemented_for_non_gpu_build); |
14 #include <OpenGL/gl.h> | 14 #include <OpenGL/gl.h> |
15 | 15 |
16 //#define FORCE_REDRAW | 16 //#define FORCE_REDRAW |
17 // Can be dropped when we no longer support 10.6. | 17 // Can be dropped when we no longer support 10.6. |
18 #define RETINA_API_AVAILABLE (defined(MAC_OS_X_VERSION_10_7) && \ | 18 #define RETINA_API_AVAILABLE (defined(MAC_OS_X_VERSION_10_7) && \ |
19 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_1
0_7) | 19 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_1
0_7) |
20 @implementation SkNSView | 20 @implementation SkNSView |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 self.fGLContext = nil; | 122 self.fGLContext = nil; |
123 self.fTitle = nil; | 123 self.fTitle = nil; |
124 [super dealloc]; | 124 [super dealloc]; |
125 } | 125 } |
126 | 126 |
127 //////////////////////////////////////////////////////////////////////////////// | 127 //////////////////////////////////////////////////////////////////////////////// |
128 | 128 |
129 - (void)drawSkia { | 129 - (void)drawSkia { |
130 fRedrawRequestPending = false; | 130 fRedrawRequestPending = false; |
131 if (fWind) { | 131 if (fWind) { |
132 SkAutoTUnref<SkCanvas> canvas(fWind->createCanvas()); | 132 SkAutoTUnref<SkSurface> surface(fWind->createSurface()); |
133 fWind->draw(canvas); | 133 fWind->draw(surface->getCanvas()); |
134 #ifdef FORCE_REDRAW | 134 #ifdef FORCE_REDRAW |
135 fWind->inval(NULL); | 135 fWind->inval(NULL); |
136 #endif | 136 #endif |
137 } | 137 } |
138 } | 138 } |
139 | 139 |
140 - (void)setSkTitle:(const char *)title { | 140 - (void)setSkTitle:(const char *)title { |
141 self.fTitle = [NSString stringWithUTF8String:title]; | 141 self.fTitle = [NSString stringWithUTF8String:title]; |
142 [[self window] setTitle:self.fTitle]; | 142 [[self window] setTitle:self.fTitle]; |
143 } | 143 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 [fGLContext release]; | 408 [fGLContext release]; |
409 fGLContext = nil; | 409 fGLContext = nil; |
410 } | 410 } |
411 | 411 |
412 - (void)present { | 412 - (void)present { |
413 if (nil != fGLContext) { | 413 if (nil != fGLContext) { |
414 [fGLContext flushBuffer]; | 414 [fGLContext flushBuffer]; |
415 } | 415 } |
416 } | 416 } |
417 @end | 417 @end |
OLD | NEW |