|
|
@ -70,10 +70,13 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint * |
|
|
|
width, height); |
|
|
|
width, height); |
|
|
|
|
|
|
|
|
|
|
|
// fallback
|
|
|
|
// fallback
|
|
|
|
if( !sw.tex ) |
|
|
|
if( !sw.tex && format != SDL_PIXELFORMAT_RGBA8888 ) |
|
|
|
sw.tex = SDL_CreateTexture(sw.renderer, format = SDL_PIXELFORMAT_RGBA8888, |
|
|
|
{ |
|
|
|
|
|
|
|
format = SDL_PIXELFORMAT_RGBA8888; |
|
|
|
|
|
|
|
sw.tex = SDL_CreateTexture(sw.renderer, format, |
|
|
|
SDL_TEXTUREACCESS_STREAMING, |
|
|
|
SDL_TEXTUREACCESS_STREAMING, |
|
|
|
width, height); |
|
|
|
width, height); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if( !sw.tex ) |
|
|
|
if( !sw.tex ) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -133,8 +136,10 @@ qboolean SW_CreateBuffer( int width, int height, uint *stride, uint *bpp, uint * |
|
|
|
Sys_Error(SDL_GetError()); |
|
|
|
Sys_Error(SDL_GetError()); |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// we can't create ref_soft buffer
|
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void *SW_LockBuffer() |
|
|
|
void *SW_LockBuffer() |
|
|
@ -177,18 +182,13 @@ void *SW_LockBuffer() |
|
|
|
|
|
|
|
|
|
|
|
void SW_UnlockBuffer() |
|
|
|
void SW_UnlockBuffer() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if( sw.renderer ) |
|
|
|
if( sw.renderer ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_Rect src, dst; |
|
|
|
SDL_Rect src, dst; |
|
|
|
src.x = 0; |
|
|
|
src.x = src.y = 0; |
|
|
|
src.y = 0; |
|
|
|
|
|
|
|
src.w = sw.width; |
|
|
|
src.w = sw.width; |
|
|
|
src.h = sw.height; |
|
|
|
src.h = sw.height; |
|
|
|
dst.x = 0; |
|
|
|
dst = src; |
|
|
|
dst.y = 0; |
|
|
|
|
|
|
|
dst.w = sw.width; |
|
|
|
|
|
|
|
dst.h = sw.height; |
|
|
|
|
|
|
|
SDL_UnlockTexture(sw.tex); |
|
|
|
SDL_UnlockTexture(sw.tex); |
|
|
|
|
|
|
|
|
|
|
|
SDL_SetTextureBlendMode(sw.tex, SDL_BLENDMODE_NONE); |
|
|
|
SDL_SetTextureBlendMode(sw.tex, SDL_BLENDMODE_NONE); |
|
|
@ -204,14 +204,10 @@ void SW_UnlockBuffer() |
|
|
|
if( sw.surf ) |
|
|
|
if( sw.surf ) |
|
|
|
{ |
|
|
|
{ |
|
|
|
SDL_Rect src, dst; |
|
|
|
SDL_Rect src, dst; |
|
|
|
src.x = 0; |
|
|
|
src.x = src.y = 0; |
|
|
|
src.y = 0; |
|
|
|
|
|
|
|
src.w = sw.width; |
|
|
|
src.w = sw.width; |
|
|
|
src.h = sw.height; |
|
|
|
src.h = sw.height; |
|
|
|
dst.x = 0; |
|
|
|
dst = src; |
|
|
|
dst.y = 0; |
|
|
|
|
|
|
|
dst.w = sw.width; |
|
|
|
|
|
|
|
dst.h = sw.height; |
|
|
|
|
|
|
|
SDL_UnlockSurface( sw.surf ); |
|
|
|
SDL_UnlockSurface( sw.surf ); |
|
|
|
SDL_BlitSurface( sw.surf, &src, sw.win, &dst ); |
|
|
|
SDL_BlitSurface( sw.surf, &src, sw.win, &dst ); |
|
|
|
} |
|
|
|
} |
|
|
|