Refactor NightDemonDemo and tDemo to use SDL_Surface

This commit is contained in:
kichikuou
2025-02-19 13:21:17 +09:00
parent cf5e899632
commit 6665416683
2 changed files with 6 additions and 4 deletions
+3 -2
View File
@@ -34,7 +34,6 @@
#include "music.h"
#include "sdl_core.h"
#include "input.h"
#include "ngraph.h"
#include "cg.h"
#include "jpeg.h"
@@ -61,8 +60,10 @@ static void ndd_run(int demonum) {
cgdata *cg = jpeg_extract(alk->entries[i].data, alk->entries[i].size);
if (cg) {
gr_drawimage24(sf0, cg, 0, 0);
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 24, cg->width * 3, SDL_PIXELFORMAT_RGB24);
SDL_BlitSurface(sf, NULL, main_surface, NULL);
ags_updateFull();
SDL_FreeSurface(sf);
cgdata_free(cg);
} else {
WARNING("Cannot decode CG %d in %s", i, alk_path);
+3 -2
View File
@@ -31,7 +31,6 @@
#include "input.h"
#include "bgm.h"
#include "sdl_core.h"
#include "ngraph.h"
#include "cg.h"
#include "jpeg.h"
@@ -81,8 +80,10 @@ static void Run() {
cgdata *cg = jpeg_extract(alk->entries[i].data, alk->entries[i].size);
if (cg) {
gr_drawimage24(sf0, cg, 0, 0);
SDL_Surface *sf = SDL_CreateRGBSurfaceWithFormatFrom(cg->pic, cg->width, cg->height, 24, cg->width * 3, SDL_PIXELFORMAT_RGB24);
SDL_BlitSurface(sf, NULL, main_surface, NULL);
ags_updateFull();
SDL_FreeSurface(sf);
cgdata_free(cg);
} else {
WARNING("Cannot decode CG %d", i);