Simplified internal SDL_Surface structure

This commit is contained in:
Sam Lantinga
2024-09-30 22:15:38 -07:00
parent 1f3a0d12e6
commit 3234a3b902
52 changed files with 514 additions and 519 deletions

View File

@@ -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.

View File

@@ -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"

View File

@@ -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);

View File

@@ -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"

View File

@@ -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

View File

@@ -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_

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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"

View File

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

View File

@@ -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

View File

@@ -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"

View File

@@ -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

View File

@@ -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++

View File

@@ -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)

View File

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

View File

@@ -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"

View File

@@ -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);

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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--) { \

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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;

View File

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

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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_

View File

@@ -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];

View File

@@ -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];
}

View File

@@ -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 !

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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) ||

View File

@@ -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;

View File

@@ -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;
SDL_BlitMap *map = &src->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)) {
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;
}

View File

@@ -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 {

File diff suppressed because it is too large Load Diff

View File

@@ -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);

View File

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

View File

@@ -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;

View File

@@ -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

View File

@@ -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"

View File

@@ -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)
{

View File

@@ -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)