bHighQual jpeg parameter

This commit is contained in:
Glenn Maynard
2004-03-23 22:31:46 +00:00
parent e639ef21a0
commit 1acc77a16f
2 changed files with 8 additions and 3 deletions
+7 -2
View File
@@ -110,7 +110,7 @@ static void jpeg_SDL_RW_dest(jpeg::j_compress_ptr cinfo, SDL_RWops *ctx)
}
/* Save a JPEG to a file. cjpeg.c and example.c from jpeglib were helpful in writing this. */
void IMG_SaveJPG_RW( SDL_Surface *surface, SDL_RWops *dest )
void IMG_SaveJPG_RW( SDL_Surface *surface, SDL_RWops *dest, bool bHighQual )
{
SDL_Surface *dst_surface;
if( ConvertSDLSurface( surface, dst_surface,
@@ -157,7 +157,12 @@ void IMG_SaveJPG_RW( SDL_Surface *surface, SDL_RWops *dest )
* since the defaults depend on the source color space.)
*/
jpeg::jpeg_set_defaults(&cinfo);
jpeg::jpeg_set_quality( &cinfo, 150, TRUE );
if( bHighQual )
{
jpeg::jpeg_set_quality( &cinfo, 150, TRUE );
} else {
jpeg::jpeg_set_quality( &cinfo, 50, TRUE );
}
/* Step 4: Start compressor */
+1 -1
View File
@@ -1,6 +1,6 @@
#ifndef SDL_SAVE_JPEG_H
#define SDL_SAVE_JPEG_H
void IMG_SaveJPG_RW( SDL_Surface *surface, SDL_RWops *dest );
void IMG_SaveJPG_RW( SDL_Surface *surface, SDL_RWops *dest, bool bHighQual=true );
#endif