mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Remove depth field from surface_t
This commit is contained in:
@@ -11,11 +11,9 @@
|
||||
|
||||
static surface_t *create(int width, int height, bool has_pixel, bool has_alpha) {
|
||||
surface_t *s = calloc(1, sizeof(surface_t));
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->depth = 24;
|
||||
|
||||
|
||||
if (has_pixel) {
|
||||
s->sdl_surface = SDL_CreateRGBSurfaceWithFormat(0, width, height, 32, SDL_PIXELFORMAT_RGB888);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ static void gre_BlendUseAMap(surface_t *dst, int dx, int dy, surface_t *src, int
|
||||
uint8_t *dp = GETOFFSET_PIXEL(dst, dx, dy);
|
||||
uint8_t *ap = GETOFFSET_ALPHA(src, sx, sy);
|
||||
|
||||
switch(dst->depth) {
|
||||
switch (dst->sdl_surface->format->BitsPerPixel) {
|
||||
case 16:
|
||||
for (int y = 0; y < height; y++) {
|
||||
uint16_t *yls = (uint16_t *)(sp + y * src->sdl_surface->pitch);
|
||||
|
||||
@@ -61,12 +61,11 @@ typedef enum {
|
||||
} ALPHA_DIB_COPY_TYPE;
|
||||
|
||||
struct agsurface {
|
||||
int width; /* width of surface */
|
||||
int height; /* height of surface */
|
||||
int depth; /* depth of surface, 8/16/24/32 is available */
|
||||
int width;
|
||||
int height;
|
||||
|
||||
SDL_Surface *sdl_surface; /* pixel data (can be NULL) */
|
||||
uint8_t *alpha; /* alpha pixel data (can be NULL) */
|
||||
SDL_Surface *sdl_surface; // pixel data (can be NULL)
|
||||
uint8_t *alpha; // alpha data (can be NULL)
|
||||
};
|
||||
typedef struct agsurface surface_t;
|
||||
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ void sdl_drawImage16(cgdata *cg, surface_t *sf, int dx, int dy, int brightness,
|
||||
*dst++ = rgb565_to_rgb888(*p_src++) | *a_src++ << 24;
|
||||
}
|
||||
}
|
||||
} else if (sf->depth > 16) {
|
||||
} else if (sf->sdl_surface->format->BitsPerPixel > 16) {
|
||||
// Convert to RGB888 by ourselves. SDL blit functions use a slightly
|
||||
// different mapping, so the color expanded by SDL may not match the
|
||||
// color key specified in the CX command.
|
||||
|
||||
+1
-2
@@ -191,13 +191,12 @@ static void makeDIB(int width, int height, int depth) {
|
||||
}
|
||||
|
||||
sdl_dibinfo = calloc(1, sizeof(surface_t));
|
||||
sdl_dibinfo->depth = main_surface->format->BitsPerPixel;
|
||||
sdl_dibinfo->width = width;
|
||||
sdl_dibinfo->height = height;
|
||||
sdl_dibinfo->alpha = NULL;
|
||||
sdl_dibinfo->sdl_surface = main_surface;
|
||||
|
||||
image_setdepth(sdl_dibinfo->depth);
|
||||
image_setdepth(main_surface->format->BitsPerPixel);
|
||||
}
|
||||
|
||||
/* offscreen の設定 */
|
||||
|
||||
Reference in New Issue
Block a user