Parcourir la source

Simplified internal SDL_Surface structure

Sam Lantinga il y a 6 mois
Parent
commit
3234a3b902
52 fichiers modifiés avec 515 ajouts et 520 suppressions
  1. 9 7
      include/SDL3/SDL_surface.h
  2. 1 0
      src/SDL.c
  3. 1 0
      src/SDL_internal.h
  4. 1 1
      src/SDL_properties.c
  5. 0 2
      src/SDL_utils.c
  6. 2 1
      src/SDL_utils_c.h
  7. 0 2
      src/audio/SDL_sysaudio.h
  8. 1 0
      src/camera/SDL_camera.c
  9. 1 1
      src/camera/SDL_syscamera.h
  10. 1 0
      src/camera/android/SDL_camera_android.c
  11. 1 0
      src/camera/emscripten/SDL_camera_emscripten.c
  12. 1 0
      src/camera/v4l2/SDL_camera_v4l2.c
  13. 0 1
      src/events/SDL_keymap.c
  14. 0 1
      src/gpu/d3d12/SDL_gpu_d3d12.c
  15. 0 1
      src/gpu/vulkan/SDL_gpu_vulkan.c
  16. 0 1
      src/joystick/SDL_gamepad.c
  17. 2 0
      src/render/SDL_sysrender.h
  18. 1 1
      src/render/SDL_yuv_sw.c
  19. 0 2
      src/render/gpu/SDL_pipeline_gpu.h
  20. 0 1
      src/render/opengles2/SDL_render_gles2.c
  21. 18 18
      src/render/software/SDL_blendfillrect.c
  22. 7 7
      src/render/software/SDL_blendline.c
  23. 22 22
      src/render/software/SDL_blendpoint.c
  24. 5 5
      src/render/software/SDL_draw.h
  25. 9 9
      src/render/software/SDL_drawline.c
  26. 11 11
      src/render/software/SDL_drawpoint.c
  27. 5 5
      src/render/software/SDL_render_sw.c
  28. 4 4
      src/render/software/SDL_rotate.c
  29. 11 11
      src/render/software/SDL_triangle.c
  30. 0 1
      src/stdlib/SDL_getenv.c
  31. 40 40
      src/video/SDL_RLEaccel.c
  32. 12 12
      src/video/SDL_blit.c
  33. 0 4
      src/video/SDL_blit.h
  34. 6 6
      src/video/SDL_blit_0.c
  35. 5 5
      src/video/SDL_blit_1.c
  36. 8 8
      src/video/SDL_blit_A.c
  37. 5 5
      src/video/SDL_blit_N.c
  38. 0 1
      src/video/SDL_blit_auto.c
  39. 1 1
      src/video/SDL_blit_copy.c
  40. 3 3
      src/video/SDL_blit_slow.c
  41. 17 16
      src/video/SDL_bmp.c
  42. 3 3
      src/video/SDL_fillrect.c
  43. 18 21
      src/video/SDL_pixels.c
  44. 3 3
      src/video/SDL_stretch.c
  45. 255 256
      src/video/SDL_surface.c
  46. 18 11
      src/video/SDL_surface_c.h
  47. 2 0
      src/video/SDL_sysvideo.h
  48. 4 4
      src/video/SDL_video.c
  49. 1 1
      src/video/sdlgenblit.pl
  50. 0 1
      src/video/windows/SDL_windowsmouse.c
  51. 0 2
      src/video/windows/SDL_windowsshape.c
  52. 0 2
      src/video/x11/SDL_x11shape.c

+ 9 - 7
include/SDL3/SDL_surface.h

@@ -86,9 +86,7 @@ typedef enum SDL_FlipMode
     SDL_FLIP_VERTICAL       /**< flip vertically */
 } SDL_FlipMode;
 
-/* Internal surface data */
-typedef struct SDL_SurfaceData SDL_SurfaceData;
-
+#ifndef SDL_INTERNAL
 /**
  * A collection of pixels used in software blitting.
  *
@@ -105,8 +103,11 @@ typedef struct SDL_SurfaceData SDL_SurfaceData;
  * alignment, and have undefined contents.
  *
  * \since This struct is available since SDL 3.0.0.
+ *
+ * \sa SDL_CreateSurface
+ * \sa SDL_DestroySurface
  */
-typedef struct SDL_Surface
+struct SDL_Surface
 {
     SDL_SurfaceFlags flags;     /**< The flags of the surface, read-only */
     SDL_PixelFormat format;     /**< The format of the surface, read-only */
@@ -117,10 +118,11 @@ typedef struct SDL_Surface
 
     int refcount;               /**< Application reference count, used when freeing surface */
 
-    SDL_SurfaceData *internal;  /**< Private */
-
-} SDL_Surface;
+    void *reserved;             /**< Reserved for internal use */
+};
+#endif /* !SDL_INTERNAL */
 
+typedef struct SDL_Surface SDL_Surface;
 
 /**
  * Allocate a new surface with a specific pixel format.

+ 1 - 0
src/SDL.c

@@ -52,6 +52,7 @@
 #include "stdlib/SDL_getenv_c.h"
 #include "thread/SDL_thread_c.h"
 #include "video/SDL_pixels_c.h"
+#include "video/SDL_surface_c.h"
 #include "video/SDL_video_c.h"
 #include "filesystem/SDL_filesystem_c.h"
 

+ 1 - 0
src/SDL_internal.h

@@ -237,6 +237,7 @@ extern "C" {
 #endif
 
 #include "SDL_utils_c.h"
+#include "SDL_hashtable.h"
 
 // Do any initialization that needs to happen before threads are started
 extern void SDL_InitMainThread(void);

+ 1 - 1
src/SDL_properties.c

@@ -19,7 +19,7 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_internal.h"
-#include "SDL_hashtable.h"
+
 #include "SDL_hints_c.h"
 #include "SDL_properties_c.h"
 

+ 0 - 2
src/SDL_utils.c

@@ -20,8 +20,6 @@
 */
 #include "SDL_internal.h"
 
-#include "SDL_hashtable.h"
-
 #if defined(SDL_PLATFORM_UNIX) || defined(SDL_PLATFORM_APPLE)
 #include <unistd.h>
 #endif

+ 2 - 1
src/SDL_utils_c.h

@@ -18,7 +18,8 @@
      misrepresented as being the original software.
   3. This notice may not be removed or altered from any source distribution.
 */
-#include "SDL_internal.h"
+// This is included in SDL_internal.h
+//#include "SDL_internal.h"
 
 #ifndef SDL_utils_h_
 #define SDL_utils_h_

+ 0 - 2
src/audio/SDL_sysaudio.h

@@ -24,8 +24,6 @@
 #ifndef SDL_sysaudio_h_
 #define SDL_sysaudio_h_
 
-#include "../SDL_hashtable.h"
-
 #define DEBUG_AUDIOSTREAM 0
 #define DEBUG_AUDIO_CONVERT 0
 

+ 1 - 0
src/camera/SDL_camera.c

@@ -23,6 +23,7 @@
 #include "SDL_syscamera.h"
 #include "SDL_camera_c.h"
 #include "../video/SDL_pixels_c.h"
+#include "../video/SDL_surface_c.h"
 #include "../thread/SDL_systhread.h"
 
 

+ 1 - 1
src/camera/SDL_syscamera.h

@@ -23,7 +23,7 @@
 #ifndef SDL_syscamera_h_
 #define SDL_syscamera_h_
 
-#include "../SDL_hashtable.h"
+#include "../video/SDL_surface_c.h"
 
 #define DEBUG_CAMERA 0
 

+ 1 - 0
src/camera/android/SDL_camera_android.c

@@ -23,6 +23,7 @@
 #include "../SDL_syscamera.h"
 #include "../SDL_camera_c.h"
 #include "../../video/SDL_pixels_c.h"
+#include "../../video/SDL_surface_c.h"
 #include "../../thread/SDL_systhread.h"
 
 #ifdef SDL_CAMERA_DRIVER_ANDROID

+ 1 - 0
src/camera/emscripten/SDL_camera_emscripten.c

@@ -25,6 +25,7 @@
 #include "../SDL_syscamera.h"
 #include "../SDL_camera_c.h"
 #include "../../video/SDL_pixels_c.h"
+#include "../../video/SDL_surface_c.h"
 
 #include <emscripten/emscripten.h>
 

+ 1 - 0
src/camera/v4l2/SDL_camera_v4l2.c

