(svn r23775) -Change: Hide the PCX screenshot format from the options window, if a 32bpp blitter is used.

This commit is contained in:
frosch 2012-01-08 16:58:10 +00:00
parent ed46420ca0
commit 45df862fb0
3 changed files with 17 additions and 3 deletions

View File

@ -63,6 +63,7 @@ struct ScreenshotFormat {
const char *name; ///< Name of the format. const char *name; ///< Name of the format.
const char *extension; ///< File extension. const char *extension; ///< File extension.
ScreenshotHandlerProc *proc; ///< Function for writing the screenshot. ScreenshotHandlerProc *proc; ///< Function for writing the screenshot.
bool supports_32bpp; ///< Does this format support 32bpp images?
}; };
/************************************************* /*************************************************
@ -568,10 +569,10 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user
/** Available screenshot formats. */ /** Available screenshot formats. */
static const ScreenshotFormat _screenshot_formats[] = { static const ScreenshotFormat _screenshot_formats[] = {
#if defined(WITH_PNG) #if defined(WITH_PNG)
{"PNG", "png", &MakePNGImage}, {"PNG", "png", &MakePNGImage, true},
#endif #endif
{"BMP", "bmp", &MakeBMPImage}, {"BMP", "bmp", &MakeBMPImage, true},
{"PCX", "pcx", &MakePCXImage}, {"PCX", "pcx", &MakePCXImage, false},
}; };
/** Get filename extension of current screenshot file format. */ /** Get filename extension of current screenshot file format. */
@ -604,6 +605,16 @@ const char *GetScreenshotFormatDesc(int i)
return _screenshot_formats[i].name; return _screenshot_formats[i].name;
} }
/**
* Determine whether a certain screenshot format support 32bpp images.
* @param i Number of the screenshot format.
* @return true if 32bpp is supported.
*/
bool GetScreenshotFormatSupports_32bpp(int i)
{
return _screenshot_formats[i].supports_32bpp;
}
/** /**
* Set the screenshot format to use. * Set the screenshot format to use.
* @param i Number of the format. * @param i Number of the format.

View File

@ -15,6 +15,7 @@
void InitializeScreenshotFormats(); void InitializeScreenshotFormats();
const char *GetScreenshotFormatDesc(int i); const char *GetScreenshotFormatDesc(int i);
bool GetScreenshotFormatSupports_32bpp(int i);
void SetScreenshotFormat(uint i); void SetScreenshotFormat(uint i);
const char *GetCurrentScreenshotExtension(); const char *GetCurrentScreenshotExtension();

View File

@ -32,6 +32,7 @@
#include "viewport_func.h" #include "viewport_func.h"
#include "core/geometry_func.hpp" #include "core/geometry_func.hpp"
#include "ai/ai.hpp" #include "ai/ai.hpp"
#include "blitter/factory.hpp"
#include "language.h" #include "language.h"
@ -260,6 +261,7 @@ struct GameOptionsWindow : Window {
list = new DropDownList(); list = new DropDownList();
*selected_index = _cur_screenshot_format; *selected_index = _cur_screenshot_format;
for (uint i = 0; i < _num_screenshot_formats; i++) { for (uint i = 0; i < _num_screenshot_formats; i++) {
if (!GetScreenshotFormatSupports_32bpp(i) && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) continue;
list->push_back(new DropDownListStringItem(SPECSTR_SCREENSHOT_START + i, i, false)); list->push_back(new DropDownListStringItem(SPECSTR_SCREENSHOT_START + i, i, false));
} }
break; break;