Go to the documentation of this file.
10 #ifndef BLITTER_FACTORY_HPP
11 #define BLITTER_FACTORY_HPP
15 #include "../string_func.h"
16 #include "../core/string_compare_type.hpp"
28 typedef std::map<std::string, BlitterFactory *>
Blitters;
46 static Blitter *s_blitter =
nullptr;
65 assert(blitters.find(this->name) == blitters.end());
71 blitters.insert(Blitters::value_type(this->name,
this));
73 DEBUG(driver, 1,
"Not registering blitter %s as it is not usable",
name);
101 if (b ==
nullptr)
return nullptr;
107 DEBUG(driver, 1,
"Successfully %s blitter '%s'",
name.empty() ?
"probed" :
"loaded", newb->
GetName());
118 #if defined(DEDICATED)
119 const char *default_blitter =
"null";
120 #elif defined(WITH_COCOA)
121 const char *default_blitter =
"32bpp-anim";
123 const char *default_blitter =
"8bpp-optimized";
126 const char *bname =
name.empty() ? default_blitter :
name.c_str();
131 if (strcasecmp(bname, b->
name.c_str()) == 0) {
154 p +=
seprintf(p, last,
"List of blitters:\n");
virtual Blitter * CreateInstance()=0
Create an instance of this Blitter-class.
static Blitters & GetBlitters()
Get the map with currently known blitters.
How all blitters should look like.
const std::string & GetDescription() const
Get a nice description of the blitter-class.
The base factory, keeping track of all blitters.
static Blitter * SelectBlitter(const std::string &name)
Find the requested blitter and return his class.
#define DEBUG(name, level,...)
Output a line of debugging information.
static Blitter ** GetActiveBlitter()
Get the currently active blitter.
std::map< std::string, BlitterFactory * > Blitters
Map of blitter factories.
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
BlitterFactory(const char *name, const char *description, bool usable=true)
Construct the blitter, and register it.
virtual const char * GetName()=0
Get the name of the blitter, the same as the Factory-instance returns.
bool _blitter_autodetected
Was the blitter autodetected or specified by the user?
std::string _ini_blitter
The blitter as stored in the configuration file.
const std::string description
The description of the blitter.
static BlitterFactory * GetBlitterFactory(const std::string &name)
Get the blitter factory with the given name.
virtual bool IsUsable() const
Is the blitter usable with the current drivers and hardware config?
int CDECL seprintf(char *str, const char *last, const char *format,...)
Safer implementation of snprintf; same as snprintf except:
const std::string & GetName() const
Get the long, human readable, name for the Blitter-class.
const std::string name
The name of the blitter factory.
static char * GetBlittersInfo(char *p, const char *last)
Fill a buffer with information about the blitters.