Fix SDL_surface refcount test and initialise refcount to 1
This commit is contained in:
Родитель
f7a5c31270
Коммит
da350fac54
|
@ -275,6 +275,8 @@ var LibrarySDL = {
|
|||
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*5', '0', 'buffer', 'void*') }}} // SDL_Surface.pixels
|
||||
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*6', '0', '0', 'i32*') }}} // SDL_Surface.offset
|
||||
|
||||
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*14', '0', '1', 'i32') }}}
|
||||
|
||||
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.format', '0', '-2042224636', 'i32') }}} // SDL_PIXELFORMAT_RGBA8888
|
||||
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.palette', '0', '0', 'i32') }}} // TODO
|
||||
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BitsPerPixel', '0', 'bpp * 8', 'i8') }}}
|
||||
|
|
|
@ -13173,7 +13173,7 @@ Press any key to continue.'''
|
|||
self.btest('sdl_alloctext.c', expected='1', args=['-O2', '-s', 'TOTAL_MEMORY=' + str(1024*1024*8)])
|
||||
|
||||
def test_sdl_surface_refcount(self):
|
||||
self.btest('sdl_surface_refcount.c', expected='1')
|
||||
self.btest('sdl_surface_refcount.c', expected='0')
|
||||
|
||||
def test_glbegin_points(self):
|
||||
shutil.copyfile(path_from_root('tests', 'screenshot.png'), os.path.join(self.get_dir(), 'screenshot.png'))
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
#include <SDL.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SDL_Init(SDL_INIT_VIDEO);
|
||||
SDL_Surface *screen = SDL_SetVideoMode(640, 480, 32, SDL_SWSURFACE);
|
||||
SDL_Surface *reference = screen;
|
||||
SDL_Surface* surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 10, 10, 32,
|
||||
0, 0, 0, 0);
|
||||
SDL_Surface *reference = surface;
|
||||
reference->refcount++;
|
||||
SDL_FreeSurface(screen);
|
||||
SDL_FreeSurface(surface);
|
||||
SDL_FreeSurface(reference);
|
||||
int result = 1;
|
||||
int result = surface->refcount;
|
||||
REPORT_RESULT();
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче