SDL_internal.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. Simple DirectMedia Layer
  3. Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7. Permission is granted to anyone to use this software for any purpose,
  8. including commercial applications, and to alter it and redistribute it
  9. freely, subject to the following restrictions:
  10. 1. The origin of this software must not be misrepresented; you must not
  11. claim that you wrote the original software. If you use this software
  12. in a product, an acknowledgment in the product documentation would be
  13. appreciated but is not required.
  14. 2. Altered source versions must be plainly marked as such, and must not be
  15. misrepresented as being the original software.
  16. 3. This notice may not be removed or altered from any source distribution.
  17. */
  18. #ifndef SDL_internal_h_
  19. #define SDL_internal_h_
  20. /* Many of SDL's features require _GNU_SOURCE on various platforms */
  21. #ifndef _GNU_SOURCE
  22. #define _GNU_SOURCE
  23. #endif
  24. /* This is for a variable-length array at the end of a struct:
  25. struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; };
  26. Use this because GCC 2 needs different magic than other compilers. */
  27. #if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus)
  28. #define SDL_VARIABLE_LENGTH_ARRAY 1
  29. #else
  30. #define SDL_VARIABLE_LENGTH_ARRAY
  31. #endif
  32. #define SDL_MAX_SMALL_ALLOC_STACKSIZE 128
  33. #define SDL_small_alloc(type, count, pisstack) ( (*(pisstack) = ((sizeof(type)*(count)) < SDL_MAX_SMALL_ALLOC_STACKSIZE)), (*(pisstack) ? SDL_stack_alloc(type, count) : (type*)SDL_malloc(sizeof(type)*(count))) )
  34. #define SDL_small_free(ptr, isstack) if ((isstack)) { SDL_stack_free(ptr); } else { SDL_free(ptr); }
  35. #include "dynapi/SDL_dynapi.h"
  36. #if SDL_DYNAMIC_API
  37. #include "dynapi/SDL_dynapi_overrides.h"
  38. /* force DECLSPEC and SDLCALL off...it's all internal symbols now.
  39. These will have actual #defines during SDL_dynapi.c only */
  40. #define DECLSPEC
  41. #define SDLCALL
  42. #endif
  43. #include "SDL_config.h"
  44. /* A few #defines to reduce SDL2 footprint.
  45. Only effective when library is statically linked.
  46. You have to manually edit this file. */
  47. #ifndef SDL_LEAN_AND_MEAN
  48. #define SDL_LEAN_AND_MEAN 0
  49. #endif
  50. /* Optimized functions from 'SDL_blit_0.c'
  51. - blit with source BitsPerPixel < 8, palette */
  52. #ifndef SDL_HAVE_BLIT_0
  53. #define SDL_HAVE_BLIT_0 !SDL_LEAN_AND_MEAN
  54. #endif
  55. /* Optimized functions from 'SDL_blit_1.c'
  56. - blit with source BytesPerPixel == 1, palette */
  57. #ifndef SDL_HAVE_BLIT_1
  58. #define SDL_HAVE_BLIT_1 !SDL_LEAN_AND_MEAN
  59. #endif
  60. /* Optimized functions from 'SDL_blit_A.c'
  61. - blit with 'SDL_BLENDMODE_BLEND' blending mode */
  62. #ifndef SDL_HAVE_BLIT_A
  63. #define SDL_HAVE_BLIT_A !SDL_LEAN_AND_MEAN
  64. #endif
  65. /* Optimized functions from 'SDL_blit_N.c'
  66. - blit with COLORKEY mode, or nothing */
  67. #ifndef SDL_HAVE_BLIT_N
  68. #define SDL_HAVE_BLIT_N !SDL_LEAN_AND_MEAN
  69. #endif
  70. /* Optimized functions from 'SDL_blit_N.c'
  71. - RGB565 conversion with Lookup tables */
  72. #ifndef SDL_HAVE_BLIT_N_RGB565
  73. #define SDL_HAVE_BLIT_N_RGB565 !SDL_LEAN_AND_MEAN
  74. #endif
  75. /* Optimized functions from 'SDL_blit_AUTO.c'
  76. - blit with modulate color, modulate alpha, any blending mode
  77. - scaling or not */
  78. #ifndef SDL_HAVE_BLIT_AUTO
  79. #define SDL_HAVE_BLIT_AUTO !SDL_LEAN_AND_MEAN
  80. #endif
  81. /* Run-Length-Encoding
  82. - SDL_SetColorKey() called with SDL_RLEACCEL flag */
  83. #ifndef SDL_HAVE_RLE
  84. #define SDL_HAVE_RLE !SDL_LEAN_AND_MEAN
  85. #endif
  86. /* Software SDL_Renderer
  87. - creation of software renderer
  88. - *not* general blitting functions
  89. - {blend,draw}{fillrect,line,point} internal functions */
  90. #ifndef SDL_VIDEO_RENDER_SW
  91. #define SDL_VIDEO_RENDER_SW !SDL_LEAN_AND_MEAN
  92. #endif
  93. /* YUV formats
  94. - handling of YUV surfaces
  95. - blitting and conversion functions */
  96. #ifndef SDL_HAVE_YUV
  97. #define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN
  98. #endif
  99. #endif /* SDL_internal_h_ */
  100. /* vi: set ts=4 sw=4 expandtab: */