comparison src/video/gapi/SDL_gapivideo.c @ 3902:aa07730d792f SDL-1.2

Fix of HBITMAP leak in GAPI driver by Dmitry Yakimov. Fixes Bugzilla #371.
author Ryan C. Gordon <icculus@icculus.org>
date Mon, 11 Dec 2006 19:51:19 +0000
parents 8d9bb0cf2c2a
children 31c7c57af8a4
comparison
equal deleted inserted replaced
3901:3a7248359cdd 3902:aa07730d792f
1176 static void GAPI_WinPAINT(_THIS, HDC hdc) 1176 static void GAPI_WinPAINT(_THIS, HDC hdc)
1177 { 1177 {
1178 // draw current offscreen buffer on hdc 1178 // draw current offscreen buffer on hdc
1179 1179
1180 int bpp = 16; // we always use either 8 or 16 bpp internally 1180 int bpp = 16; // we always use either 8 or 16 bpp internally
1181 1181 HGDIOBJ prevObject;
1182 unsigned short *bitmapData; 1182 unsigned short *bitmapData;
1183 HBITMAP hb; 1183 HBITMAP hb;
1184 HDC srcDC; 1184 HDC srcDC;
1185 1185
1186 // Create a DIB 1186 // Create a DIB
1214 1214
1215 // copy data 1215 // copy data
1216 // FIXME: prevent misalignment, but I've never seen non aligned width of screen 1216 // FIXME: prevent misalignment, but I've never seen non aligned width of screen
1217 memcpy(bitmapData, this->hidden->buffer, pHeader->biSizeImage); 1217 memcpy(bitmapData, this->hidden->buffer, pHeader->biSizeImage);
1218 srcDC = CreateCompatibleDC(hdc); 1218 srcDC = CreateCompatibleDC(hdc);
1219 SelectObject(srcDC, hb); 1219 prevObject = SelectObject(srcDC, hb);
1220 1220
1221 BitBlt(hdc, 0, 0, this->hidden->w, this->hidden->h, srcDC, 0, 0, SRCCOPY); 1221 BitBlt(hdc, 0, 0, this->hidden->w, this->hidden->h, srcDC, 0, 0, SRCCOPY);
1222 1222
1223 SelectObject(srcDC, prevObject);
1223 DeleteObject(hb); 1224 DeleteObject(hb);
1224 DeleteDC(srcDC); 1225 DeleteDC(srcDC);
1225 } 1226 }
1226 1227
1227 int GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) 1228 int GAPI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors)