Added a single SDL_LEAN_AND_MEAN define to turn on minimal SDL builds

Protected more code with #ifdefs to reduce the size of minimal shared library builds
This commit is contained in:
Sam Lantinga
2020-01-23 01:00:52 -08:00
parent b1c6e7c244
commit b5e3d264f2
21 changed files with 108 additions and 21 deletions

View File

@@ -20,6 +20,8 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_RLE
/*
* RLE encoding for software colorkey and alpha-channel acceleration
*
@@ -1584,4 +1586,6 @@ SDL_UnRLESurface(SDL_Surface * surface, int recode)
}
}
#endif /* SDL_HAVE_RLE */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -99,6 +99,8 @@ SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect,
return (okay ? 0 : -1);
}
#if SDL_HAVE_BLIT_AUTO
#ifdef __MACOSX__
#include <sys/sysctl.h>
@@ -187,6 +189,7 @@ SDL_ChooseBlitFunc(Uint32 src_format, Uint32 dst_format, int flags,
}
return NULL;
}
#endif /* SDL_HAVE_BLIT_AUTO */
/* Figure out which of many blit routines to set up on a surface */
int

View File

@@ -20,6 +20,8 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_0
#include "SDL_video.h"
#include "SDL_blit.h"
@@ -480,4 +482,6 @@ SDL_CalculateBlit0(SDL_Surface * surface)
return (SDL_BlitFunc) NULL;
}
#endif /* SDL_HAVE_BLIT_0 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -20,6 +20,8 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_1
#include "SDL_video.h"
#include "SDL_blit.h"
#include "SDL_sysvideo.h"
@@ -549,4 +551,6 @@ SDL_CalculateBlit1(SDL_Surface * surface)
return (SDL_BlitFunc) NULL;
}
#endif /* SDL_HAVE_BLIT_1 */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -20,6 +20,8 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_A
#include "SDL_video.h"
#include "SDL_blit.h"
@@ -1489,4 +1491,6 @@ SDL_CalculateBlitA(SDL_Surface * surface)
return NULL;
}
#endif /* SDL_HAVE_BLIT_A */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -20,6 +20,8 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_N
#include "SDL_video.h"
#include "SDL_endian.h"
#include "SDL_cpuinfo.h"
@@ -1450,6 +1452,8 @@ Blit_RGB888_RGB565(SDL_BlitInfo * info)
}
#if SDL_HAVE_BLIT_N_RGB565
/* Special optimized blit for RGB 5-6-5 --> 32-bit RGB surfaces */
#define RGB565_32(dst, src, map) (map[src[LO]*2] + map[src[HI]*2+1])
static void
@@ -2068,6 +2072,8 @@ Blit_RGB565_BGRA8888(SDL_BlitInfo * info)
Blit_RGB565_32(info, RGB565_BGRA8888_LUT);
}
#endif /* SDL_HAVE_BLIT_N_RGB565 */
static void
BlitNto1(SDL_BlitInfo * info)
{
@@ -3461,4 +3467,6 @@ SDL_CalculateBlitN(SDL_Surface * surface)
return NULL;
}
#endif /* SDL_HAVE_BLIT_N */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -21,6 +21,8 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_AUTO
/* *INDENT-OFF* */
#include "SDL_video.h"
@@ -7674,4 +7676,6 @@ SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[] = {
/* *INDENT-ON* */
#endif /* SDL_HAVE_BLIT_AUTO */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -21,10 +21,14 @@
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_AUTO
/* *INDENT-OFF* */
extern SDL_BlitFuncEntry SDL_GeneratedBlitFuncTable[];
/* *INDENT-ON* */
#endif /* SDL_HAVE_BLIT_AUTO */
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -56,6 +56,8 @@ SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int hei
return mode;
}
#if SDL_HAVE_YUV
static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type)
{
switch (SDL_GetYUVConversionModeForResolution(width, height)) {
@@ -1809,11 +1811,14 @@ SDL_ConvertPixels_Packed4_to_Planar2x2(int width, int height,
return 0;
}
#endif /* SDL_HAVE_YUV */
int
SDL_ConvertPixels_YUV_to_YUV(int width, int height,
Uint32 src_format, const void *src, int src_pitch,
Uint32 dst_format, void *dst, int dst_pitch)
{
#if SDL_HAVE_YUV
if (src_format == dst_format) {
if (src == dst) {
/* Nothing to do */
@@ -1833,6 +1838,9 @@ SDL_ConvertPixels_YUV_to_YUV(int width, int height,
} else {
return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format));
}
#else
return SDL_SetError("SDL not built with YUV support");
#endif
}
/* vi: set ts=4 sw=4 expandtab: */

View File

@@ -112,6 +112,8 @@ sub open_file {
*/
#include "../SDL_internal.h"
#if SDL_HAVE_BLIT_AUTO
/* *INDENT-OFF* */
__EOF__
@@ -122,6 +124,8 @@ sub close_file {
print FILE <<__EOF__;
/* *INDENT-ON* */
#endif /* SDL_HAVE_BLIT_AUTO */
/* vi: set ts=4 sw=4 expandtab: */
__EOF__
close FILE;

View File

@@ -2,6 +2,8 @@
// Distributed under BSD 3-Clause License
#include "../../SDL_internal.h"
#if SDL_HAVE_YUV
#include "yuv_rgb.h"
#include "SDL_cpuinfo.h"
@@ -685,3 +687,4 @@ void rgb24_yuv420_sseu(uint32_t width, uint32_t height,
#endif //__SSE2__
#endif /* SDL_HAVE_YUV */