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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 - (void) setFrameSize:(NSSize)newSize { | 115 - (void) setFrameSize:(NSSize)newSize { |
116 [super setFrameSize:newSize]; | 116 [super setFrameSize:newSize]; |
117 [self resizeSkView:newSize]; | 117 [self resizeSkView:newSize]; |
118 } | 118 } |
119 | 119 |
120 - (void)dealloc { | 120 - (void)dealloc { |
121 delete fWind; | 121 [self freeNativeWind]; |
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 - (void)freeNativeWind { |
| 128 delete fWind; |
| 129 fWind = nil; |
| 130 } |
| 131 |
127 //////////////////////////////////////////////////////////////////////////////// | 132 //////////////////////////////////////////////////////////////////////////////// |
128 | 133 |
129 - (void)drawSkia { | 134 - (void)drawSkia { |
130 fRedrawRequestPending = false; | 135 fRedrawRequestPending = false; |
131 if (fWind) { | 136 if (fWind) { |
132 SkAutoTUnref<SkSurface> surface(fWind->createSurface()); | 137 SkAutoTUnref<SkSurface> surface(fWind->createSurface()); |
133 fWind->draw(surface->getCanvas()); | 138 fWind->draw(surface->getCanvas()); |
134 #ifdef FORCE_REDRAW | 139 #ifdef FORCE_REDRAW |
135 fWind->inval(NULL); | 140 fWind->inval(NULL); |
136 #endif | 141 #endif |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 [fGLContext release]; | 413 [fGLContext release]; |
409 fGLContext = nil; | 414 fGLContext = nil; |
410 } | 415 } |
411 | 416 |
412 - (void)present { | 417 - (void)present { |
413 if (nil != fGLContext) { | 418 if (nil != fGLContext) { |
414 [fGLContext flushBuffer]; | 419 [fGLContext flushBuffer]; |
415 } | 420 } |
416 } | 421 } |
417 @end | 422 @end |
OLD | NEW |