@@ -41,6 +41,7 @@ SDL_COMPILE_TIME_ASSERT(v4l2devicecaps, offsetof(struct v4l2_capability,device_c
 #include "../SDL_syscamera.h"
 #include "../SDL_camera_c.h"
 #include "../../video/SDL_pixels_c.h"
+#include "../../video/SDL_surface_c.h"
 #include "../../thread/SDL_systhread.h"
 #include "../../core/linux/SDL_evdev_capabilities.h"
 #include "../../core/linux/SDL_udev.h"

+ 0 - 1
src/events/SDL_keymap.c

@@ -22,7 +22,6 @@
 
 #include "SDL_keymap_c.h"
 #include "SDL_keyboard_c.h"
-#include "../SDL_hashtable.h"
 
 struct SDL_Keymap
 {

+ 0 - 1
src/gpu/d3d12/SDL_gpu_d3d12.c

@@ -26,7 +26,6 @@
 #include "../../core/windows/SDL_windows.h"
 #include "../../video/directx/SDL_d3d12.h"
 #include "../SDL_sysgpu.h"
-#include "SDL_hashtable.h"
 
 #ifdef __IDXGIInfoQueue_INTERFACE_DEFINED__
 #define HAVE_IDXGIINFOQUEUE

+ 0 - 1
src/gpu/vulkan/SDL_gpu_vulkan.c

@@ -29,7 +29,6 @@
 #define VK_NO_PROTOTYPES
 #include "../../video/khronos/vulkan/vulkan.h"
 
-#include "SDL_hashtable.h"
 #include <SDL3/SDL_vulkan.h>
 
 #include "../SDL_sysgpu.h"

+ 0 - 1
src/joystick/SDL_gamepad.c

@@ -31,7 +31,6 @@
 #include "usb_ids.h"
 #include "hidapi/SDL_hidapi_nintendo.h"
 #include "../events/SDL_events_c.h"
-#include "../SDL_hashtable.h"
 
 
 #ifdef SDL_PLATFORM_ANDROID

+ 2 - 0
src/render/SDL_sysrender.h

@@ -23,6 +23,8 @@
 #ifndef SDL_sysrender_h_
 #define SDL_sysrender_h_
 
+#include "../video/SDL_surface_c.h"
+
 #include "SDL_yuv_sw_c.h"
 
 // Set up for C function definitions, even when using C++

+ 1 - 1
src/render/SDL_yuv_sw.c

@@ -25,7 +25,7 @@
 #if SDL_HAVE_YUV
 
 #include "SDL_yuv_sw_c.h"
-#include "../video/SDL_blit.h"
+#include "../video/SDL_surface_c.h"
 #include "../video/SDL_yuv_c.h"
 
 SDL_SW_YUVTexture *SDL_SW_CreateYUVTexture(SDL_PixelFormat format, SDL_Colorspace colorspace, int w, int h)

+ 0 - 2
src/render/gpu/SDL_pipeline_gpu.h

@@ -26,8 +26,6 @@
 
 #include "SDL_shaders_gpu.h"
 
-#include "SDL_hashtable.h"
-
 typedef struct GPU_PipelineParameters
 {
     SDL_BlendMode blend_mode;

+ 0 - 1
src/render/opengles2/SDL_render_gles2.c

@@ -25,7 +25,6 @@
 #include "../../video/SDL_sysvideo.h" // For SDL_RecreateWindow
 #include <SDL3/SDL_opengles2.h>
 #include "../SDL_sysrender.h"
-#include "../../video/SDL_blit.h"
 #include "../../video/SDL_pixels_c.h"
 #include "SDL_shaders_gles2.h"
 

+ 18 - 18
src/render/software/SDL_blendfillrect.c

@@ -144,7 +144,7 @@ static bool SDL_BlendFillRect_ARGB8888(SDL_Surface *dst, const SDL_Rect *rect,
 static bool SDL_BlendFillRect_RGB(SDL_Surface *dst, const SDL_Rect *rect,
                                  SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned inva = 0xff - a;
 
     switch (fmt->bytes_per_pixel) {
@@ -202,7 +202,7 @@ static bool SDL_BlendFillRect_RGB(SDL_Surface *dst, const SDL_Rect *rect,
 static bool SDL_BlendFillRect_RGBA(SDL_Surface *dst, const SDL_Rect *rect,
                                   SDL_BlendMode blendMode, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned inva = 0xff - a;
 
     switch (fmt->bytes_per_pixel) {
@@ -250,12 +250,12 @@ bool SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, SDL_BlendMode ble
     // If 'rect' == NULL, then fill the whole surface
     if (rect) {
         // Perform clipping
-        if (!SDL_GetRectIntersection(rect, &dst->internal->clip_rect, &clipped)) {
+        if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) {
             return true;
         }
         rect = &clipped;
     } else {
-        rect = &dst->internal->clip_rect;
+        rect = &dst->clip_rect;
     }
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -264,23 +264,23 @@ bool SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, SDL_BlendMode ble
         b = DRAW_MUL(b, a);
     }
 
-    switch (dst->internal->format->bits_per_pixel) {
+    switch (dst->fmt->bits_per_pixel) {
     case 15:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x7C00:
             return SDL_BlendFillRect_RGB555(dst, rect, blendMode, r, g, b, a);
         }
         break;
     case 16:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0xF800:
             return SDL_BlendFillRect_RGB565(dst, rect, blendMode, r, g, b, a);
         }
         break;
     case 32:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x00FF0000:
-            if (!dst->internal->format->Amask) {
+            if (!dst->fmt->Amask) {
                 return SDL_BlendFillRect_XRGB8888(dst, rect, blendMode, r, g, b, a);
             } else {
                 return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a);
@@ -292,7 +292,7 @@ bool SDL_BlendFillRect(SDL_Surface *dst, const SDL_Rect *rect, SDL_BlendMode ble
         break;
     }
 
-    if (!dst->internal->format->Amask) {
+    if (!dst->fmt->Amask) {
         return SDL_BlendFillRect_RGB(dst, rect, blendMode, r, g, b, a);
     } else {
         return SDL_BlendFillRect_RGBA(dst, rect, blendMode, r, g, b, a);
@@ -311,7 +311,7 @@ bool SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_
     }
 
     // This function doesn't work on surfaces < 8 bpp
-    if (dst->internal->format->bits_per_pixel < 8) {
+    if (dst->fmt->bits_per_pixel < 8) {
         return SDL_SetError("SDL_BlendFillRects(): Unsupported surface format");
     }
 
@@ -322,23 +322,23 @@ bool SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_
     }
 
     // FIXME: Does this function pointer slow things down significantly?
-    switch (dst->internal->format->bits_per_pixel) {
+    switch (dst->fmt->bits_per_pixel) {
     case 15:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x7C00:
             func = SDL_BlendFillRect_RGB555;
         }
         break;
     case 16:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0xF800:
             func = SDL_BlendFillRect_RGB565;
         }
         break;
     case 32:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x00FF0000:
-            if (!dst->internal->format->Amask) {
+            if (!dst->fmt->Amask) {
                 func = SDL_BlendFillRect_XRGB8888;
             } else {
                 func = SDL_BlendFillRect_ARGB8888;
@@ -351,7 +351,7 @@ bool SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_
     }
 
     if (!func) {
-        if (!dst->internal->format->Amask) {
+        if (!dst->fmt->Amask) {
             func = SDL_BlendFillRect_RGB;
         } else {
             func = SDL_BlendFillRect_RGBA;
@@ -360,7 +360,7 @@ bool SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count, SDL_
 
     for (i = 0; i < count; ++i) {
         // Perform clipping
-        if (!SDL_GetRectIntersection(&rects[i], &dst->internal->clip_rect, &rect)) {
+        if (!SDL_GetRectIntersection(&rects[i], &dst->clip_rect, &rect)) {
             continue;
         }
         result = func(dst, &rect, blendMode, r, g, b, a);

+ 7 - 7
src/render/software/SDL_blendline.c

@@ -30,7 +30,7 @@ static void SDL_BlendLine_RGB2(SDL_Surface *dst, int x1, int y1, int x2, int y2,
                                SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                                bool draw_end)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -397,7 +397,7 @@ static void SDL_BlendLine_RGB4(SDL_Surface *dst, int x1, int y1, int x2, int y2,
                                SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                                bool draw_end)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -520,7 +520,7 @@ static void SDL_BlendLine_RGBA4(SDL_Surface *dst, int x1, int y1, int x2, int y2
                                 SDL_BlendMode blendMode, Uint8 _r, Uint8 _g, Uint8 _b, Uint8 _a,
                                 bool draw_end)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned r, g, b, a, inva;
 
     if (blendMode == SDL_BLENDMODE_BLEND || blendMode == SDL_BLENDMODE_ADD) {
@@ -927,14 +927,14 @@ bool SDL_BlendLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, SDL_BlendMo
         return SDL_InvalidParamError("SDL_BlendLine(): dst");
     }
 
-    func = SDL_CalculateBlendLineFunc(dst->internal->format);
+    func = SDL_CalculateBlendLineFunc(dst->fmt);
     if (!func) {
         return SDL_SetError("SDL_BlendLine(): Unsupported surface format");
     }
 
     // Perform clipping
     // FIXME: We don't actually want to clip, as it may change line slope
-    if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
+    if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
         return true;
     }
 
@@ -954,7 +954,7 @@ bool SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, SDL_Bl
         return SDL_SetError("SDL_BlendLines(): Passed NULL destination surface");
     }
 
-    func = SDL_CalculateBlendLineFunc(dst->internal->format);
+    func = SDL_CalculateBlendLineFunc(dst->fmt);
     if (!func) {
         return SDL_SetError("SDL_BlendLines(): Unsupported surface format");
     }
@@ -967,7 +967,7 @@ bool SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count, SDL_Bl
 
         // Perform clipping
         // FIXME: We don't actually want to clip, as it may change line slope
-        if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
+        if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
             continue;
         }
 

+ 22 - 22
src/render/software/SDL_blendpoint.c

@@ -144,7 +144,7 @@ static bool SDL_BlendPoint_ARGB8888(SDL_Surface *dst, int x, int y, SDL_BlendMod
 static bool SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
                               Uint8 g, Uint8 b, Uint8 a)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned inva = 0xff - a;
 
     switch (fmt->bytes_per_pixel) {
@@ -202,7 +202,7 @@ static bool SDL_BlendPoint_RGB(SDL_Surface *dst, int x, int y, SDL_BlendMode ble
 static bool SDL_BlendPoint_RGBA(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uint8 r,
                                Uint8 g, Uint8 b, Uint8 a)
 {
-    const SDL_PixelFormatDetails *fmt = dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = dst->fmt;
     unsigned inva = 0xff - a;
 
     switch (fmt->bytes_per_pixel) {
@@ -246,9 +246,9 @@ bool SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uin
     }
 
     // Perform clipping
-    if (x < dst->internal->clip_rect.x || y < dst->internal->clip_rect.y ||
-        x >= (dst->internal->clip_rect.x + dst->internal->clip_rect.w) ||
-        y >= (dst->internal->clip_rect.y + dst->internal->clip_rect.h)) {
+    if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
+        x >= (dst->clip_rect.x + dst->clip_rect.w) ||
+        y >= (dst->clip_rect.y + dst->clip_rect.h)) {
         return true;
     }
 
@@ -258,23 +258,23 @@ bool SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uin
         b = DRAW_MUL(b, a);
     }
 
-    switch (dst->internal->format->bits_per_pixel) {
+    switch (dst->fmt->bits_per_pixel) {
     case 15:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x7C00:
             return SDL_BlendPoint_RGB555(dst, x, y, blendMode, r, g, b, a);
         }
         break;
     case 16:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0xF800:
             return SDL_BlendPoint_RGB565(dst, x, y, blendMode, r, g, b, a);
         }
         break;
     case 32:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x00FF0000:
-            if (!dst->internal->format->Amask) {
+            if (!dst->fmt->Amask) {
                 return SDL_BlendPoint_XRGB8888(dst, x, y, blendMode, r, g, b, a);
             } else {
                 return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a);
@@ -286,7 +286,7 @@ bool SDL_BlendPoint(SDL_Surface *dst, int x, int y, SDL_BlendMode blendMode, Uin
         break;
     }
 
-    if (!dst->internal->format->Amask) {
+    if (!dst->fmt->Amask) {
         return SDL_BlendPoint_RGB(dst, x, y, blendMode, r, g, b, a);
     } else {
         return SDL_BlendPoint_RGBA(dst, x, y, blendMode, r, g, b, a);
@@ -307,7 +307,7 @@ bool SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_B
     }
 
     // This function doesn't work on surfaces < 8 bpp
-    if (dst->internal->format->bits_per_pixel < 8) {
+    if (dst->fmt->bits_per_pixel < 8) {
         return SDL_SetError("SDL_BlendPoints(): Unsupported surface format");
     }
 
@@ -318,25 +318,25 @@ bool SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_B
     }
 
     // FIXME: Does this function pointer slow things down significantly?
-    switch (dst->internal->format->bits_per_pixel) {
+    switch (dst->fmt->bits_per_pixel) {
     case 15:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x7C00:
             func = SDL_BlendPoint_RGB555;
             break;
         }
         break;
     case 16:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0xF800:
             func = SDL_BlendPoint_RGB565;
             break;
         }
         break;
     case 32:
-        switch (dst->internal->format->Rmask) {
+        switch (dst->fmt->Rmask) {
         case 0x00FF0000:
-            if (!dst->internal->format->Amask) {
+            if (!dst->fmt->Amask) {
                 func = SDL_BlendPoint_XRGB8888;
             } else {
                 func = SDL_BlendPoint_ARGB8888;
@@ -349,17 +349,17 @@ bool SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count, SDL_B
     }
 
     if (!func) {
-        if (!dst->internal->format->Amask) {
+        if (!dst->fmt->Amask) {
             func = SDL_BlendPoint_RGB;
         } else {
             func = SDL_BlendPoint_RGBA;
         }
     }
 
-    minx = dst->internal->clip_rect.x;
-    maxx = dst->internal->clip_rect.x + dst->internal->clip_rect.w - 1;
-    miny = dst->internal->clip_rect.y;
-    maxy = dst->internal->clip_rect.y + dst->internal->clip_rect.h - 1;
+    minx = dst->clip_rect.x;
+    maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
+    miny = dst->clip_rect.y;
+    maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
 
     for (i = 0; i < count; ++i) {
         x = points[i].x;

+ 5 - 5
src/render/software/SDL_draw.h

@@ -20,7 +20,7 @@
 */
 #include "SDL_internal.h"
 
-#include "../../video/SDL_blit.h"
+#include "../../video/SDL_surface_c.h"
 
 /* This code assumes that r, g, b, a are the source color,
  * and in the blend and add case, the RGB values are premultiplied by a.
@@ -428,7 +428,7 @@
 #define HLINE(type, op, draw_end)                              \
     {                                                          \
         int length;                                            \
-        int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
+        int pitch = (dst->pitch / dst->fmt->bytes_per_pixel); \
         type *pixel;                                           \
         if (x1 <= x2) {                                        \
             pixel = (type *)dst->pixels + y1 * pitch + x1;     \
@@ -450,7 +450,7 @@
 #define VLINE(type, op, draw_end)                              \
     {                                                          \
         int length;                                            \
-        int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
+        int pitch = (dst->pitch / dst->fmt->bytes_per_pixel); \
         type *pixel;                                           \
         if (y1 <= y2) {                                        \
             pixel = (type *)dst->pixels + y1 * pitch + x1;     \
@@ -472,7 +472,7 @@
 #define DLINE(type, op, draw_end)                              \
     {                                                          \
         int length;                                            \
-        int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
+        int pitch = (dst->pitch / dst->fmt->bytes_per_pixel); \
         type *pixel;                                           \
         if (y1 <= y2) {                                        \
             pixel = (type *)dst->pixels + y1 * pitch + x1;     \
@@ -692,7 +692,7 @@
     do {                                                               \
         int width = rect->w;                                           \
         int height = rect->h;                                          \
-        int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel); \
+        int pitch = (dst->pitch / dst->fmt->bytes_per_pixel); \
         int skip = pitch - width;                                      \
         type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
         while (height--) {                                             \

+ 9 - 9
src/render/software/SDL_drawline.c

@@ -31,7 +31,7 @@ static void SDL_DrawLine1(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
 {
     if (y1 == y2) {
         int length;
-        int pitch = (dst->pitch / dst->internal->format->bytes_per_pixel);
+        int pitch = (dst->pitch / dst->fmt->bytes_per_pixel);
         Uint8 *pixel;
         if (x1 <= x2) {
             pixel = (Uint8 *)dst->pixels + y1 * pitch + x1;
@@ -64,8 +64,8 @@ static void SDL_DrawLine2(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
         DLINE(Uint16, DRAW_FASTSETPIXEL2, draw_end);
     } else {
         Uint8 _r, _g, _b, _a;
-        const SDL_PixelFormatDetails *fmt = dst->internal->format;
-        SDL_GetRGBA(color, fmt, dst->internal->palette, &_r, &_g, &_b, &_a);
+        const SDL_PixelFormatDetails *fmt = dst->fmt;
+        SDL_GetRGBA(color, fmt, dst->palette, &_r, &_g, &_b, &_a);
         if (fmt->Rmask == 0x7C00) {
             AALINE(x1, y1, x2, y2,
                    DRAW_FASTSETPIXELXY2, DRAW_SETPIXELXY_BLEND_RGB555,
@@ -93,8 +93,8 @@ static void SDL_DrawLine4(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint
         DLINE(Uint32, DRAW_FASTSETPIXEL4, draw_end);
     } else {
         Uint8 _r, _g, _b, _a;
-        const SDL_PixelFormatDetails *fmt = dst->internal->format;
-        SDL_GetRGBA(color, fmt, dst->internal->palette, &_r, &_g, &_b, &_a);
+        const SDL_PixelFormatDetails *fmt = dst->fmt;
+        SDL_GetRGBA(color, fmt, dst->palette, &_r, &_g, &_b, &_a);
         if (fmt->Rmask == 0x00FF0000) {
             if (!fmt->Amask) {
                 AALINE(x1, y1, x2, y2,
@@ -141,14 +141,14 @@ bool SDL_DrawLine(SDL_Surface *dst, int x1, int y1, int x2, int y2, Uint32 color
         return SDL_InvalidParamError("SDL_DrawLine(): dst");
     }
 
-    func = SDL_CalculateDrawLineFunc(dst->internal->format);
+    func = SDL_CalculateDrawLineFunc(dst->fmt);
     if (!func) {
         return SDL_SetError("SDL_DrawLine(): Unsupported surface format");
     }
 
     // Perform clipping
     // FIXME: We don't actually want to clip, as it may change line slope
-    if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
+    if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
         return true;
     }
 
@@ -168,7 +168,7 @@ bool SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
         return SDL_InvalidParamError("SDL_DrawLines(): dst");
     }
 
-    func = SDL_CalculateDrawLineFunc(dst->internal->format);
+    func = SDL_CalculateDrawLineFunc(dst->fmt);
     if (!func) {
         return SDL_SetError("SDL_DrawLines(): Unsupported surface format");
     }
@@ -181,7 +181,7 @@ bool SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
 
         // Perform clipping
         // FIXME: We don't actually want to clip, as it may change line slope
-        if (!SDL_GetRectAndLineIntersection(&dst->internal->clip_rect, &x1, &y1, &x2, &y2)) {
+        if (!SDL_GetRectAndLineIntersection(&dst->clip_rect, &x1, &y1, &x2, &y2)) {
             continue;
         }
 

+ 11 - 11
src/render/software/SDL_drawpoint.c

@@ -32,18 +32,18 @@ bool SDL_DrawPoint(SDL_Surface *dst, int x, int y, Uint32 color)
     }
 
     // This function doesn't work on surfaces < 8 bpp
-    if (dst->internal->format->bits_per_pixel < 8) {
+    if (dst->fmt->bits_per_pixel < 8) {
         return SDL_SetError("SDL_DrawPoint(): Unsupported surface format");
     }
 
     // Perform clipping
-    if (x < dst->internal->clip_rect.x || y < dst->internal->clip_rect.y ||
-        x >= (dst->internal->clip_rect.x + dst->internal->clip_rect.w) ||
-        y >= (dst->internal->clip_rect.y + dst->internal->clip_rect.h)) {
+    if (x < dst->clip_rect.x || y < dst->clip_rect.y ||
+        x >= (dst->clip_rect.x + dst->clip_rect.w) ||
+        y >= (dst->clip_rect.y + dst->clip_rect.h)) {
         return true;
     }
 
-    switch (dst->internal->format->bytes_per_pixel) {
+    switch (dst->fmt->bytes_per_pixel) {
     case 1:
         DRAW_FASTSETPIXELXY1(x, y);
         break;
@@ -71,14 +71,14 @@ bool SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
     }
 
     // This function doesn't work on surfaces < 8 bpp
-    if (dst->internal->format->bits_per_pixel < 8) {
+    if (dst->fmt->bits_per_pixel < 8) {
         return SDL_SetError("SDL_DrawPoints(): Unsupported surface format");
     }
 
-    minx = dst->internal->clip_rect.x;
-    maxx = dst->internal->clip_rect.x + dst->internal->clip_rect.w - 1;
-    miny = dst->internal->clip_rect.y;
-    maxy = dst->internal->clip_rect.y + dst->internal->clip_rect.h - 1;
+    minx = dst->clip_rect.x;
+    maxx = dst->clip_rect.x + dst->clip_rect.w - 1;
+    miny = dst->clip_rect.y;
+    maxy = dst->clip_rect.y + dst->clip_rect.h - 1;
 
     for (i = 0; i < count; ++i) {
         x = points[i].x;
@@ -88,7 +88,7 @@ bool SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count, Uint32
             continue;
         }
 
-        switch (dst->internal->format->bytes_per_pixel) {
+        switch (dst->fmt->bytes_per_pixel) {
         case 1:
             DRAW_FASTSETPIXELXY1(x, y);
             break;

+ 5 - 5
src/render/software/SDL_render_sw.c

@@ -142,8 +142,8 @@ static bool SW_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture,
     src = (Uint8 *)pixels;
     dst = (Uint8 *)surface->pixels +
           rect->y * surface->pitch +
-          rect->x * surface->internal->format->bytes_per_pixel;
-    length = (size_t)rect->w * surface->internal->format->bytes_per_pixel;
+          rect->x * surface->fmt->bytes_per_pixel;
+    length = (size_t)rect->w * surface->fmt->bytes_per_pixel;
     for (row = 0; row < rect->h; ++row) {
         SDL_memcpy(dst, src, length);
         src += pitch;
@@ -162,7 +162,7 @@ static bool SW_LockTexture(SDL_Renderer *renderer, SDL_Texture *texture,
 
     *pixels =
         (void *)((Uint8 *)surface->pixels + rect->y * surface->pitch +
-                 rect->x * surface->internal->format->bytes_per_pixel);
+                 rect->x * surface->fmt->bytes_per_pixel);
     *pitch = surface->pitch;
     return true;
 }
@@ -364,7 +364,7 @@ static bool SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Te
     SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
 
     // SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted.
-    if (src->internal->format->bits_per_pixel != 32 || SDL_PIXELLAYOUT(src->format) != SDL_PACKEDLAYOUT_8888 || !SDL_ISPIXELFORMAT_ALPHA(src->format)) {
+    if (src->fmt->bits_per_pixel != 32 || SDL_PIXELLAYOUT(src->format) != SDL_PACKEDLAYOUT_8888 || !SDL_ISPIXELFORMAT_ALPHA(src->format)) {
         blitRequired = true;
     }
 
@@ -984,7 +984,7 @@ static SDL_Surface *SW_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
 
     pixels = (void *)((Uint8 *)surface->pixels +
                       rect->y * surface->pitch +
-                      rect->x * surface->internal->format->bytes_per_pixel);
+                      rect->x * surface->fmt->bytes_per_pixel);
 
     return SDL_DuplicatePixels(rect->w, rect->h, surface->format, SDL_COLORSPACE_SRGB, pixels, surface->pitch);
 }

+ 4 - 4
src/render/software/SDL_rotate.c

@@ -38,7 +38,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net
 
 #include "SDL_rotate.h"
 
-#include "../../video/SDL_blit.h"
+#include "../../video/SDL_surface_c.h"
 
 // ---- Internally used structures
 
@@ -506,8 +506,8 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
         }
     }
     // This function requires a 32-bit surface or 8-bit surface with a colorkey
-    is8bit = src->internal->format->bits_per_pixel == 8 && colorKeyAvailable;
-    if (!(is8bit || (src->internal->format->bits_per_pixel == 32 && SDL_ISPIXELFORMAT_ALPHA(src->format)))) {
+    is8bit = src->fmt->bits_per_pixel == 8 && colorKeyAvailable;
+    if (!(is8bit || (src->fmt->bits_per_pixel == 32 && SDL_ISPIXELFORMAT_ALPHA(src->format)))) {
         return NULL;
     }
 
@@ -521,7 +521,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
         // Target surface is 8 bit
         rz_dst = SDL_CreateSurface(rect_dest->w, rect_dest->h + GUARD_ROWS, src->format);
         if (rz_dst) {
-            SDL_SetSurfacePalette(rz_dst, src->internal->palette);
+            SDL_SetSurfacePalette(rz_dst, src->palette);
         }
     } else {
         // Target surface is 32 bit with source RGBA ordering

+ 11 - 11
src/render/software/SDL_triangle.c

@@ -26,7 +26,7 @@
 
 #include "SDL_triangle.h"
 
-#include "../../video/SDL_blit.h"
+#include "../../video/SDL_surface_c.h"
 
 /* fixed points bits precision
  * Set to 1, so that it can start rendering with middle of a pixel precision.
@@ -309,13 +309,13 @@ bool SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poi
 
         SDL_SetSurfaceBlendMode(tmp, blend);
 
-        dstbpp = tmp->internal->format->bytes_per_pixel;
+        dstbpp = tmp->fmt->bytes_per_pixel;
         dst_ptr = (Uint8 *)tmp->pixels;
         dst_pitch = tmp->pitch;
 
     } else {
         // Write directly to destination surface
-        dstbpp = dst->internal->format->bytes_per_pixel;
+        dstbpp = dst->fmt->bytes_per_pixel;
         dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
         dst_pitch = dst->pitch;
     }
@@ -406,11 +406,11 @@ bool SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poi
         const SDL_PixelFormatDetails *format;
         SDL_Palette *palette;
         if (tmp) {
-            format = tmp->internal->format;
-            palette = tmp->internal->palette;
+            format = tmp->fmt;
+            palette = tmp->palette;
         } else {
-            format = dst->internal->format;
-            palette = dst->internal->palette;
+            format = dst->fmt;
+            palette = dst->palette;
         }
         if (dstbpp == 4) {
             TRIANGLE_BEGIN_LOOP
@@ -584,7 +584,7 @@ bool SDL_SW_BlitTriangle(
     }
 
     // Set destination pointer
-    dstbpp = dst->internal->format->bytes_per_pixel;
+    dstbpp = dst->fmt->bytes_per_pixel;
     dst_ptr = (Uint8 *)dst->pixels + dstrect.x * dstbpp + dstrect.y * dst->pitch;
     dst_pitch = dst->pitch;
 
@@ -662,13 +662,13 @@ bool SDL_SW_BlitTriangle(
     if (blend != SDL_BLENDMODE_NONE || src->format != dst->format || has_modulation || !is_uniform) {
         // Use SDL_BlitTriangle_Slow
 
-        SDL_BlitInfo *info = &src->internal->map.info;
+        SDL_BlitInfo *info = &src->map.info;
         SDL_BlitInfo tmp_info;
 
         SDL_zero(tmp_info);
 
-        tmp_info.src_fmt = src->internal->format;
-        tmp_info.dst_fmt = dst->internal->format;
+        tmp_info.src_fmt = src->fmt;
+        tmp_info.dst_fmt = dst->fmt;
         tmp_info.flags = info->flags;
         /*
         tmp_info.r = info->r;

+ 0 - 1
src/stdlib/SDL_getenv.c

@@ -20,7 +20,6 @@
 */
 #include "SDL_internal.h"
 
-#include "../SDL_hashtable.h"
 #include "SDL_getenv_c.h"
 
 #if defined(SDL_PLATFORM_WINDOWS)

+ 40 - 40
src/video/SDL_RLEaccel.c

@@ -88,7 +88,7 @@
  */
 
 #include "SDL_sysvideo.h"
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_RLEaccel_c.h"
 
 #define PIXEL_COPY(to, from, len, bpp) \
@@ -434,7 +434,7 @@
 static void RLEClipBlit(int w, Uint8 *srcbuf, SDL_Surface *surf_dst,
                         Uint8 *dstbuf, const SDL_Rect *srcrect, unsigned alpha)
 {
-    const SDL_PixelFormatDetails *fmt = surf_dst->internal->format;
+    const SDL_PixelFormatDetails *fmt = surf_dst->fmt;
 
     CHOOSE_BLIT(RLECLIPBLIT, alpha, fmt);
 }
@@ -461,8 +461,8 @@ static bool SDLCALL SDL_RLEBlit(SDL_Surface *surf_src, const SDL_Rect *srcrect,
     // Set up the source and destination pointers
     x = dstrect->x;
     y = dstrect->y;
-    dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * surf_src->internal->format->bytes_per_pixel;
-    srcbuf = (Uint8 *)surf_src->internal->map.data + sizeof(SDL_PixelFormat);
+    dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * surf_src->fmt->bytes_per_pixel;
+    srcbuf = (Uint8 *)surf_src->map.data + sizeof(SDL_PixelFormat);
 
     {
         // skip lines at the top if necessary
@@ -488,7 +488,7 @@ static bool SDLCALL SDL_RLEBlit(SDL_Surface *surf_src, const SDL_Rect *srcrect,
         }                           \
     }
 
-            switch (surf_src->internal->format->bytes_per_pixel) {
+            switch (surf_src->fmt->bytes_per_pixel) {
             case 1:
                 RLESKIP(1, Uint8);
                 break;
@@ -507,12 +507,12 @@ static bool SDLCALL SDL_RLEBlit(SDL_Surface *surf_src, const SDL_Rect *srcrect,
         }
     }
 
-    alpha = surf_src->internal->map.info.a;
+    alpha = surf_src->map.info.a;
     // if left or right edge clipping needed, call clip blit
     if (srcrect->x || srcrect->w != surf_src->w) {
         RLEClipBlit(w, srcbuf, surf_dst, dstbuf, srcrect, alpha);
     } else {
-        const SDL_PixelFormatDetails *fmt = surf_src->internal->format;
+        const SDL_PixelFormatDetails *fmt = surf_src->fmt;
 
 #define RLEBLIT(bpp, Type, do_blit)                                   \
     do {                                                              \
@@ -608,7 +608,7 @@ done:
 static void RLEAlphaClipBlit(int w, Uint8 *srcbuf, SDL_Surface *surf_dst,
                              Uint8 *dstbuf, const SDL_Rect *srcrect)
 {
-    const SDL_PixelFormatDetails *df = surf_dst->internal->format;
+    const SDL_PixelFormatDetails *df = surf_dst->fmt;
     /*
      * clipped blitter: Ptype is the destination pixel type,
      * Ctype the translucent count type, and do_blend the macro
@@ -703,7 +703,7 @@ static bool SDLCALL SDL_RLEAlphaBlit(SDL_Surface *surf_src, const SDL_Rect *srcr
     int x, y;
     int w = surf_src->w;
     Uint8 *srcbuf, *dstbuf;
-    const SDL_PixelFormatDetails *df = surf_dst->internal->format;
+    const SDL_PixelFormatDetails *df = surf_dst->fmt;
 
     // Lock the destination if necessary
     if (SDL_MUSTLOCK(surf_dst)) {
@@ -715,7 +715,7 @@ static bool SDLCALL SDL_RLEAlphaBlit(SDL_Surface *surf_src, const SDL_Rect *srcr
     x = dstrect->x;
     y = dstrect->y;
     dstbuf = (Uint8 *)surf_dst->pixels + y * surf_dst->pitch + x * df->bytes_per_pixel;
-    srcbuf = (Uint8 *)surf_src->internal->map.data + sizeof(SDL_PixelFormat);
+    srcbuf = (Uint8 *)surf_src->map.data + sizeof(SDL_PixelFormat);
 
     {
         // skip lines at the top if necessary
@@ -1002,12 +1002,12 @@ static bool RLEAlphaSurface(SDL_Surface *surface)
     int (*copy_transl)(void *, const Uint32 *, int,
                        const SDL_PixelFormatDetails *, const SDL_PixelFormatDetails *);
 
-    dest = surface->internal->map.info.dst_surface;
+    dest = surface->map.info.dst_surface;
     if (!dest) {
         return false;
     }
-    df = dest->internal->format;
-    if (surface->internal->format->bits_per_pixel != 32) {
+    df = dest->fmt;
+    if (surface->fmt->bits_per_pixel != 32) {
         return false; // only 32bpp source supported
     }
 
@@ -1071,7 +1071,7 @@ static bool RLEAlphaSurface(SDL_Surface *surface)
     {
         int x, y;
         int h = surface->h, w = surface->w;
-        const SDL_PixelFormatDetails *sf = surface->internal->format;
+        const SDL_PixelFormatDetails *sf = surface->fmt;
         Uint32 *src = (Uint32 *)surface->pixels;
         Uint8 *lastline = dst; // end of last non-blank line
 
@@ -1194,7 +1194,7 @@ static bool RLEAlphaSurface(SDL_Surface *surface)
         if (!p) {
             p = rlebuf;
         }
-        surface->internal->map.data = p;
+        surface->map.data = p;
     }
 
     return true;
@@ -1237,7 +1237,7 @@ static bool RLEColorkeySurface(SDL_Surface *surface)
     int y;
     Uint8 *srcbuf, *lastline;
     int maxsize = 0;
-    const int bpp = surface->internal->format->bytes_per_pixel;
+    const int bpp = surface->fmt->bytes_per_pixel;
     getpix_func getpix;
     Uint32 ckey, rgbmask;
     int w, h;
@@ -1272,8 +1272,8 @@ static bool RLEColorkeySurface(SDL_Surface *surface)
     srcbuf = (Uint8 *)surface->pixels;
     maxn = bpp == 4 ? 65535 : 255;
     dst = rlebuf;
-    rgbmask = ~surface->internal->format->Amask;
-    ckey = surface->internal->map.info.colorkey & rgbmask;
+    rgbmask = ~surface->fmt->Amask;
+    ckey = surface->map.info.colorkey & rgbmask;
     lastline = dst;
     getpix = getpixes[bpp - 1];
     w = surface->w;
@@ -1362,7 +1362,7 @@ static bool RLEColorkeySurface(SDL_Surface *surface)
         if (!p) {
             p = rlebuf;
         }
-        surface->internal->map.data = p;
+        surface->map.data = p;
     }
 
     return true;
@@ -1373,7 +1373,7 @@ bool SDL_RLESurface(SDL_Surface *surface)
     int flags;
 
     // Clear any previous RLE conversion
-    if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
+    if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
         SDL_UnRLESurface(surface, true);
     }
 
@@ -1387,7 +1387,7 @@ bool SDL_RLESurface(SDL_Surface *surface)
         return false;
     }
 
-    flags = surface->internal->map.info.flags;
+    flags = surface->map.info.flags;
     if (flags & SDL_COPY_COLORKEY) {
         // ok
     } else if ((flags & SDL_COPY_BLEND) && SDL_ISPIXELFORMAT_ALPHA(surface->format)) {
@@ -1407,24 +1407,24 @@ bool SDL_RLESurface(SDL_Surface *surface)
 
     // Encode and set up the blit
     if (!SDL_ISPIXELFORMAT_ALPHA(surface->format) || !(flags & SDL_COPY_BLEND)) {
-        if (!surface->internal->map.identity) {
+        if (!surface->map.identity) {
             return false;
         }
         if (!RLEColorkeySurface(surface)) {
             return false;
         }
-        surface->internal->map.blit = SDL_RLEBlit;
-        surface->internal->map.info.flags |= SDL_COPY_RLE_COLORKEY;
+        surface->map.blit = SDL_RLEBlit;
+        surface->map.info.flags |= SDL_COPY_RLE_COLORKEY;
     } else {
         if (!RLEAlphaSurface(surface)) {
             return false;
         }
-        surface->internal->map.blit = SDL_RLEAlphaBlit;
-        surface->internal->map.info.flags |= SDL_COPY_RLE_ALPHAKEY;
+        surface->map.blit = SDL_RLEAlphaBlit;
+        surface->map.info.flags |= SDL_COPY_RLE_ALPHAKEY;
     }
 
     // The surface is now accelerated
-    surface->internal->flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
+    surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
 
     return true;
 }
@@ -1439,8 +1439,8 @@ static bool UnRLEAlpha(SDL_Surface *surface)
 {
     Uint8 *srcbuf;
     Uint32 *dst;
-    const SDL_PixelFormatDetails *sf = surface->internal->format;
-    const SDL_PixelFormatDetails *df = SDL_GetPixelFormatDetails(*(SDL_PixelFormat *)surface->internal->map.data);
+    const SDL_PixelFormatDetails *sf = surface->fmt;
+    const SDL_PixelFormatDetails *df = SDL_GetPixelFormatDetails(*(SDL_PixelFormat *)surface->map.data);
     int (*uncopy_opaque)(Uint32 *, const void *, int,
                          const SDL_PixelFormatDetails *, const SDL_PixelFormatDetails *);
     int (*uncopy_transl)(Uint32 *, const void *, int,
@@ -1469,7 +1469,7 @@ static bool UnRLEAlpha(SDL_Surface *surface)
     SDL_memset(surface->pixels, 0, (size_t)surface->h * surface->pitch);
 
     dst = (Uint32 *)surface->pixels;
-    srcbuf = (Uint8 *)surface->internal->map.data + sizeof(SDL_PixelFormat);
+    srcbuf = (Uint8 *)surface->map.data + sizeof(SDL_PixelFormat);
     for (;;) {
         // copy opaque pixels
         int ofs = 0;
@@ -1518,30 +1518,30 @@ end_function:
 
 void SDL_UnRLESurface(SDL_Surface *surface, bool recode)
 {
-    if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
-        surface->internal->flags &= ~SDL_INTERNAL_SURFACE_RLEACCEL;
+    if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
+        surface->internal_flags &= ~SDL_INTERNAL_SURFACE_RLEACCEL;
 
         if (recode && !(surface->flags & SDL_SURFACE_PREALLOCATED)) {
-            if (surface->internal->map.info.flags & SDL_COPY_RLE_COLORKEY) {
+            if (surface->map.info.flags & SDL_COPY_RLE_COLORKEY) {
                 SDL_Rect full;
                 size_t size;
 
                 // re-create the original surface
                 if (!SDL_size_mul_check_overflow(surface->h, surface->pitch, &size)) {
                     // Memory corruption?
-                    surface->internal->flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
+                    surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
                     return;
                 }
                 surface->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), size);
                 if (!surface->pixels) {
                     // Oh crap...
-                    surface->internal->flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
+                    surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
                     return;
                 }
                 surface->flags |= SDL_SURFACE_SIMD_ALIGNED;
 
                 // fill it with the background color
-                SDL_FillSurfaceRect(surface, NULL, surface->internal->map.info.colorkey);
+                SDL_FillSurfaceRect(surface, NULL, surface->map.info.colorkey);
 
                 // now render the encoded surface
                 full.x = full.y = 0;
@@ -1551,16 +1551,16 @@ void SDL_UnRLESurface(SDL_Surface *surface, bool recode)
             } else {
                 if (!UnRLEAlpha(surface)) {
                     // Oh crap...
-                    surface->internal->flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
+                    surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL;
                     return;
                 }
             }
         }
-        surface->internal->map.info.flags &=
+        surface->map.info.flags &=
             ~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY);
 
-        SDL_free(surface->internal->map.data);
-        surface->internal->map.data = NULL;
+        SDL_free(surface->map.data);
+        surface->map.data = NULL;
     }
 }
 

+ 12 - 12
src/video/SDL_blit.c

@@ -21,7 +21,7 @@
 #include "SDL_internal.h"
 
 #include "SDL_sysvideo.h"
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_blit_auto.h"
 #include "SDL_blit_copy.h"
 #include "SDL_blit_slow.h"
@@ -61,7 +61,7 @@ static bool SDLCALL SDL_SoftBlit(SDL_Surface *src, const SDL_Rect *srcrect,
     // Set up source and destination buffer pointers, and BLIT!
     if (okay) {
         SDL_BlitFunc RunBlit;
-        SDL_BlitInfo *info = &src->internal->map.info;
+        SDL_BlitInfo *info = &src->map.info;
 
         // Set up the blit information
         info->src = (Uint8 *)src->pixels +
@@ -80,7 +80,7 @@ static bool SDLCALL SDL_SoftBlit(SDL_Surface *src, const SDL_Rect *srcrect,
         info->dst_pitch = dst->pitch;
         info->dst_skip =
             info->dst_pitch - info->dst_w * info->dst_fmt->bytes_per_pixel;
-        RunBlit = (SDL_BlitFunc)src->internal->map.data;
+        RunBlit = (SDL_BlitFunc)src->map.data;
 
         // Run the actual software blit
         RunBlit(info);
@@ -179,9 +179,9 @@ static SDL_BlitFunc SDL_ChooseBlitFunc(SDL_PixelFormat src_format, SDL_PixelForm
 bool SDL_CalculateBlit(SDL_Surface *surface, SDL_Surface *dst)
 {
     SDL_BlitFunc blit = NULL;
-    SDL_BlitMap *map = &surface->internal->map;
-    SDL_Colorspace src_colorspace = surface->internal->colorspace;
-    SDL_Colorspace dst_colorspace = dst->internal->colorspace;
+    SDL_BlitMap *map = &surface->map;
+    SDL_Colorspace src_colorspace = surface->colorspace;
+    SDL_Colorspace dst_colorspace = dst->colorspace;
 
     // We don't currently support blitting to < 8 bpp surfaces
     if (SDL_BITSPERPIXEL(dst->format) < 8) {
@@ -198,11 +198,11 @@ bool SDL_CalculateBlit(SDL_Surface *surface, SDL_Surface *dst)
 
     map->blit = SDL_SoftBlit;
     map->info.src_surface = surface;
-    map->info.src_fmt = surface->internal->format;
-    map->info.src_pal = surface->internal->palette;
+    map->info.src_fmt = surface->fmt;
+    map->info.src_pal = surface->palette;
     map->info.dst_surface = dst;
-    map->info.dst_fmt = dst->internal->format;
-    map->info.dst_pal = dst->internal->palette;
+    map->info.dst_fmt = dst->fmt;
+    map->info.dst_pal = dst->palette;
 
 #if SDL_HAVE_RLE
     // See if we can do RLE acceleration
@@ -270,10 +270,10 @@ bool SDL_CalculateBlit(SDL_Surface *surface, SDL_Surface *dst)
         SDL_PixelFormat dst_format = dst->format;
 
         if ((!SDL_ISPIXELFORMAT_INDEXED(src_format) ||
-             (src_format == SDL_PIXELFORMAT_INDEX8 && surface->internal->palette)) &&
+             (src_format == SDL_PIXELFORMAT_INDEX8 && surface->palette)) &&
             !SDL_ISPIXELFORMAT_FOURCC(src_format) &&
             (!SDL_ISPIXELFORMAT_INDEXED(dst_format) ||
-             (dst_format == SDL_PIXELFORMAT_INDEX8 && dst->internal->palette)) &&
+             (dst_format == SDL_PIXELFORMAT_INDEX8 && dst->palette)) &&
             !SDL_ISPIXELFORMAT_FOURCC(dst_format)) {
             blit = SDL_Blit_Slow;
         }

+ 0 - 4
src/video/SDL_blit.h

@@ -23,8 +23,6 @@
 #ifndef SDL_blit_h_
 #define SDL_blit_h_
 
-#include "../SDL_hashtable.h"
-
 // Table to do pixel byte expansion
 extern const Uint8 *SDL_expand_byte[9];
 extern const Uint16 SDL_expand_byte_10[];
@@ -724,6 +722,4 @@ extern SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface);
 #pragma warning(disable : 4244) // '=': conversion from 'X' to 'Y', possible loss of data
 #endif
 
-#include "SDL_surface_c.h"
-
 #endif // SDL_blit_h_

+ 6 - 6
src/video/SDL_blit_0.c

@@ -22,7 +22,7 @@
 
 #if SDL_HAVE_BLIT_0
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 
 // Functions to blit from bitmaps to other surfaces
 
@@ -919,14 +919,14 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface)
 {
     int which;
 
-    if (SDL_BITSPERPIXEL(surface->internal->map.info.dst_fmt->format) < 8) {
+    if (SDL_BITSPERPIXEL(surface->map.info.dst_fmt->format) < 8) {
         which = 0;
     } else {
-        which = SDL_BYTESPERPIXEL(surface->internal->map.info.dst_fmt->format);
+        which = SDL_BYTESPERPIXEL(surface->map.info.dst_fmt->format);
     }
 
     if (SDL_PIXELTYPE(surface->format) == SDL_PIXELTYPE_INDEX1) {
-        switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) {
+        switch (surface->map.info.flags & ~SDL_COPY_RLE_MASK) {
         case 0:
             if (which < SDL_arraysize(bitmap_blit_1b)) {
                 return bitmap_blit_1b[which];
@@ -949,7 +949,7 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface)
     }
 
     if (SDL_PIXELTYPE(surface->format) == SDL_PIXELTYPE_INDEX2) {
-        switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) {
+        switch (surface->map.info.flags & ~SDL_COPY_RLE_MASK) {
         case 0:
             if (which < SDL_arraysize(bitmap_blit_2b)) {
                 return bitmap_blit_2b[which];
@@ -972,7 +972,7 @@ SDL_BlitFunc SDL_CalculateBlit0(SDL_Surface *surface)
     }
 
     if (SDL_PIXELTYPE(surface->format) == SDL_PIXELTYPE_INDEX4) {
-        switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) {
+        switch (surface->map.info.flags & ~SDL_COPY_RLE_MASK) {
         case 0:
             if (which < SDL_arraysize(bitmap_blit_4b)) {
                 return bitmap_blit_4b[which];

+ 5 - 5
src/video/SDL_blit_1.c

@@ -22,7 +22,7 @@
 
 #if SDL_HAVE_BLIT_1
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_sysvideo.h"
 
 // Functions to blit from 8-bit surfaces to other surfaces
@@ -518,13 +518,13 @@ SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface *surface)
 {
     int which;
 
-    if (SDL_BITSPERPIXEL(surface->internal->map.info.dst_fmt->format) < 8) {
+    if (SDL_BITSPERPIXEL(surface->map.info.dst_fmt->format) < 8) {
         which = 0;
     } else {
-        which = SDL_BYTESPERPIXEL(surface->internal->map.info.dst_fmt->format);
+        which = SDL_BYTESPERPIXEL(surface->map.info.dst_fmt->format);
     }
 
-    switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) {
+    switch (surface->map.info.flags & ~SDL_COPY_RLE_MASK) {
     case 0:
         if (which < SDL_arraysize(one_blit)) {
             return one_blit[which];
@@ -538,7 +538,7 @@ SDL_BlitFunc SDL_CalculateBlit1(SDL_Surface *surface)
         break;
 
     case SDL_COPY_COLORKEY | SDL_COPY_BLEND:  // this is not super-robust but handles a specific case we found sdl12-compat.
-        if (surface->internal->map.info.a == 255) {
+        if (surface->map.info.a == 255) {
             if (which < SDL_arraysize(one_blitkey)) {
                 return one_blitkey[which];
             }

+ 8 - 8
src/video/SDL_blit_A.c

@@ -22,7 +22,7 @@
 
 #if SDL_HAVE_BLIT_A
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 
 // Functions to perform alpha blended blitting
 
@@ -1322,15 +1322,15 @@ static void BlitNtoNPixelAlpha(SDL_BlitInfo *info)
 
 SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
 {
-    const SDL_PixelFormatDetails *sf = surface->internal->format;
-    const SDL_PixelFormatDetails *df = surface->internal->map.info.dst_fmt;
+    const SDL_PixelFormatDetails *sf = surface->fmt;
+    const SDL_PixelFormatDetails *df = surface->map.info.dst_fmt;
 
-    switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) {
+    switch (surface->map.info.flags & ~SDL_COPY_RLE_MASK) {
     case SDL_COPY_BLEND:
         // Per-pixel alpha blits
         switch (df->bytes_per_pixel) {
         case 1:
-            if (surface->internal->map.info.dst_pal) {
+            if (surface->map.info.dst_pal) {
                 return BlitNto1PixelAlpha;
             } else {
                 // RGB332 has no palette !
@@ -1386,7 +1386,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
             // Per-surface alpha blits
             switch (df->bytes_per_pixel) {
             case 1:
-                if (surface->internal->map.info.dst_pal) {
+                if (surface->map.info.dst_pal) {
                     return BlitNto1SurfaceAlpha;
                 } else {
                     // RGB332 has no palette !
@@ -1394,7 +1394,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
                 }
 
             case 2:
-                if (surface->internal->map.identity) {
+                if (surface->map.identity) {
                     if (df->Gmask == 0x7e0) {
 #ifdef SDL_MMX_INTRINSICS
                         if (SDL_HasMMX()) {
@@ -1441,7 +1441,7 @@ SDL_BlitFunc SDL_CalculateBlitA(SDL_Surface *surface)
         if (sf->Amask == 0) {
             if (df->bytes_per_pixel == 1) {
 
-                if (surface->internal->map.info.dst_pal) {
+                if (surface->map.info.dst_pal) {
                     return BlitNto1SurfaceAlphaKey;
                 } else {
                     // RGB332 has no palette !

+ 5 - 5
src/video/SDL_blit_N.c

@@ -22,7 +22,7 @@
 
 #if SDL_HAVE_BLIT_N
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_blit_copy.h"
 
 // General optimized routines that write char by char
@@ -2948,15 +2948,15 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
     SDL_BlitFunc blitfun;
 
     // Set up data for choosing the blit
-    srcfmt = surface->internal->format;
-    dstfmt = surface->internal->map.info.dst_fmt;
+    srcfmt = surface->fmt;
+    dstfmt = surface->map.info.dst_fmt;
 
     // We don't support destinations less than 8-bits
     if (dstfmt->bits_per_pixel < 8) {
         return NULL;
     }
 
-    switch (surface->internal->map.info.flags & ~SDL_COPY_RLE_MASK) {
+    switch (surface->map.info.flags & ~SDL_COPY_RLE_MASK) {
     case 0:
         blitfun = NULL;
         if (dstfmt->bits_per_pixel > 8) {
@@ -3017,7 +3017,7 @@ SDL_BlitFunc SDL_CalculateBlitN(SDL_Surface *surface)
            because RLE is the preferred fast way to deal with this.
            If a particular case turns out to be useful we'll add it. */
 
-        if (srcfmt->bytes_per_pixel == 2 && surface->internal->map.identity != 0) {
+        if (srcfmt->bytes_per_pixel == 2 && surface->map.identity != 0) {
             return Blit2to2Key;
         } else {
 #ifdef SDL_ALTIVEC_BLITTERS

+ 0 - 1
src/video/SDL_blit_auto.c

@@ -20,7 +20,6 @@
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_internal.h"
-#include "SDL_blit.h"
 
 #if SDL_HAVE_BLIT_AUTO
 

+ 1 - 1
src/video/SDL_blit_copy.c

@@ -20,7 +20,7 @@
 */
 #include "SDL_internal.h"
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_blit_copy.h"
 
 #ifdef SDL_SSE_INTRINSICS

+ 3 - 3
src/video/SDL_blit_slow.c

@@ -20,7 +20,7 @@
 */
 #include "SDL_internal.h"
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_blit_slow.h"
 #include "SDL_pixels_c.h"
 
@@ -839,8 +839,8 @@ void SDL_Blit_Slow_Float(SDL_BlitInfo *info)
     Uint32 last_pixel = 0;
     Uint8 last_index = 0;
 
-    src_colorspace = info->src_surface->internal->colorspace;
-    dst_colorspace = info->dst_surface->internal->colorspace;
+    src_colorspace = info->src_surface->colorspace;
+    dst_colorspace = info->dst_surface->colorspace;
     src_primaries = SDL_COLORSPACEPRIMARIES(src_colorspace);
     dst_primaries = SDL_COLORSPACEPRIMARIES(dst_colorspace);
 

+ 17 - 16
src/video/SDL_bmp.c

@@ -33,6 +33,7 @@
 */
 
 #include "SDL_pixels_c.h"
+#include "SDL_surface_c.h"
 
 #define SAVE_32BIT_BMP
 
@@ -518,7 +519,7 @@ SDL_Surface *SDL_LoadBMP_IO(SDL_IOStream *src, bool closeio)
         if (SDL_ReadIO(src, bits, surface->pitch) != (size_t)surface->pitch) {
             goto done;
         }
-        if (biBitCount == 8 && surface->internal->palette && biClrUsed < (1u << biBitCount)) {
+        if (biBitCount == 8 && surface->palette && biClrUsed < (1u << biBitCount)) {
             for (i = 0; i < surface->w; ++i) {
                 if (bits[i] >= biClrUsed) {
                     SDL_SetError("A BMP image contains a pixel with a color out of the palette");
@@ -644,12 +645,12 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
         // We can save alpha information in a 32-bit BMP
         if (SDL_BITSPERPIXEL(surface->format) >= 8 &&
             (SDL_ISPIXELFORMAT_ALPHA(surface->format) ||
-             surface->internal->map.info.flags & SDL_COPY_COLORKEY)) {
+             surface->map.info.flags & SDL_COPY_COLORKEY)) {
             save32bit = true;
         }
 #endif // SAVE_32BIT_BMP
 
-        if (surface->internal->palette && !save32bit) {
+        if (surface->palette && !save32bit) {
             if (SDL_BITSPERPIXEL(surface->format) == 8) {
                 intermediate_surface = surface;
             } else {
@@ -659,13 +660,13 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
             }
         } else if ((SDL_BITSPERPIXEL(surface->format) == 24) && !save32bit &&
 #if SDL_BYTEORDER == SDL_LIL_ENDIAN
-                   (surface->internal->format->Rmask == 0x00FF0000) &&
-                   (surface->internal->format->Gmask == 0x0000FF00) &&
-                   (surface->internal->format->Bmask == 0x000000FF)
+                   (surface->fmt->Rmask == 0x00FF0000) &&
+                   (surface->fmt->Gmask == 0x0000FF00) &&
+                   (surface->fmt->Bmask == 0x000000FF)
 #else
-                   (surface->internal->format->Rmask == 0x000000FF) &&
-                   (surface->internal->format->Gmask == 0x0000FF00) &&
-                   (surface->internal->format->Bmask == 0x00FF0000)
+                   (surface->fmt->Rmask == 0x000000FF) &&
+                   (surface->fmt->Gmask == 0x0000FF00) &&
+                   (surface->fmt->Bmask == 0x00FF0000)
 #endif
         ) {
             intermediate_surface = surface;
@@ -697,7 +698,7 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
     }
 
     if (SDL_LockSurface(intermediate_surface)) {
-        const size_t bw = intermediate_surface->w * intermediate_surface->internal->format->bytes_per_pixel;
+        const size_t bw = intermediate_surface->w * intermediate_surface->fmt->bytes_per_pixel;
 
         // Set the BMP file header values
         bfSize = 0; // We'll write this when we're done
@@ -723,13 +724,13 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
         biWidth = intermediate_surface->w;
         biHeight = intermediate_surface->h;
         biPlanes = 1;
-        biBitCount = intermediate_surface->internal->format->bits_per_pixel;
+        biBitCount = intermediate_surface->fmt->bits_per_pixel;
         biCompression = BI_RGB;
         biSizeImage = intermediate_surface->h * intermediate_surface->pitch;
         biXPelsPerMeter = 0;
         biYPelsPerMeter = 0;
-        if (intermediate_surface->internal->palette) {
-            biClrUsed = intermediate_surface->internal->palette->ncolors;
+        if (intermediate_surface->palette) {
+            biClrUsed = intermediate_surface->palette->ncolors;
         } else {
             biClrUsed = 0;
         }
@@ -787,12 +788,12 @@ bool SDL_SaveBMP_IO(SDL_Surface *surface, SDL_IOStream *dst, bool closeio)
         }
 
         // Write the palette (in BGR color order)
-        if (intermediate_surface->internal->palette) {
+        if (intermediate_surface->palette) {
             SDL_Color *colors;
             int ncolors;
 
-            colors = intermediate_surface->internal->palette->colors;
-            ncolors = intermediate_surface->internal->palette->ncolors;
+            colors = intermediate_surface->palette->colors;
+            ncolors = intermediate_surface->palette->ncolors;
             for (i = 0; i < ncolors; ++i) {
                 if (!SDL_WriteU8(dst, colors[i].b) ||
                     !SDL_WriteU8(dst, colors[i].g) ||

+ 3 - 3
src/video/SDL_fillrect.c

@@ -20,7 +20,7 @@
 */
 #include "SDL_internal.h"
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 
 #ifdef SDL_SSE_INTRINSICS
 /* *INDENT-OFF* */ // clang-format off
@@ -237,7 +237,7 @@ bool SDL_FillSurfaceRect(SDL_Surface *dst, const SDL_Rect *rect, Uint32 color)
 
     // If 'rect' == NULL, then fill the whole surface
     if (!rect) {
-        rect = &dst->internal->clip_rect;
+        rect = &dst->clip_rect;
         // Don't attempt to fill if the surface's clip_rect is empty
         if (SDL_RectEmpty(rect)) {
             return true;
@@ -346,7 +346,7 @@ bool SDL_FillSurfaceRects(SDL_Surface *dst, const SDL_Rect *rects, int count, Ui
     for (i = 0; i < count; ++i) {
         rect = &rects[i];
         // Perform clipping
-        if (!SDL_GetRectIntersection(rect, &dst->internal->clip_rect, &clipped)) {
+        if (!SDL_GetRectIntersection(rect, &dst->clip_rect, &clipped)) {
             continue;
         }
         rect = &clipped;

+ 18 - 21
src/video/SDL_pixels.c

@@ -23,11 +23,8 @@
 // General (mostly internal) pixel/color manipulation routines for SDL
 
 #include "SDL_sysvideo.h"
-#include "SDL_blit.h"
 #include "SDL_pixels_c.h"
 #include "SDL_RLEaccel_c.h"
-#include "../SDL_hashtable.h"
-#include "../SDL_list.h"
 
 // Lookup tables to expand partial bytes to the full 0..255 range
 
@@ -1419,22 +1416,22 @@ static Uint8 *Map1toN(const SDL_Palette *pal, Uint8 Rmod, Uint8 Gmod, Uint8 Bmod
 
 bool SDL_ValidateMap(SDL_Surface *src, SDL_Surface *dst)
 {
-    SDL_BlitMap *map = &src->internal->map;
-
-    if (map->info.dst_fmt != dst->internal->format ||
-        map->info.dst_pal != dst->internal->palette ||
-        (dst->internal->palette &&
-         map->dst_palette_version != dst->internal->palette->version) ||
-        (src->internal->palette &&
-         map->src_palette_version != src->internal->palette->version)) {
+    SDL_BlitMap *map = &src->map;
+
+    if (map->info.dst_fmt != dst->fmt ||
+        map->info.dst_pal != dst->palette ||
+        (dst->palette &&
+         map->dst_palette_version != dst->palette->version) ||
+        (src->palette &&
+         map->src_palette_version != src->palette->version)) {
         if (!SDL_MapSurface(src, dst)) {
             return false;
         }
         // just here for debugging
         // printf
-        // ("src = 0x%08X src->flags = %08X map->info.flags = %08x\ndst = 0x%08X dst->flags = %08X dst->internal->map.info.flags = %08X\nmap->blit = 0x%08x\n",
+        // ("src = 0x%08X src->flags = %08X map->info.flags = %08x\ndst = 0x%08X dst->flags = %08X dst->map.info.flags = %08X\nmap->blit = 0x%08x\n",
         // src, dst->flags, map->info.flags, dst, dst->flags,
-        // dst->internal->map.info.flags, map->blit);
+        // dst->map.info.flags, map->blit);
     } else {
         map->info.dst_surface = dst;
     }
@@ -1466,9 +1463,9 @@ bool SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst)
     SDL_BlitMap *map;
 
     // Clear out any previous mapping
-    map = &src->internal->map;
+    map = &src->map;
 #if SDL_HAVE_RLE
-    if (src->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
+    if (src->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
         SDL_UnRLESurface(src, true);
     }
 #endif
@@ -1476,10 +1473,10 @@ bool SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst)
 
     // Figure out what kind of mapping we're doing
     map->identity = 0;
-    srcfmt = src->internal->format;
-    srcpal = src->internal->palette;
-    dstfmt = dst->internal->format;
-    dstpal = dst->internal->palette;
+    srcfmt = src->fmt;
+    srcpal = src->palette;
+    dstfmt = dst->fmt;
+    dstpal = dst->palette;
     if (SDL_ISPIXELFORMAT_INDEXED(srcfmt->format)) {
         if (SDL_ISPIXELFORMAT_INDEXED(dstfmt->format)) {
             // Palette --> Palette
@@ -1499,8 +1496,8 @@ bool SDL_MapSurface(SDL_Surface *src, SDL_Surface *dst)
         } else {
             // Palette --> BitField
             map->info.table =
-                Map1toN(srcpal, src->internal->map.info.r, src->internal->map.info.g,
-                        src->internal->map.info.b, src->internal->map.info.a, dstfmt);
+                Map1toN(srcpal, src->map.info.r, src->map.info.g,
+                        src->map.info.b, src->map.info.a, dstfmt);
             if (!map->info.table) {
                 return false;
             }

+ 3 - 3
src/video/SDL_stretch.c

@@ -20,7 +20,7 @@
 */
 #include "SDL_internal.h"
 
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 
 static bool SDL_LowerSoftStretchNearest(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
 static bool SDL_LowerSoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect);
@@ -42,7 +42,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst
 
     if (src->format != dst->format) {
         // Slow!
-        SDL_Surface *src_tmp = SDL_ConvertSurfaceAndColorspace(src, dst->format, dst->internal->palette, dst->internal->colorspace, dst->internal->props);
+        SDL_Surface *src_tmp = SDL_ConvertSurfaceAndColorspace(src, dst->format, dst->palette, dst->colorspace, dst->props);
         if (!src_tmp) {
             return false;
         }
@@ -69,7 +69,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst
                 result = SDL_ConvertPixelsAndColorspace(dstrect->w, dstrect->h,
                             dst_tmp->format, SDL_COLORSPACE_SRGB, 0,
                             dst_tmp->pixels, dst_tmp->pitch,
-                            dst->format, dst->internal->colorspace, SDL_GetSurfaceProperties(dst),
+                            dst->format, dst->colorspace, SDL_GetSurfaceProperties(dst),
                             (Uint8 *)dst->pixels + dstrect->y * dst->pitch + dstrect->x * SDL_BYTESPERPIXEL(dst->format), dst->pitch);
             }
         } else {

+ 255 - 256
src/video/SDL_surface.c

@@ -22,7 +22,6 @@
 
 #include "SDL_sysvideo.h"
 #include "SDL_video_c.h"
-#include "SDL_blit.h"
 #include "SDL_RLEaccel_c.h"
 #include "SDL_pixels_c.h"
 #include "SDL_yuv_c.h"
@@ -37,11 +36,14 @@ SDL_COMPILE_TIME_ASSERT(surface_size_assumptions,
 
 SDL_COMPILE_TIME_ASSERT(can_indicate_overflow, SDL_SIZE_MAX > SDL_MAX_SINT32);
 
+// Magic!
+static char SDL_surface_magic;
+
 // Public routines
 
 bool SDL_SurfaceValid(SDL_Surface *surface)
 {
-    return surface && surface->internal;
+    return (surface && surface->reserved == &SDL_surface_magic);
 }
 
 void SDL_UpdateSurfaceLockFlag(SDL_Surface *surface)
@@ -123,11 +125,9 @@ bool SDL_CalculateSurfaceSize(SDL_PixelFormat format, int width, int height, siz
     return true;
 }
 
-static SDL_Surface *SDL_InitializeSurface(SDL_InternalSurface *mem, int width, int height, SDL_PixelFormat format, SDL_Colorspace colorspace, SDL_PropertiesID props, void *pixels, int pitch, bool onstack)
+static bool SDL_InitializeSurface(SDL_Surface *surface, int width, int height, SDL_PixelFormat format, SDL_Colorspace colorspace, SDL_PropertiesID props, void *pixels, int pitch, bool onstack)
 {
-    SDL_Surface *surface = &mem->surface;
-
-    SDL_zerop(mem);
+    SDL_zerop(surface);
 
     surface->flags = SDL_SURFACE_PREALLOCATED;
     surface->format = format;
@@ -135,37 +135,38 @@ static SDL_Surface *SDL_InitializeSurface(SDL_InternalSurface *mem, int width, i
     surface->h = height;
     surface->pixels = pixels;
     surface->pitch = pitch;
+    surface->reserved = &SDL_surface_magic;
 
-    surface->internal = &mem->internal;
     if (onstack) {
-        surface->internal->flags |= SDL_INTERNAL_SURFACE_STACK;
+        surface->internal_flags |= SDL_INTERNAL_SURFACE_STACK;
     }
 
-    surface->internal->format = SDL_GetPixelFormatDetails(format);
-    if (!surface->internal->format) {
+    surface->fmt = SDL_GetPixelFormatDetails(format);
+    if (!surface->fmt) {
         SDL_DestroySurface(surface);
-        return NULL;
+        return false;
     }
 
     // Initialize the clip rect
-    surface->internal->clip_rect.w = width;
-    surface->internal->clip_rect.h = height;
+    surface->clip_rect.w = width;
+    surface->clip_rect.h = height;
 
     // Allocate an empty mapping
-    surface->internal->map.info.r = 0xFF;
-    surface->internal->map.info.g = 0xFF;
-    surface->internal->map.info.b = 0xFF;
-    surface->internal->map.info.a = 0xFF;
+    surface->map.info.r = 0xFF;
+    surface->map.info.g = 0xFF;
+    surface->map.info.b = 0xFF;
+    surface->map.info.a = 0xFF;
 
     if (colorspace == SDL_COLORSPACE_UNKNOWN) {
-        surface->internal->colorspace = SDL_GetDefaultColorspaceForFormat(format);
+        surface->colorspace = SDL_GetDefaultColorspaceForFormat(format);
     } else {
-        surface->internal->colorspace = colorspace;
+        surface->colorspace = colorspace;
     }
 
     if (props) {
         if (!SDL_CopyProperties(props, SDL_GetSurfaceProperties(surface))) {
-            return NULL;
+            SDL_DestroySurface(surface);
+            return false;
         }
     }
 
@@ -176,7 +177,7 @@ static SDL_Surface *SDL_InitializeSurface(SDL_InternalSurface *mem, int width, i
 
     // The surface is ready to go
     surface->refcount = 1;
-    return surface;
+    return true;
 }
 
 /*
@@ -185,7 +186,6 @@ static SDL_Surface *SDL_InitializeSurface(SDL_InternalSurface *mem, int width, i
 SDL_Surface *SDL_CreateSurface(int width, int height, SDL_PixelFormat format)
 {
     size_t pitch, size;
-    SDL_InternalSurface *mem;
     SDL_Surface *surface;
 
     if (width < 0) {
@@ -204,25 +204,26 @@ SDL_Surface *SDL_CreateSurface(int width, int height, SDL_PixelFormat format)
     }
 
     // Allocate and initialize the surface
-    mem = (SDL_InternalSurface *)SDL_malloc(sizeof(*mem));
-    if (!mem) {
+    surface = (SDL_Surface *)SDL_malloc(sizeof(*surface));
+    if (!surface) {
         return NULL;
     }
 
-    surface = SDL_InitializeSurface(mem, width, height, format, SDL_COLORSPACE_UNKNOWN, 0, NULL, (int)pitch, false);
-    if (surface) {
-        if (surface->w && surface->h) {
-            surface->flags &= ~SDL_SURFACE_PREALLOCATED;
-            surface->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), size);
-            if (!surface->pixels) {
-                SDL_DestroySurface(surface);
-                return NULL;
-            }
-            surface->flags |= SDL_SURFACE_SIMD_ALIGNED;
+    if (!SDL_InitializeSurface(surface, width, height, format, SDL_COLORSPACE_UNKNOWN, 0, NULL, (int)pitch, false)) {
+        return NULL;
+    }
 
-            // This is important for bitmaps
-            SDL_memset(surface->pixels, 0, size);
+    if (surface->w && surface->h) {
+        surface->flags &= ~SDL_SURFACE_PREALLOCATED;
+        surface->pixels = SDL_aligned_alloc(SDL_GetSIMDAlignment(), size);
+        if (!surface->pixels) {
+            SDL_DestroySurface(surface);
+            return NULL;
         }
+        surface->flags |= SDL_SURFACE_SIMD_ALIGNED;
+
+        // This is important for bitmaps
+        SDL_memset(surface->pixels, 0, size);
     }
     return surface;
 }
@@ -233,8 +234,6 @@ SDL_Surface *SDL_CreateSurface(int width, int height, SDL_PixelFormat format)
  */
 SDL_Surface *SDL_CreateSurfaceFrom(int width, int height, SDL_PixelFormat format, void *pixels, int pitch)
 {
-    SDL_InternalSurface *mem;
-
     if (width < 0) {
         SDL_InvalidParamError("width");
         return NULL;
@@ -262,12 +261,12 @@ SDL_Surface *SDL_CreateSurfaceFrom(int width, int height, SDL_PixelFormat format
     }
 
     // Allocate and initialize the surface
-    mem = (SDL_InternalSurface *)SDL_malloc(sizeof(*mem));
-    if (!mem) {
+    SDL_Surface *surface = (SDL_Surface *)SDL_malloc(sizeof(*surface));
+    if (!surface ||
+        !SDL_InitializeSurface(surface, width, height, format, SDL_COLORSPACE_UNKNOWN, 0, pixels, pitch, false)) {
         return NULL;
     }
-
-    return SDL_InitializeSurface(mem, width, height, format, SDL_COLORSPACE_UNKNOWN, 0, pixels, pitch, false);
+    return surface;
 }
 
 SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface *surface)
@@ -277,10 +276,10 @@ SDL_PropertiesID SDL_GetSurfaceProperties(SDL_Surface *surface)
         return 0;
     }
 
-    if (!surface->internal->props) {
-        surface->internal->props = SDL_CreateProperties();
+    if (!surface->props) {
+        surface->props = SDL_CreateProperties();
     }
-    return surface->internal->props;
+    return surface->props;
 }
 
 bool SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace)
@@ -289,7 +288,7 @@ bool SDL_SetSurfaceColorspace(SDL_Surface *surface, SDL_Colorspace colorspace)
         return SDL_InvalidParamError("surface");
     }
 
-    surface->internal->colorspace = colorspace;
+    surface->colorspace = colorspace;
     return true;
 }
 
@@ -299,7 +298,7 @@ SDL_Colorspace SDL_GetSurfaceColorspace(SDL_Surface *surface)
         return SDL_COLORSPACE_UNKNOWN;
     }
 
-    return surface->internal->colorspace;
+    return surface->colorspace;
 }
 
 float SDL_GetDefaultSDRWhitePoint(SDL_Colorspace colorspace)
@@ -317,7 +316,7 @@ float SDL_GetSurfaceSDRWhitePoint(SDL_Surface *surface, SDL_Colorspace colorspac
         float default_value = 1.0f;
 
         if (SDL_SurfaceValid(surface)) {
-            props = surface->internal->props;
+            props = surface->props;
         } else {
             props = 0;
         }
@@ -350,7 +349,7 @@ float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, SDL_Colorspace colorspace)
         float default_value = 0.0f;
 
         if (SDL_SurfaceValid(surface)) {
-            props = surface->internal->props;
+            props = surface->props;
         } else {
             props = 0;
         }
@@ -409,19 +408,19 @@ bool SDL_SetSurfacePalette(SDL_Surface *surface, SDL_Palette *palette)
         return SDL_SetError("SDL_SetSurfacePalette() passed a palette that doesn't match the surface format");
     }
 
-    if (palette != surface->internal->palette) {
-        if (surface->internal->palette) {
-            SDL_DestroyPalette(surface->internal->palette);
+    if (palette != surface->palette) {
+        if (surface->palette) {
+            SDL_DestroyPalette(surface->palette);
         }
 
-        surface->internal->palette = palette;
+        surface->palette = palette;
 
-        if (surface->internal->palette) {
-            ++surface->internal->palette->refcount;
+        if (surface->palette) {
+            ++surface->palette->refcount;
         }
     }
 
-    SDL_InvalidateMap(&surface->internal->map);
+    SDL_InvalidateMap(&surface->map);
 
     return true;
 }
@@ -432,7 +431,7 @@ SDL_Palette *SDL_GetSurfacePalette(SDL_Surface *surface)
         return NULL;
     }
 
-    return surface->internal->palette;
+    return surface->palette;
 }
 
 bool SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image)
@@ -445,13 +444,13 @@ bool SDL_AddSurfaceAlternateImage(SDL_Surface *surface, SDL_Surface *image)
         return SDL_InvalidParamError("image");
     }
 
-    SDL_Surface **images = (SDL_Surface **)SDL_realloc(surface->internal->images, (surface->internal->num_images + 1) * sizeof(*images));
+    SDL_Surface **images = (SDL_Surface **)SDL_realloc(surface->images, (surface->num_images + 1) * sizeof(*images));
     if (!images) {
         return false;
     }
-    images[surface->internal->num_images] = image;
-    surface->internal->images = images;
-    ++surface->internal->num_images;
+    images[surface->num_images] = image;
+    surface->images = images;
+    ++surface->num_images;
     ++image->refcount;
     return true;
 }
@@ -462,7 +461,7 @@ bool SDL_SurfaceHasAlternateImages(SDL_Surface *surface)
         return false;
     }
 
-    return (surface->internal->num_images > 0);
+    return (surface->num_images > 0);
 }
 
 SDL_Surface **SDL_GetSurfaceImages(SDL_Surface *surface, int *count)
@@ -476,14 +475,14 @@ SDL_Surface **SDL_GetSurfaceImages(SDL_Surface *surface, int *count)
         return NULL;
     }
 
-    int num_images = 1 + surface->internal->num_images;
+    int num_images = 1 + surface->num_images;
     SDL_Surface **images = (SDL_Surface **)SDL_malloc((num_images + 1) * sizeof(*images));
     if (!images) {
         return NULL;
     }
     images[0] = surface;
-    if (surface->internal->num_images > 0) {
-        SDL_memcpy(&images[1], surface->internal->images, (surface->internal->num_images * sizeof(images[1])));
+    if (surface->num_images > 0) {
+        SDL_memcpy(&images[1], surface->images, (surface->num_images * sizeof(images[1])));
     }
     images[num_images] = NULL;
 
@@ -569,13 +568,13 @@ void SDL_RemoveSurfaceAlternateImages(SDL_Surface *surface)
         return;
     }
 
-    if (surface->internal->num_images > 0) {
-        for (int i = 0; i < surface->internal->num_images; ++i) {
-            SDL_DestroySurface(surface->internal->images[i]);
+    if (surface->num_images > 0) {
+        for (int i = 0; i < surface->num_images; ++i) {
+            SDL_DestroySurface(surface->images[i]);
         }
-        SDL_free(surface->internal->images);
-        surface->internal->images = NULL;
-        surface->internal->num_images = 0;
+        SDL_free(surface->images);
+        surface->images = NULL;
+        surface->num_images = 0;
     }
 }
 
@@ -587,14 +586,14 @@ bool SDL_SetSurfaceRLE(SDL_Surface *surface, bool enabled)
         return SDL_InvalidParamError("surface");
     }
 
-    flags = surface->internal->map.info.flags;
+    flags = surface->map.info.flags;
     if (enabled) {
-        surface->internal->map.info.flags |= SDL_COPY_RLE_DESIRED;
+        surface->map.info.flags |= SDL_COPY_RLE_DESIRED;
     } else {
-        surface->internal->map.info.flags &= ~SDL_COPY_RLE_DESIRED;
+        surface->map.info.flags &= ~SDL_COPY_RLE_DESIRED;
     }
-    if (surface->internal->map.info.flags != flags) {
-        SDL_InvalidateMap(&surface->internal->map);
+    if (surface->map.info.flags != flags) {
+        SDL_InvalidateMap(&surface->map);
     }
     SDL_UpdateSurfaceLockFlag(surface);
     return true;
@@ -606,7 +605,7 @@ bool SDL_SurfaceHasRLE(SDL_Surface *surface)
         return false;
     }
 
-    if (!(surface->internal->map.info.flags & SDL_COPY_RLE_DESIRED)) {
+    if (!(surface->map.info.flags & SDL_COPY_RLE_DESIRED)) {
         return false;
     }
 
@@ -621,19 +620,19 @@ bool SDL_SetSurfaceColorKey(SDL_Surface *surface, bool enabled, Uint32 key)
         return SDL_InvalidParamError("surface");
     }
 
-    if (surface->internal->palette && key >= ((Uint32)surface->internal->palette->ncolors)) {
+    if (surface->palette && key >= ((Uint32)surface->palette->ncolors)) {
         return SDL_InvalidParamError("key");
     }
 
-    flags = surface->internal->map.info.flags;
+    flags = surface->map.info.flags;
     if (enabled) {
-        surface->internal->map.info.flags |= SDL_COPY_COLORKEY;
-        surface->internal->map.info.colorkey = key;
+        surface->map.info.flags |= SDL_COPY_COLORKEY;
+        surface->map.info.colorkey = key;
     } else {
-        surface->internal->map.info.flags &= ~SDL_COPY_COLORKEY;
+        surface->map.info.flags &= ~SDL_COPY_COLORKEY;
     }
-    if (surface->internal->map.info.flags != flags) {
-        SDL_InvalidateMap(&surface->internal->map);
+    if (surface->map.info.flags != flags) {
+        SDL_InvalidateMap(&surface->map);
     }
 
     return true;
@@ -645,7 +644,7 @@ bool SDL_SurfaceHasColorKey(SDL_Surface *surface)
         return false;
     }
 
-    if (!(surface->internal->map.info.flags & SDL_COPY_COLORKEY)) {
+    if (!(surface->map.info.flags & SDL_COPY_COLORKEY)) {
         return false;
     }
 
@@ -662,12 +661,12 @@ bool SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key)
         return SDL_InvalidParamError("surface");
     }
 
-    if (!(surface->internal->map.info.flags & SDL_COPY_COLORKEY)) {
+    if (!(surface->map.info.flags & SDL_COPY_COLORKEY)) {
         return SDL_SetError("Surface doesn't have a colorkey");
     }
 
     if (key) {
-        *key = surface->internal->map.info.colorkey;
+        *key = surface->map.info.colorkey;
     }
     return true;
 }
@@ -682,7 +681,7 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, bool ignore_alpha)
         return;
     }
 
-    if (!(surface->internal->map.info.flags & SDL_COPY_COLORKEY) ||
+    if (!(surface->map.info.flags & SDL_COPY_COLORKEY) ||
         !SDL_ISPIXELFORMAT_ALPHA(surface->format)) {
         return;
     }
@@ -693,8 +692,8 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, bool ignore_alpha)
 
     if (bpp == 2) {
         Uint16 *row, *spot;
-        Uint16 ckey = (Uint16)surface->internal->map.info.colorkey;
-        Uint16 mask = (Uint16)(~surface->internal->format->Amask);
+        Uint16 ckey = (Uint16)surface->map.info.colorkey;
+        Uint16 mask = (Uint16)(~surface->fmt->Amask);
 
         // Ignore, or not, alpha in colorkey comparison
         if (ignore_alpha) {
@@ -725,8 +724,8 @@ static void SDL_ConvertColorkeyToAlpha(SDL_Surface *surface, bool ignore_alpha)
         }
     } else if (bpp == 4) {
         Uint32 *row, *spot;
-        Uint32 ckey = surface->internal->map.info.colorkey;
-        Uint32 mask = ~surface->internal->format->Amask;
+        Uint32 ckey = surface->map.info.colorkey;
+        Uint32 mask = ~surface->fmt->Amask;
 
         // Ignore, or not, alpha in colorkey comparison
         if (ignore_alpha) {
@@ -771,18 +770,18 @@ bool SDL_SetSurfaceColorMod(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b)
         return SDL_InvalidParamError("surface");
     }
 
-    surface->internal->map.info.r = r;
-    surface->internal->map.info.g = g;
-    surface->internal->map.info.b = b;
+    surface->map.info.r = r;
+    surface->map.info.g = g;
+    surface->map.info.b = b;
 
-    flags = surface->internal->map.info.flags;
+    flags = surface->map.info.flags;
     if (r != 0xFF || g != 0xFF || b != 0xFF) {
-        surface->internal->map.info.flags |= SDL_COPY_MODULATE_COLOR;
+        surface->map.info.flags |= SDL_COPY_MODULATE_COLOR;
     } else {
-        surface->internal->map.info.flags &= ~SDL_COPY_MODULATE_COLOR;
+        surface->map.info.flags &= ~SDL_COPY_MODULATE_COLOR;
     }
-    if (surface->internal->map.info.flags != flags) {
-        SDL_InvalidateMap(&surface->internal->map);
+    if (surface->map.info.flags != flags) {
+        SDL_InvalidateMap(&surface->map);
     }
     return true;
 }
@@ -803,13 +802,13 @@ bool SDL_GetSurfaceColorMod(SDL_Surface *surface, Uint8 *r, Uint8 *g, Uint8 *b)
     }
 
     if (r) {
-        *r = surface->internal->map.info.r;
+        *r = surface->map.info.r;
     }
     if (g) {
-        *g = surface->internal->map.info.g;
+        *g = surface->map.info.g;
     }
     if (b) {
-        *b = surface->internal->map.info.b;
+        *b = surface->map.info.b;
     }
     return true;
 }
@@ -822,16 +821,16 @@ bool SDL_SetSurfaceAlphaMod(SDL_Surface *surface, Uint8 alpha)
         return SDL_InvalidParamError("surface");
     }
 
-    surface->internal->map.info.a = alpha;
+    surface->map.info.a = alpha;
 
-    flags = surface->internal->map.info.flags;
+    flags = surface->map.info.flags;
     if (alpha != 0xFF) {
-        surface->internal->map.info.flags |= SDL_COPY_MODULATE_ALPHA;
+        surface->map.info.flags |= SDL_COPY_MODULATE_ALPHA;
     } else {
-        surface->internal->map.info.flags &= ~SDL_COPY_MODULATE_ALPHA;
+        surface->map.info.flags &= ~SDL_COPY_MODULATE_ALPHA;
     }
-    if (surface->internal->map.info.flags != flags) {
-        SDL_InvalidateMap(&surface->internal->map);
+    if (surface->map.info.flags != flags) {
+        SDL_InvalidateMap(&surface->map);
     }
     return true;
 }
@@ -846,7 +845,7 @@ bool SDL_GetSurfaceAlphaMod(SDL_Surface *surface, Uint8 *alpha)
     }
 
     if (alpha) {
-        *alpha = surface->internal->map.info.a;
+        *alpha = surface->map.info.a;
     }
     return true;
 }
@@ -864,36 +863,36 @@ bool SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
         return SDL_InvalidParamError("blendMode");
     }
 
-    flags = surface->internal->map.info.flags;
-    surface->internal->map.info.flags &= ~SDL_COPY_BLEND_MASK;
+    flags = surface->map.info.flags;
+    surface->map.info.flags &= ~SDL_COPY_BLEND_MASK;
     switch (blendMode) {
     case SDL_BLENDMODE_NONE:
         break;
     case SDL_BLENDMODE_BLEND:
-        surface->internal->map.info.flags |= SDL_COPY_BLEND;
+        surface->map.info.flags |= SDL_COPY_BLEND;
         break;
     case SDL_BLENDMODE_BLEND_PREMULTIPLIED:
-        surface->internal->map.info.flags |= SDL_COPY_BLEND_PREMULTIPLIED;
+        surface->map.info.flags |= SDL_COPY_BLEND_PREMULTIPLIED;
         break;
     case SDL_BLENDMODE_ADD:
-        surface->internal->map.info.flags |= SDL_COPY_ADD;
+        surface->map.info.flags |= SDL_COPY_ADD;
         break;
     case SDL_BLENDMODE_ADD_PREMULTIPLIED:
-        surface->internal->map.info.flags |= SDL_COPY_ADD_PREMULTIPLIED;
+        surface->map.info.flags |= SDL_COPY_ADD_PREMULTIPLIED;
         break;
     case SDL_BLENDMODE_MOD:
-        surface->internal->map.info.flags |= SDL_COPY_MOD;
+        surface->map.info.flags |= SDL_COPY_MOD;
         break;
     case SDL_BLENDMODE_MUL:
-        surface->internal->map.info.flags |= SDL_COPY_MUL;
+        surface->map.info.flags |= SDL_COPY_MUL;
         break;
     default:
         result = SDL_Unsupported();
         break;
     }
 
-    if (surface->internal->map.info.flags != flags) {
-        SDL_InvalidateMap(&surface->internal->map);
+    if (surface->map.info.flags != flags) {
+        SDL_InvalidateMap(&surface->map);
     }
 
     return result;
@@ -913,7 +912,7 @@ bool SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode)
         return true;
     }
 
-    switch (surface->internal->map.info.flags & SDL_COPY_BLEND_MASK) {
+    switch (surface->map.info.flags & SDL_COPY_BLEND_MASK) {
     case SDL_COPY_BLEND:
         *blendMode = SDL_BLENDMODE_BLEND;
         break;
@@ -956,10 +955,10 @@ bool SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
 
     // Set the clipping rectangle
     if (!rect) {
-        surface->internal->clip_rect = full_rect;
+        surface->clip_rect = full_rect;
         return true;
     }
-    return SDL_GetRectIntersection(rect, &full_rect, &surface->internal->clip_rect);
+    return SDL_GetRectIntersection(rect, &full_rect, &surface->clip_rect);
 }
 
 bool SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect)
@@ -973,7 +972,7 @@ bool SDL_GetSurfaceClipRect(SDL_Surface *surface, SDL_Rect *rect)
     if (!rect) {
         return SDL_InvalidParamError("rect");
     }
-    *rect = surface->internal->clip_rect;
+    *rect = surface->clip_rect;
     return true;
 }
 
@@ -995,7 +994,7 @@ bool SDL_BlitSurfaceUnchecked(SDL_Surface *src, const SDL_Rect *srcrect,
     if (!SDL_ValidateMap(src, dst)) {
         return false;
     }
-    return src->internal->map.blit(src, srcrect, dst, dstrect);
+    return src->map.blit(src, srcrect, dst, dstrect);
 }
 
 bool SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect)
@@ -1047,7 +1046,7 @@ bool SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst
     // clip the destination rectangle against the clip rectangle
     {
         SDL_Rect tmp;
-        if (SDL_GetRectIntersection(&r_dst, &dst->internal->clip_rect, &tmp) == false) {
+        if (SDL_GetRectIntersection(&r_dst, &dst->clip_rect, &tmp) == false) {
             return true;
         }
 
@@ -1067,9 +1066,9 @@ bool SDL_BlitSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst
     }
 
     // Switch back to a fast blit if we were previously stretching
-    if (src->internal->map.info.flags & SDL_COPY_NEAREST) {
-        src->internal->map.info.flags &= ~SDL_COPY_NEAREST;
-        SDL_InvalidateMap(&src->internal->map);
+    if (src->map.info.flags & SDL_COPY_NEAREST) {
+        src->map.info.flags &= ~SDL_COPY_NEAREST;
+        SDL_InvalidateMap(&src->map);
     }
 
     return SDL_BlitSurfaceUnchecked(src, &r_src, dst, &r_dst);
@@ -1168,7 +1167,7 @@ bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surfac
     }
 
     // Clip destination rectangle to the clip rectangle
-    clip_rect = &dst->internal->clip_rect;
+    clip_rect = &dst->clip_rect;
 
     // Translate to clip space for easier calculations
     dst_x0 -= clip_rect->x;
@@ -1247,13 +1246,13 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
         return SDL_SetError("Size too large for scaling");
     }
 
-    if (!(src->internal->map.info.flags & SDL_COPY_NEAREST)) {
-        src->internal->map.info.flags |= SDL_COPY_NEAREST;
-        SDL_InvalidateMap(&src->internal->map);
+    if (!(src->map.info.flags & SDL_COPY_NEAREST)) {
+        src->map.info.flags |= SDL_COPY_NEAREST;
+        SDL_InvalidateMap(&src->map);
     }
 
     if (scaleMode == SDL_SCALEMODE_NEAREST) {
-        if (!(src->internal->map.info.flags & complex_copy_flags) &&
+        if (!(src->map.info.flags & complex_copy_flags) &&
             src->format == dst->format &&
             !SDL_ISPIXELFORMAT_INDEXED(src->format)) {
             return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
@@ -1270,7 +1269,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
             return SDL_BlitSurfaceUnchecked(src, srcrect, dst, dstrect);
         }
     } else {
-        if (!(src->internal->map.info.flags & complex_copy_flags) &&
+        if (!(src->map.info.flags & complex_copy_flags) &&
             src->format == dst->format &&
             !SDL_ISPIXELFORMAT_INDEXED(src->format) &&
             SDL_BYTESPERPIXEL(src->format) == 4 &&
@@ -1291,7 +1290,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
             SDL_Surface *tmp1 = NULL;
             bool result;
             SDL_Rect srcrect2;
-            int is_complex_copy_flags = (src->internal->map.info.flags & complex_copy_flags);
+            int is_complex_copy_flags = (src->map.info.flags & complex_copy_flags);
 
             Uint8 r, g, b;
             Uint8 alpha;
@@ -1399,7 +1398,7 @@ bool SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface
 
     // clip the destination rectangle against the clip rectangle
     {
-        if (SDL_GetRectIntersection(&r_dst, &dst->internal->clip_rect, &r_dst) == false) {
+        if (SDL_GetRectIntersection(&r_dst, &dst->clip_rect, &r_dst) == false) {
             return true;
         }
 
@@ -1407,9 +1406,9 @@ bool SDL_BlitSurfaceTiled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface
     }
 
     // Switch back to a fast blit if we were previously stretching
-    if (src->internal->map.info.flags & SDL_COPY_NEAREST) {
-        src->internal->map.info.flags &= ~SDL_COPY_NEAREST;
-        SDL_InvalidateMap(&src->internal->map);
+    if (src->map.info.flags & SDL_COPY_NEAREST) {
+        src->map.info.flags &= ~SDL_COPY_NEAREST;
+        SDL_InvalidateMap(&src->map);
     }
 
     int rows = r_dst.h / r_src.h;
@@ -1508,7 +1507,7 @@ bool SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, fl
 
     // clip the destination rectangle against the clip rectangle
     {
-        if (SDL_GetRectIntersection(&r_dst, &dst->internal->clip_rect, &r_dst) == false) {
+        if (SDL_GetRectIntersection(&r_dst, &dst->clip_rect, &r_dst) == false) {
             return true;
         }
 
@@ -1516,9 +1515,9 @@ bool SDL_BlitSurfaceTiledWithScale(SDL_Surface *src, const SDL_Rect *srcrect, fl
     }
 
     // Switch back to a fast blit if we were previously stretching
-    if (src->internal->map.info.flags & SDL_COPY_NEAREST) {
-        src->internal->map.info.flags &= ~SDL_COPY_NEAREST;
-        SDL_InvalidateMap(&src->internal->map);
+    if (src->map.info.flags & SDL_COPY_NEAREST) {
+        src->map.info.flags &= ~SDL_COPY_NEAREST;
+        SDL_InvalidateMap(&src->map);
     }
 
     int tile_width = (int)(r_src.w * scale);
@@ -1722,18 +1721,18 @@ bool SDL_LockSurface(SDL_Surface *surface)
         return SDL_InvalidParamError("surface");
     }
 
-    if (!surface->internal->locked) {
+    if (!surface->locked) {
 #if SDL_HAVE_RLE
         // Perform the lock
-        if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
+        if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
             SDL_UnRLESurface(surface, true);
-            surface->internal->flags |= SDL_INTERNAL_SURFACE_RLEACCEL; // save accel'd state
+            surface->internal_flags |= SDL_INTERNAL_SURFACE_RLEACCEL; // save accel'd state
         }
 #endif
     }
 
     // Increment the surface lock count, for recursive locks
-    ++surface->internal->locked;
+    ++surface->locked;
     surface->flags |= SDL_SURFACE_LOCKED;
 
     // Ready to go..
@@ -1750,14 +1749,14 @@ void SDL_UnlockSurface(SDL_Surface *surface)
     }
 
     // Only perform an unlock if we are locked
-    if (!surface->internal->locked || (--surface->internal->locked > 0)) {
+    if (!surface->locked || (--surface->locked > 0)) {
         return;
     }
 
 #if SDL_HAVE_RLE
     // Update RLE encoded surface with new data
-    if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
-        surface->internal->flags &= ~SDL_INTERNAL_SURFACE_RLEACCEL; // stop lying
+    if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
+        surface->internal_flags &= ~SDL_INTERNAL_SURFACE_RLEACCEL; // stop lying
         SDL_RLESurface(surface);
     }
 #endif
@@ -1892,8 +1891,8 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
         }
     }
 
-    src_colorspace = surface->internal->colorspace;
-    src_properties = surface->internal->props;
+    src_colorspace = surface->colorspace;
+    src_properties = surface->props;
 
     // Create a new surface with the desired format
     convert = SDL_CreateSurface(surface->w, surface->h, format);
@@ -1915,23 +1914,23 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
         }
 
         // Save the original copy flags
-        copy_flags = surface->internal->map.info.flags;
+        copy_flags = surface->map.info.flags;
 
         goto end;
     }
 
     // Save the original copy flags
-    copy_flags = surface->internal->map.info.flags;
-    copy_color.r = surface->internal->map.info.r;
-    copy_color.g = surface->internal->map.info.g;
-    copy_color.b = surface->internal->map.info.b;
-    copy_color.a = surface->internal->map.info.a;
-    surface->internal->map.info.r = 0xFF;
-    surface->internal->map.info.g = 0xFF;
-    surface->internal->map.info.b = 0xFF;
-    surface->internal->map.info.a = 0xFF;
-    surface->internal->map.info.flags = (copy_flags & (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY));
-    SDL_InvalidateMap(&surface->internal->map);
+    copy_flags = surface->map.info.flags;
+    copy_color.r = surface->map.info.r;
+    copy_color.g = surface->map.info.g;
+    copy_color.b = surface->map.info.b;
+    copy_color.a = surface->map.info.a;
+    surface->map.info.r = 0xFF;
+    surface->map.info.g = 0xFF;
+    surface->map.info.b = 0xFF;
+    surface->map.info.a = 0xFF;
+    surface->map.info.flags = (copy_flags & (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY));
+    SDL_InvalidateMap(&surface->map);
 
     // Copy over the image data
     bounds.x = 0;
@@ -1942,11 +1941,11 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
     /* Source surface has a palette with no real alpha (0 or OPAQUE).
      * Destination format has alpha.
      * -> set alpha channel to be opaque */
-    if (surface->internal->palette && SDL_ISPIXELFORMAT_ALPHA(format)) {
+    if (surface->palette && SDL_ISPIXELFORMAT_ALPHA(format)) {
         bool set_opaque = false;
 
         bool is_opaque, has_alpha_channel;
-        SDL_DetectPalette(surface->internal->palette, &is_opaque, &has_alpha_channel);
+        SDL_DetectPalette(surface->palette, &is_opaque, &has_alpha_channel);
 
         if (is_opaque) {
             if (!has_alpha_channel) {
@@ -1957,12 +1956,12 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
         // Set opaque and backup palette alpha values
         if (set_opaque) {
             int i;
-            palette_saved_alpha_ncolors = surface->internal->palette->ncolors;
+            palette_saved_alpha_ncolors = surface->palette->ncolors;
             if (palette_saved_alpha_ncolors > 0) {
                 palette_saved_alpha = SDL_stack_alloc(Uint8, palette_saved_alpha_ncolors);
                 for (i = 0; i < palette_saved_alpha_ncolors; i++) {
-                    palette_saved_alpha[i] = surface->internal->palette->colors[i].a;
-                    surface->internal->palette->colors[i].a = SDL_ALPHA_OPAQUE;
+                    palette_saved_alpha[i] = surface->palette->colors[i].a;
+                    surface->palette->colors[i].a = SDL_ALPHA_OPAQUE;
                 }
             }
         }
@@ -1970,10 +1969,10 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
 
     // Transform colorkey to alpha. for cases where source palette has duplicate values, and colorkey is one of them
     if (copy_flags & SDL_COPY_COLORKEY) {
-        if (surface->internal->palette && !palette) {
+        if (surface->palette && !palette) {
             palette_ck_transform = true;
-            palette_ck_value = surface->internal->palette->colors[surface->internal->map.info.colorkey].a;
-            surface->internal->palette->colors[surface->internal->map.info.colorkey].a = SDL_ALPHA_TRANSPARENT;
+            palette_ck_value = surface->palette->colors[surface->map.info.colorkey].a;
+            surface->palette->colors[surface->map.info.colorkey].a = SDL_ALPHA_TRANSPARENT;
         }
     }
 
@@ -1981,33 +1980,33 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
 
     // Restore colorkey alpha value
     if (palette_ck_transform) {
-        surface->internal->palette->colors[surface->internal->map.info.colorkey].a = palette_ck_value;
+        surface->palette->colors[surface->map.info.colorkey].a = palette_ck_value;
     }
 
     // Restore palette alpha values
     if (palette_saved_alpha) {
         int i;
         for (i = 0; i < palette_saved_alpha_ncolors; i++) {
-            surface->internal->palette->colors[i].a = palette_saved_alpha[i];
+            surface->palette->colors[i].a = palette_saved_alpha[i];
         }
         SDL_stack_free(palette_saved_alpha);
     }
 
     // Clean up the original surface, and update converted surface
-    convert->internal->map.info.r = copy_color.r;
-    convert->internal->map.info.g = copy_color.g;
-    convert->internal->map.info.b = copy_color.b;
-    convert->internal->map.info.a = copy_color.a;
-    convert->internal->map.info.flags =
+    convert->map.info.r = copy_color.r;
+    convert->map.info.g = copy_color.g;
+    convert->map.info.b = copy_color.b;
+    convert->map.info.a = copy_color.a;
+    convert->map.info.flags =
         (copy_flags &
          ~(SDL_COPY_COLORKEY | SDL_COPY_BLEND | SDL_COPY_RLE_DESIRED | SDL_COPY_RLE_COLORKEY |
            SDL_COPY_RLE_ALPHAKEY));
-    surface->internal->map.info.r = copy_color.r;
-    surface->internal->map.info.g = copy_color.g;
-    surface->internal->map.info.b = copy_color.b;
-    surface->internal->map.info.a = copy_color.a;
-    surface->internal->map.info.flags = copy_flags;
-    SDL_InvalidateMap(&surface->internal->map);
+    surface->map.info.r = copy_color.r;
+    surface->map.info.g = copy_color.g;
+    surface->map.info.b = copy_color.b;
+    surface->map.info.a = copy_color.a;
+    surface->map.info.flags = copy_flags;
+    SDL_InvalidateMap(&surface->map);
 
     // SDL_BlitSurfaceUnchecked failed, and so the conversion
     if (!result) {
@@ -2018,13 +2017,13 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
         bool set_colorkey_by_color = false;
         bool convert_colorkey = true;
 
-        if (surface->internal->palette) {
+        if (surface->palette) {
             if (palette &&
-                surface->internal->palette->ncolors <= palette->ncolors &&
-                (SDL_memcmp(surface->internal->palette->colors, palette->colors,
-                            surface->internal->palette->ncolors * sizeof(SDL_Color)) == 0)) {
+                surface->palette->ncolors <= palette->ncolors &&
+                (SDL_memcmp(surface->palette->colors, palette->colors,
+                            surface->palette->ncolors * sizeof(SDL_Color)) == 0)) {
                 // The palette is identical, just set the same colorkey
-                SDL_SetSurfaceColorKey(convert, true, surface->internal->map.info.colorkey);
+                SDL_SetSurfaceColorKey(convert, true, surface->map.info.colorkey);
             } else if (!palette) {
                 if (SDL_ISPIXELFORMAT_ALPHA(format)) {
                     // No need to add the colorkey, transparency is in the alpha channel
@@ -2052,13 +2051,13 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
             }
 
             // Share the palette, if any
-            if (surface->internal->palette) {
-                SDL_SetSurfacePalette(tmp, surface->internal->palette);
+            if (surface->palette) {
+                SDL_SetSurfacePalette(tmp, surface->palette);
             }
 
-            SDL_FillSurfaceRect(tmp, NULL, surface->internal->map.info.colorkey);
+            SDL_FillSurfaceRect(tmp, NULL, surface->map.info.colorkey);
 
-            tmp->internal->map.info.flags &= ~SDL_COPY_COLORKEY;
+            tmp->map.info.flags &= ~SDL_COPY_COLORKEY;
 
             // Conversion of the colorkey
             tmp2 = SDL_ConvertSurfaceAndColorspace(tmp, format, palette, colorspace, props);
@@ -2068,7 +2067,7 @@ SDL_Surface *SDL_ConvertSurfaceAndColorspace(SDL_Surface *surface, SDL_PixelForm
             }
 
             // Get the converted colorkey
-            SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->internal->format->bytes_per_pixel);
+            SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->fmt->bytes_per_pixel);
 
             SDL_DestroySurface(tmp);
             SDL_DestroySurface(tmp2);
@@ -2088,7 +2087,7 @@ end:
         SDL_DestroyPalette(temp_palette);
     }
 
-    SDL_SetSurfaceClipRect(convert, &surface->internal->clip_rect);
+    SDL_SetSurfaceClipRect(convert, &surface->clip_rect);
 
     /* Enable alpha blending by default if the new surface has an
      * alpha channel or alpha modulation */
@@ -2101,8 +2100,8 @@ end:
     }
 
     // Copy alternate images
-    for (int i = 0; i < surface->internal->num_images; ++i) {
-        if (!SDL_AddSurfaceAlternateImage(convert, surface->internal->images[i])) {
+    for (int i = 0; i < surface->num_images; ++i) {
+        if (!SDL_AddSurfaceAlternateImage(convert, surface->images[i])) {
             goto error;
         }
     }
@@ -2127,7 +2126,7 @@ SDL_Surface *SDL_DuplicateSurface(SDL_Surface *surface)
         return NULL;
     }
 
-    return SDL_ConvertSurfaceAndColorspace(surface, surface->format, surface->internal->palette, surface->internal->colorspace, surface->internal->props);
+    return SDL_ConvertSurfaceAndColorspace(surface, surface->format, surface->palette, surface->colorspace, surface->props);
 }
 
 SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_ScaleMode scaleMode)
@@ -2156,7 +2155,7 @@ SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_S
         }
         tmp = scaled;
 
-        SDL_Surface *result = SDL_ConvertSurfaceAndColorspace(tmp, surface->format, NULL, surface->internal->colorspace, surface->internal->props);
+        SDL_Surface *result = SDL_ConvertSurfaceAndColorspace(tmp, surface->format, NULL, surface->colorspace, surface->props);
         SDL_DestroySurface(tmp);
         return result;
     }
@@ -2166,36 +2165,36 @@ SDL_Surface *SDL_ScaleSurface(SDL_Surface *surface, int width, int height, SDL_S
     if (!convert) {
         goto error;
     }
-    SDL_SetSurfacePalette(convert, surface->internal->palette);
-    SDL_SetSurfaceColorspace(convert, surface->internal->colorspace);
+    SDL_SetSurfacePalette(convert, surface->palette);
+    SDL_SetSurfaceColorspace(convert, surface->colorspace);
 
     // Save the original copy flags
-    copy_flags = surface->internal->map.info.flags;
-    copy_color.r = surface->internal->map.info.r;
-    copy_color.g = surface->internal->map.info.g;
-    copy_color.b = surface->internal->map.info.b;
-    copy_color.a = surface->internal->map.info.a;
-    surface->internal->map.info.r = 0xFF;
-    surface->internal->map.info.g = 0xFF;
-    surface->internal->map.info.b = 0xFF;
-    surface->internal->map.info.a = 0xFF;
-    surface->internal->map.info.flags = (copy_flags & (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY));
-    SDL_InvalidateMap(&surface->internal->map);
+    copy_flags = surface->map.info.flags;
+    copy_color.r = surface->map.info.r;
+    copy_color.g = surface->map.info.g;
+    copy_color.b = surface->map.info.b;
+    copy_color.a = surface->map.info.a;
+    surface->map.info.r = 0xFF;
+    surface->map.info.g = 0xFF;
+    surface->map.info.b = 0xFF;
+    surface->map.info.a = 0xFF;
+    surface->map.info.flags = (copy_flags & (SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY));
+    SDL_InvalidateMap(&surface->map);
 
     rc = SDL_BlitSurfaceScaled(surface, NULL, convert, NULL, scaleMode);
 
     // Clean up the original surface, and update converted surface
-    convert->internal->map.info.r = copy_color.r;
-    convert->internal->map.info.g = copy_color.g;
-    convert->internal->map.info.b = copy_color.b;
-    convert->internal->map.info.a = copy_color.a;
-    convert->internal->map.info.flags = (copy_flags & ~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY));
-    surface->internal->map.info.r = copy_color.r;
-    surface->internal->map.info.g = copy_color.g;
-    surface->internal->map.info.b = copy_color.b;
-    surface->internal->map.info.a = copy_color.a;
-    surface->internal->map.info.flags = copy_flags;
-    SDL_InvalidateMap(&surface->internal->map);
+    convert->map.info.r = copy_color.r;
+    convert->map.info.g = copy_color.g;
+    convert->map.info.b = copy_color.b;
+    convert->map.info.a = copy_color.a;
+    convert->map.info.flags = (copy_flags & ~(SDL_COPY_RLE_COLORKEY | SDL_COPY_RLE_ALPHAKEY));
+    surface->map.info.r = copy_color.r;
+    surface->map.info.g = copy_color.g;
+    surface->map.info.b = copy_color.b;
+    surface->map.info.a = copy_color.a;
+    surface->map.info.flags = copy_flags;
+    SDL_InvalidateMap(&surface->map);
 
     // SDL_BlitSurfaceScaled failed, and so the conversion
     if (!rc) {
@@ -2219,7 +2218,7 @@ SDL_Surface *SDL_ConvertSurface(SDL_Surface *surface, SDL_PixelFormat format)
         return NULL;
     }
 
-    return SDL_ConvertSurfaceAndColorspace(surface, format, NULL, SDL_GetDefaultColorspaceForFormat(format), surface->internal->props);
+    return SDL_ConvertSurfaceAndColorspace(surface, format, NULL, SDL_GetDefaultColorspaceForFormat(format), surface->props);
 }
 
 SDL_Surface *SDL_DuplicatePixels(int width, int height, SDL_PixelFormat format, SDL_Colorspace colorspace, void *pixels, int pitch)
@@ -2245,9 +2244,8 @@ bool SDL_ConvertPixelsAndColorspace(int width, int height,
                       SDL_PixelFormat src_format, SDL_Colorspace src_colorspace, SDL_PropertiesID src_properties, const void *src, int src_pitch,
                       SDL_PixelFormat dst_format, SDL_Colorspace dst_colorspace, SDL_PropertiesID dst_properties, void *dst, int dst_pitch)
 {
-    SDL_InternalSurface src_data, dst_data;
-    SDL_Surface *src_surface;
-    SDL_Surface *dst_surface;
+    SDL_Surface src_surface;
+    SDL_Surface dst_surface;
     SDL_Rect rect;
     void *nonconst_src = (void *)src;
     bool result;
@@ -2299,14 +2297,12 @@ bool SDL_ConvertPixelsAndColorspace(int width, int height,
         return true;
     }
 
-    src_surface = SDL_InitializeSurface(&src_data, width, height, src_format, src_colorspace, src_properties, nonconst_src, src_pitch, true);
-    if (!src_surface) {
+    if (!SDL_InitializeSurface(&src_surface, width, height, src_format, src_colorspace, src_properties, nonconst_src, src_pitch, true)) {
         return false;
     }
-    SDL_SetSurfaceBlendMode(src_surface, SDL_BLENDMODE_NONE);
+    SDL_SetSurfaceBlendMode(&src_surface, SDL_BLENDMODE_NONE);
 
-    dst_surface = SDL_InitializeSurface(&dst_data, width, height, dst_format, dst_colorspace, dst_properties, dst, dst_pitch, true);
-    if (!dst_surface) {
+    if (!SDL_InitializeSurface(&dst_surface, width, height, dst_format, dst_colorspace, dst_properties, dst, dst_pitch, true)) {
         return false;
     }
 
@@ -2315,10 +2311,10 @@ bool SDL_ConvertPixelsAndColorspace(int width, int height,
     rect.y = 0;
     rect.w = width;
     rect.h = height;
-    result = SDL_BlitSurfaceUnchecked(src_surface, &rect, dst_surface, &rect);
+    result = SDL_BlitSurfaceUnchecked(&src_surface, &rect, &dst_surface, &rect);
 
-    SDL_DestroySurface(src_surface);
-    SDL_DestroySurface(dst_surface);
+    SDL_DestroySurface(&src_surface);
+    SDL_DestroySurface(&dst_surface);
 
     return result;
 }
@@ -2550,9 +2546,9 @@ bool SDL_PremultiplySurfaceAlpha(SDL_Surface *surface, bool linear)
         return SDL_InvalidParamError("surface");
     }
 
-    colorspace = surface->internal->colorspace;
+    colorspace = surface->colorspace;
 
-    return SDL_PremultiplyAlphaPixelsAndColorspace(surface->w, surface->h, surface->format, colorspace, surface->internal->props, surface->pixels, surface->pitch, surface->format, colorspace, surface->internal->props, surface->pixels, surface->pitch, linear);
+    return SDL_PremultiplyAlphaPixelsAndColorspace(surface->w, surface->h, surface->format, colorspace, surface->props, surface->pixels, surface->pitch, surface->format, colorspace, surface->props, surface->pixels, surface->pitch, linear);
 }
 
 bool SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a)
@@ -2585,7 +2581,7 @@ bool SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a)
         }
 
         if (SDL_ClearSurface(tmp, r, g, b, a)) {
-            result = SDL_ConvertPixelsAndColorspace(surface->w, surface->h, tmp->format, tmp->internal->colorspace, tmp->internal->props, tmp->pixels, tmp->pitch, surface->format, surface->internal->colorspace, surface->internal->props, surface->pixels, surface->pitch);
+            result = SDL_ConvertPixelsAndColorspace(surface->w, surface->h, tmp->format, tmp->colorspace, tmp->props, tmp->pixels, tmp->pitch, surface->format, surface->colorspace, surface->props, surface->pixels, surface->pitch);
         }
         SDL_DestroySurface(tmp);
     } else {
@@ -2594,7 +2590,7 @@ bool SDL_ClearSurface(SDL_Surface *surface, float r, float g, float b, float a)
         if (!tmp) {
             goto done;
         }
-        SDL_SetSurfaceColorspace(tmp, surface->internal->colorspace);
+        SDL_SetSurfaceColorspace(tmp, surface->colorspace);
 
         float *pixels = (float *)tmp->pixels;
         pixels[0] = r;
@@ -2623,7 +2619,7 @@ Uint32 SDL_MapSurfaceRGBA(SDL_Surface *surface, Uint8 r, Uint8 g, Uint8 b, Uint8
         SDL_InvalidParamError("surface");
         return true;
     }
-    return SDL_MapRGBA(surface->internal->format, surface->internal->palette, r, g, b, a);
+    return SDL_MapRGBA(surface->fmt, surface->palette, r, g, b, a);
 }
 
 // This function Copyright 2023 Collabora Ltd., contributed to SDL under the ZLib license
@@ -2689,7 +2685,7 @@ bool SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g
 #else
         SDL_memcpy(&pixel, p, bytes_per_pixel);
 #endif
-        SDL_GetRGBA(pixel, surface->internal->format, surface->internal->palette, r, g, b, a);
+        SDL_GetRGBA(pixel, surface->fmt, surface->palette, r, g, b, a);
         result = true;
     } else if (SDL_ISPIXELFORMAT_FOURCC(surface->format)) {
         // FIXME: We need code to extract a single macroblock from a YUV surface
@@ -2702,7 +2698,7 @@ bool SDL_ReadSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 *r, Uint8 *g
         // This is really slow, but it gets the job done
         Uint8 rgba[4];
 
-        if (SDL_ConvertPixelsAndColorspace(1, 1, surface->format, surface->internal->colorspace, surface->internal->props, p, surface->pitch, SDL_PIXELFORMAT_RGBA32, SDL_COLORSPACE_SRGB, 0, rgba, sizeof(rgba))) {
+        if (SDL_ConvertPixelsAndColorspace(1, 1, surface->format, surface->colorspace, surface->props, p, surface->pitch, SDL_PIXELFORMAT_RGBA32, SDL_COLORSPACE_SRGB, 0, rgba, sizeof(rgba))) {
             *r = rgba[0];
             *g = rgba[1];
             *b = rgba[2];
@@ -2792,10 +2788,10 @@ bool SDL_ReadSurfacePixelFloat(SDL_Surface *surface, int x, int y, float *r, flo
             SDL_memcpy(rgba, p, sizeof(rgba));
             result = true;
         } else {
-            SDL_Colorspace src_colorspace = surface->internal->colorspace;
+            SDL_Colorspace src_colorspace = surface->colorspace;
             SDL_Colorspace dst_colorspace = (src_colorspace == SDL_COLORSPACE_SRGB_LINEAR ? SDL_COLORSPACE_SRGB_LINEAR : SDL_COLORSPACE_SRGB);
 
-            if (SDL_ConvertPixelsAndColorspace(1, 1, surface->format, src_colorspace, surface->internal->props, p, surface->pitch, SDL_PIXELFORMAT_RGBA128_FLOAT, dst_colorspace, 0, rgba, sizeof(rgba))) {
+            if (SDL_ConvertPixelsAndColorspace(1, 1, surface->format, src_colorspace, surface->props, p, surface->pitch, SDL_PIXELFORMAT_RGBA128_FLOAT, dst_colorspace, 0, rgba, sizeof(rgba))) {
                 result = true;
             }
         }
@@ -2844,7 +2840,7 @@ bool SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g,
     p = (Uint8 *)surface->pixels + y * surface->pitch + x * bytes_per_pixel;
 
     if (bytes_per_pixel <= sizeof(pixel) && !SDL_ISPIXELFORMAT_FOURCC(surface->format)) {
-        pixel = SDL_MapRGBA(surface->internal->format, surface->internal->palette, r, g, b, a);
+        pixel = SDL_MapRGBA(surface->fmt, surface->palette, r, g, b, a);
 #if SDL_BYTEORDER == SDL_BIG_ENDIAN
         SDL_memcpy(p, ((Uint8 *)&pixel) + (sizeof(pixel) - bytes_per_pixel), bytes_per_pixel);
 #else
@@ -2861,7 +2857,7 @@ bool SDL_WriteSurfacePixel(SDL_Surface *surface, int x, int y, Uint8 r, Uint8 g,
         rgba[1] = g;
         rgba[2] = b;
         rgba[3] = a;
-        result = SDL_ConvertPixelsAndColorspace(1, 1, SDL_PIXELFORMAT_RGBA32, SDL_COLORSPACE_SRGB, 0, rgba, sizeof(rgba), surface->format, surface->internal->colorspace, surface->internal->props, p, surface->pitch);
+        result = SDL_ConvertPixelsAndColorspace(1, 1, SDL_PIXELFORMAT_RGBA32, SDL_COLORSPACE_SRGB, 0, rgba, sizeof(rgba), surface->format, surface->colorspace, surface->props, p, surface->pitch);
     }
 
     if (SDL_MUSTLOCK(surface)) {
@@ -2920,10 +2916,10 @@ bool SDL_WriteSurfacePixelFloat(SDL_Surface *surface, int x, int y, float r, flo
             SDL_memcpy(p, rgba, sizeof(rgba));
             result = true;
         } else {
-            SDL_Colorspace dst_colorspace = surface->internal->colorspace;
+            SDL_Colorspace dst_colorspace = surface->colorspace;
             SDL_Colorspace src_colorspace = (dst_colorspace == SDL_COLORSPACE_SRGB_LINEAR ? SDL_COLORSPACE_SRGB_LINEAR : SDL_COLORSPACE_SRGB);
 
-            result = SDL_ConvertPixelsAndColorspace(1, 1, SDL_PIXELFORMAT_RGBA128_FLOAT, src_colorspace, 0, rgba, sizeof(rgba), surface->format, dst_colorspace, surface->internal->props, p, surface->pitch);
+            result = SDL_ConvertPixelsAndColorspace(1, 1, SDL_PIXELFORMAT_RGBA128_FLOAT, src_colorspace, 0, rgba, sizeof(rgba), surface->format, dst_colorspace, surface->props, p, surface->pitch);
         }
 
         if (SDL_MUSTLOCK(surface)) {
@@ -2941,7 +2937,7 @@ void SDL_DestroySurface(SDL_Surface *surface)
     if (!SDL_SurfaceValid(surface)) {
         return;
     }
-    if (surface->internal->flags & SDL_INTERNAL_SURFACE_DONTFREE) {
+    if (surface->internal_flags & SDL_INTERNAL_SURFACE_DONTFREE) {
         return;
     }
     if (--surface->refcount > 0) {
@@ -2950,15 +2946,15 @@ void SDL_DestroySurface(SDL_Surface *surface)
 
     SDL_RemoveSurfaceAlternateImages(surface);
 
-    SDL_DestroyProperties(surface->internal->props);
+    SDL_DestroyProperties(surface->props);
 
-    SDL_InvalidateMap(&surface->internal->map);
+    SDL_InvalidateMap(&surface->map);
 
-    while (surface->internal->locked > 0) {
+    while (surface->locked > 0) {
         SDL_UnlockSurface(surface);
     }
 #if SDL_HAVE_RLE
-    if (surface->internal->flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
+    if (surface->internal_flags & SDL_INTERNAL_SURFACE_RLEACCEL) {
         SDL_UnRLESurface(surface, false);
     }
 #endif
@@ -2973,7 +2969,10 @@ void SDL_DestroySurface(SDL_Surface *surface)
         // Normal
         SDL_free(surface->pixels);
     }
-    if (!(surface->internal->flags & SDL_INTERNAL_SURFACE_STACK)) {
+
+    surface->reserved = NULL;
+
+    if (!(surface->internal_flags & SDL_INTERNAL_SURFACE_STACK)) {
         SDL_free(surface);
     }
 }

+ 18 - 11
src/video/SDL_surface_c.h

@@ -25,7 +25,7 @@
 
 // Useful functions and variables from SDL_surface.c
 
-#include "../SDL_list.h"
+#include "SDL_blit.h"
 
 // Surface internal flags
 typedef Uint32 SDL_SurfaceDataFlags;
@@ -35,16 +35,30 @@ typedef Uint32 SDL_SurfaceDataFlags;
 #define SDL_INTERNAL_SURFACE_RLEACCEL   0x00000004u /**< Surface is RLE encoded */
 
 // Surface internal data definition
-struct SDL_SurfaceData
+struct SDL_Surface
 {
+    // Public API definition
+    SDL_SurfaceFlags flags;     /**< The flags of the surface, read-only */
+    SDL_PixelFormat format;     /**< The format of the surface, read-only */
+    int w;                      /**< The width of the surface, read-only. */
+    int h;                      /**< The height of the surface, read-only. */
+    int pitch;                  /**< The distance in bytes between rows of pixels, read-only */
+    void *pixels;               /**< A pointer to the pixels of the surface, the pixels are writeable if non-NULL */
+
+    int refcount;               /**< Application reference count, used when freeing surface */
+
+    void *reserved;             /**< Reserved for internal use */
+
+    // Private API definition
+
     /** flags for this surface */
-    SDL_SurfaceDataFlags flags;
+    SDL_SurfaceDataFlags internal_flags;
 
     /** properties for this surface */
     SDL_PropertiesID props;
 
     /** detailed format for this surface */
-    const SDL_PixelFormatDetails *format;
+    const SDL_PixelFormatDetails *fmt;
 
     /** Pixel colorspace */
     SDL_Colorspace colorspace;
@@ -66,13 +80,6 @@ struct SDL_SurfaceData
     SDL_BlitMap map;
 };
 
-typedef struct SDL_InternalSurface
-{
-    SDL_Surface surface;
-    SDL_SurfaceData internal;
-
-} SDL_InternalSurface;
-
 // Surface functions
 extern bool SDL_SurfaceValid(SDL_Surface *surface);
 extern void SDL_UpdateSurfaceLockFlag(SDL_Surface *surface);

+ 2 - 0
src/video/SDL_sysvideo.h

@@ -25,6 +25,8 @@
 
 #include <SDL3/SDL_vulkan.h>
 
+#include "SDL_surface_c.h"
+
 // The SDL video driver
 
 typedef struct SDL_VideoDisplay SDL_VideoDisplay;

+ 4 - 4
src/video/SDL_video.c

@@ -25,7 +25,7 @@
 
 #include "SDL_sysvideo.h"
 #include "SDL_egl_c.h"
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 #include "SDL_pixels_c.h"
 #include "SDL_rect_c.h"
 #include "SDL_video_c.h"
@@ -3414,7 +3414,7 @@ SDL_Surface *SDL_GetWindowSurface(SDL_Window *window)
 
     if (!window->surface_valid) {
         if (window->surface) {
-            window->surface->internal->flags &= ~SDL_INTERNAL_SURFACE_DONTFREE;
+            window->surface->internal_flags &= ~SDL_INTERNAL_SURFACE_DONTFREE;
             SDL_DestroySurface(window->surface);
             window->surface = NULL;
         }
@@ -3422,7 +3422,7 @@ SDL_Surface *SDL_GetWindowSurface(SDL_Window *window)
         window->surface = SDL_CreateWindowFramebuffer(window);
         if (window->surface) {
             window->surface_valid = true;
-            window->surface->internal->flags |= SDL_INTERNAL_SURFACE_DONTFREE;
+            window->surface->internal_flags |= SDL_INTERNAL_SURFACE_DONTFREE;
         }
     }
     return window->surface;
@@ -3480,7 +3480,7 @@ bool SDL_DestroyWindowSurface(SDL_Window *window)
     CHECK_WINDOW_MAGIC(window, false);
 
     if (window->surface) {
-        window->surface->internal->flags &= ~SDL_INTERNAL_SURFACE_DONTFREE;
+        window->surface->internal_flags &= ~SDL_INTERNAL_SURFACE_DONTFREE;
         SDL_DestroySurface(window->surface);
         window->surface = NULL;
         window->surface_valid = false;

+ 1 - 1
src/video/sdlgenblit.pl

@@ -112,7 +112,7 @@ sub open_file {
   3. This notice may not be removed or altered from any source distribution.
 */
 #include "SDL_internal.h"
-#include "SDL_blit.h"
+#include "SDL_surface_c.h"
 
 #if SDL_HAVE_BLIT_AUTO
 

+ 0 - 1
src/video/windows/SDL_windowsmouse.c

@@ -27,7 +27,6 @@
 #include "SDL_windowsrawinput.h"
 
 #include "../SDL_video_c.h"
-#include "../SDL_blit.h"
 #include "../../events/SDL_mouse_c.h"
 #include "../../joystick/usb_ids.h"
 

+ 0 - 2
src/video/windows/SDL_windowsshape.c

@@ -25,8 +25,6 @@
 #include "SDL_windowsvideo.h"
 #include "SDL_windowsshape.h"
 
-#include "../SDL_blit.h"
-
 
 static void AddRegion(HRGN *mask, int x1, int y1, int x2, int y2)
 {

+ 0 - 2
src/video/x11/SDL_x11shape.c

@@ -25,8 +25,6 @@
 #include "SDL_x11video.h"
 #include "SDL_x11shape.h"
 
-#include "../SDL_blit.h"
-
 
 #ifdef SDL_VIDEO_DRIVER_X11_XSHAPE
 static Uint8 *GenerateShapeMask(SDL_Surface *shape)