Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 2803:8fe261aae1bb
Fixed the texture format for the software fallback
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 29 Nov 2008 06:27:26 +0000 |
parents | 9f6601537163 |
children | 365fe1a2aad5 |
comparison
equal
deleted
inserted
replaced
2802:c2834344ca44 | 2803:8fe261aae1bb |
---|---|
1353 Uint8 *planes[3]; | 1353 Uint8 *planes[3]; |
1354 | 1354 |
1355 SDL_SW_YUVTexture *sw; | 1355 SDL_SW_YUVTexture *sw; |
1356 | 1356 |
1357 SDL_TextureID textureID; | 1357 SDL_TextureID textureID; |
1358 Uint32 texture_format; | |
1358 }; | 1359 }; |
1359 | 1360 |
1360 SDL_Overlay * | 1361 SDL_Overlay * |
1361 SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display) | 1362 SDL_CreateYUVOverlay(int w, int h, Uint32 format, SDL_Surface * display) |
1362 { | 1363 { |
1447 return NULL; | 1448 return NULL; |
1448 } | 1449 } |
1449 | 1450 |
1450 /* Create a supported RGB format texture for display */ | 1451 /* Create a supported RGB format texture for display */ |
1451 SDL_GetCurrentDisplayMode(¤t_mode); | 1452 SDL_GetCurrentDisplayMode(¤t_mode); |
1453 texture_format = current_mode.format; | |
1452 overlay->hwdata->textureID = | 1454 overlay->hwdata->textureID = |
1453 SDL_CreateTexture(current_mode.format, | 1455 SDL_CreateTexture(texture_format, |
1454 SDL_TEXTUREACCESS_STREAMING, w, h); | 1456 SDL_TEXTUREACCESS_STREAMING, w, h); |
1455 } | 1457 } |
1456 if (!overlay->hwdata->textureID) { | 1458 if (!overlay->hwdata->textureID) { |
1457 SDL_FreeYUVOverlay(overlay); | 1459 SDL_FreeYUVOverlay(overlay); |
1458 return NULL; | 1460 return NULL; |
1459 } | 1461 } |
1462 overlay->hwdata->texture_format = texture_format; | |
1460 | 1463 |
1461 return overlay; | 1464 return overlay; |
1462 } | 1465 } |
1463 | 1466 |
1464 int | 1467 int |
1519 srcrect.x = 0; | 1522 srcrect.x = 0; |
1520 srcrect.y = 0; | 1523 srcrect.y = 0; |
1521 srcrect.w = overlay->w; | 1524 srcrect.w = overlay->w; |
1522 srcrect.h = overlay->h; | 1525 srcrect.h = overlay->h; |
1523 SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, | 1526 SDL_SW_CopyYUVToRGB(overlay->hwdata->sw, &srcrect, |
1524 SDL_PIXELFORMAT_RGB888, overlay->w, | 1527 overlay->hwdata->texture_format, |
1525 overlay->h, pixels, pitch); | 1528 overlay->w, overlay->h, pixels, pitch); |
1526 SDL_UnlockTexture(overlay->hwdata->textureID); | 1529 SDL_UnlockTexture(overlay->hwdata->textureID); |
1527 } | 1530 } |
1528 } else { | 1531 } else { |
1529 SDL_UnlockTexture(overlay->hwdata->textureID); | 1532 SDL_UnlockTexture(overlay->hwdata->textureID); |
1530 } | 1533 } |