Mercurial > sdl-ios-xcode
comparison src/SDL_compat.c @ 1965:a788656ca29a
SDL constants are all uppercase.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 05 Aug 2006 17:09:42 +0000 |
parents | 83946ee0ff1f |
children | 01e29c3e9a29 |
comparison
equal
deleted
inserted
replaced
1964:071b6598d48f | 1965:a788656ca29a |
---|---|
399 switch (bpp) { | 399 switch (bpp) { |
400 case 0: | 400 case 0: |
401 if (desktop_format) { | 401 if (desktop_format) { |
402 desired_format = desktop_format; | 402 desired_format = desktop_format; |
403 } else { | 403 } else { |
404 desired_format = SDL_PixelFormat_RGB888; | 404 desired_format = SDL_PIXELFORMAT_RGB888; |
405 } | 405 } |
406 break; | 406 break; |
407 case 8: | 407 case 8: |
408 desired_format = SDL_PixelFormat_Index8; | 408 desired_format = SDL_PIXELFORMAT_INDEX8; |
409 break; | 409 break; |
410 case 15: | 410 case 15: |
411 desired_format = SDL_PixelFormat_RGB555; | 411 desired_format = SDL_PIXELFORMAT_RGB555; |
412 break; | 412 break; |
413 case 16: | 413 case 16: |
414 desired_format = SDL_PixelFormat_RGB565; | 414 desired_format = SDL_PIXELFORMAT_RGB565; |
415 break; | 415 break; |
416 case 24: | 416 case 24: |
417 desired_format = SDL_PixelFormat_RGB24; | 417 desired_format = SDL_PIXELFORMAT_RGB24; |
418 break; | 418 break; |
419 case 32: | 419 case 32: |
420 desired_format = SDL_PixelFormat_RGB888; | 420 desired_format = SDL_PIXELFORMAT_RGB888; |
421 break; | 421 break; |
422 default: | 422 default: |
423 SDL_SetError("Unsupported bpp in SDL_SetVideoMode()"); | 423 SDL_SetError("Unsupported bpp in SDL_SetVideoMode()"); |
424 return NULL; | 424 return NULL; |
425 } | 425 } |
456 } | 456 } |
457 | 457 |
458 /* Create a renderer for the window */ | 458 /* Create a renderer for the window */ |
459 if (SDL_CreateRenderer | 459 if (SDL_CreateRenderer |
460 (SDL_VideoWindow, -1, | 460 (SDL_VideoWindow, -1, |
461 SDL_Renderer_SingleBuffer | SDL_Renderer_PresentDiscard) < 0) { | 461 SDL_RENDERER_SINGLEBUFFER | SDL_RENDERER_PRESENTDISCARD) < 0) { |
462 return NULL; | 462 return NULL; |
463 } | 463 } |
464 SDL_GetRendererInfo(-1, &SDL_VideoRendererInfo); | 464 SDL_GetRendererInfo(-1, &SDL_VideoRendererInfo); |
465 | 465 |
466 /* Create a texture for the screen surface */ | 466 /* Create a texture for the screen surface */ |
467 SDL_VideoTexture = | 467 SDL_VideoTexture = |
468 SDL_CreateTexture(desired_format, SDL_TextureAccess_Local, width, | 468 SDL_CreateTexture(desired_format, SDL_TEXTUREACCESS_LOCAL, width, |
469 height); | 469 height); |
470 if (!SDL_VideoTexture) { | 470 if (!SDL_VideoTexture) { |
471 SDL_VideoTexture = | 471 SDL_VideoTexture = |
472 SDL_CreateTexture(SDL_PixelFormat_RGB888, SDL_TextureAccess_Local, | 472 SDL_CreateTexture(SDL_PIXELFORMAT_RGB888, SDL_TEXTUREACCESS_LOCAL, |
473 width, height); | 473 width, height); |
474 } | 474 } |
475 if (!SDL_VideoTexture) { | 475 if (!SDL_VideoTexture) { |
476 return NULL; | 476 return NULL; |
477 } | 477 } |
657 | 657 |
658 /* Fall through to video surface update */ | 658 /* Fall through to video surface update */ |
659 screen = SDL_VideoSurface; | 659 screen = SDL_VideoSurface; |
660 } | 660 } |
661 if (screen == SDL_VideoSurface) { | 661 if (screen == SDL_VideoSurface) { |
662 if (SDL_VideoRendererInfo.flags & SDL_Renderer_PresentCopy) { | 662 if (SDL_VideoRendererInfo.flags & SDL_RENDERER_PRESENTCOPY) { |
663 for (i = 0; i < numrects; ++i) { | 663 for (i = 0; i < numrects; ++i) { |
664 SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i], | 664 SDL_RenderCopy(SDL_VideoTexture, &rects[i], &rects[i], |
665 SDL_TextureBlendMode_None, | 665 SDL_TEXTUREBLENDMODE_NONE, |
666 SDL_TextureScaleMode_None); | 666 SDL_TEXTURESCALEMODE_NONE); |
667 } | 667 } |
668 } else { | 668 } else { |
669 SDL_Rect rect; | 669 SDL_Rect rect; |
670 rect.x = 0; | 670 rect.x = 0; |
671 rect.y = 0; | 671 rect.y = 0; |
672 rect.w = screen->w; | 672 rect.w = screen->w; |
673 rect.h = screen->h; | 673 rect.h = screen->h; |
674 SDL_RenderCopy(SDL_VideoTexture, &rect, &rect, | 674 SDL_RenderCopy(SDL_VideoTexture, &rect, &rect, |
675 SDL_TextureBlendMode_None, | 675 SDL_TEXTUREBLENDMODE_NONE, |
676 SDL_TextureScaleMode_None); | 676 SDL_TEXTURESCALEMODE_NONE); |
677 } | 677 } |
678 SDL_RenderPresent(); | 678 SDL_RenderPresent(); |
679 } | 679 } |
680 } | 680 } |
681 | 681 |
1302 return NULL; | 1302 return NULL; |
1303 } | 1303 } |
1304 | 1304 |
1305 switch (format) { | 1305 switch (format) { |
1306 case SDL_YV12_OVERLAY: | 1306 case SDL_YV12_OVERLAY: |
1307 texture_format = SDL_PixelFormat_YV12; | 1307 texture_format = SDL_PIXELFORMAT_YV12; |
1308 break; | 1308 break; |
1309 case SDL_IYUV_OVERLAY: | 1309 case SDL_IYUV_OVERLAY: |
1310 texture_format = SDL_PixelFormat_IYUV; | 1310 texture_format = SDL_PIXELFORMAT_IYUV; |
1311 break; | 1311 break; |
1312 case SDL_YUY2_OVERLAY: | 1312 case SDL_YUY2_OVERLAY: |
1313 texture_format = SDL_PixelFormat_YUY2; | 1313 texture_format = SDL_PIXELFORMAT_YUY2; |
1314 break; | 1314 break; |
1315 case SDL_UYVY_OVERLAY: | 1315 case SDL_UYVY_OVERLAY: |
1316 texture_format = SDL_PixelFormat_UYVY; | 1316 texture_format = SDL_PIXELFORMAT_UYVY; |
1317 break; | 1317 break; |
1318 case SDL_YVYU_OVERLAY: | 1318 case SDL_YVYU_OVERLAY: |
1319 texture_format = SDL_PixelFormat_YVYU; | 1319 texture_format = SDL_PIXELFORMAT_YVYU; |
1320 break; | 1320 break; |
1321 default: | 1321 default: |
1322 SDL_SetError("Unknown YUV format"); | 1322 SDL_SetError("Unknown YUV format"); |
1323 return NULL; | 1323 return NULL; |
1324 } | 1324 } |
1362 overlay->pitches[0] = overlay->w * 2; | 1362 overlay->pitches[0] = overlay->w * 2; |
1363 break; | 1363 break; |
1364 } | 1364 } |
1365 | 1365 |
1366 overlay->hwdata->textureID = | 1366 overlay->hwdata->textureID = |
1367 SDL_CreateTexture(texture_format, SDL_TextureAccess_Local, w, h); | 1367 SDL_CreateTexture(texture_format, SDL_TEXTUREACCESS_LOCAL, w, h); |
1368 if (!overlay->hwdata->textureID) { | 1368 if (!overlay->hwdata->textureID) { |
1369 SDL_FreeYUVOverlay(overlay); | 1369 SDL_FreeYUVOverlay(overlay); |
1370 return NULL; | 1370 return NULL; |
1371 } | 1371 } |
1372 | 1372 |
1408 | 1408 |
1409 int | 1409 int |
1410 SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect) | 1410 SDL_DisplayYUVOverlay(SDL_Overlay * overlay, SDL_Rect * dstrect) |
1411 { | 1411 { |
1412 if (SDL_RenderCopy(overlay->hwdata->textureID, NULL, dstrect, | 1412 if (SDL_RenderCopy(overlay->hwdata->textureID, NULL, dstrect, |
1413 SDL_TextureBlendMode_None, | 1413 SDL_TEXTUREBLENDMODE_NONE, |
1414 SDL_TextureScaleMode_Fast) < 0) { | 1414 SDL_TEXTURESCALEMODE_FAST) < 0) { |
1415 return -1; | 1415 return -1; |
1416 } | 1416 } |
1417 SDL_RenderPresent(); | 1417 SDL_RenderPresent(); |
1418 return 0; | 1418 return 0; |
1419 } | 1419 } |