comparison src/video/quartz/SDL_QuartzWindow.m @ 4204:976bc19f8f6b SDL-1.2

1.2 Quartz video: Ripped out QuickDraw and QuickTime. Now we use the software path for YUV, and CoreGraphics for 2D stuff. There are several other 10.6 fixes in here, too...now we can build a 64-bit SDL for Snow Leopard!
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 21 Sep 2009 06:08:23 +0000
parents a1b03ba2fcd0
children cb44bf8f8a0f
comparison
equal deleted inserted replaced
4203:7e5486073044 4204:976bc19f8f6b
123 [ super setFrame:frameRect display:flag ]; 123 [ super setFrame:frameRect display:flag ];
124 124
125 newViewFrame = [ window_view frame ]; 125 newViewFrame = [ window_view frame ];
126 126
127 SDL_PrivateResize (newViewFrame.size.width, newViewFrame.size.height); 127 SDL_PrivateResize (newViewFrame.size.width, newViewFrame.size.height);
128
129 /* If not OpenGL, we have to update the pixels and pitch */
130 if ( ! ( SDL_VideoSurface->flags & SDL_OPENGL ) ) {
131
132 CGrafPtr thePort = [ window_view qdPort ];
133 LockPortBits ( thePort );
134
135 SDL_VideoSurface->pixels = GetPixBaseAddr ( GetPortPixMap ( thePort ) );
136 SDL_VideoSurface->pitch = GetPixRowBytes ( GetPortPixMap ( thePort ) );
137
138 /*
139 SDL_VideoSurface->pixels now points to the window's pixels
140 We want it to point to the *view's* pixels
141 */
142 {
143 int vOffset = [ qz_window frame ].size.height -
144 newViewFrame.size.height - newViewFrame.origin.y;
145
146 int hOffset = newViewFrame.origin.x;
147
148 SDL_VideoSurface->pixels = (Uint8 *)SDL_VideoSurface->pixels + (vOffset * SDL_VideoSurface->pitch) + hOffset * (device_bpp/8);
149 }
150
151 UnlockPortBits ( thePort );
152 }
153 } 128 }
154 } 129 }
155 130
156 - (void)appDidHide:(NSNotification*)note 131 - (void)appDidHide:(NSNotification*)note
157 { 132 {
181 /*SDL_PrivateExpose ();*/ 156 /*SDL_PrivateExpose ();*/
182 157
183 SDL_PrivateAppActive (1, SDL_APPACTIVE); 158 SDL_PrivateAppActive (1, SDL_APPACTIVE);
184 } 159 }
185 160
186 - (id)initWithContentRect:(NSRect)contentRect styleMask:(unsigned int)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag 161 - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)styleMask backing:(NSBackingStoreType)backingType defer:(BOOL)flag
187 { 162 {
188 /* Make our window subclass receive these application notifications */ 163 /* Make our window subclass receive these application notifications */
189 [ [ NSNotificationCenter defaultCenter ] addObserver:self 164 [ [ NSNotificationCenter defaultCenter ] addObserver:self
190 selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ]; 165 selector:@selector(appDidHide:) name:NSApplicationDidHideNotification object:NSApp ];
191 166