10#ifndef BLITTER_FACTORY_HPP
11#define BLITTER_FACTORY_HPP
15#include "../string_func.h"
26 typedef std::map<std::string, BlitterFactory *>
Blitters;
44 static Blitter *s_blitter =
nullptr;
63 assert(blitters.find(this->name) == blitters.end());
69 blitters.insert(Blitters::value_type(this->name,
this));
71 Debug(driver, 1,
"Not registering blitter {} as it is not usable",
name);
99 if (b ==
nullptr)
return nullptr;
105 Debug(driver, 1,
"Successfully {} blitter '{}'",
name.empty() ?
"probed" :
"loaded", newb->
GetName());
116#if defined(DEDICATED)
117 const std::string_view default_blitter =
"null";
118#elif defined(WITH_COCOA)
119 const std::string_view default_blitter =
"32bpp-anim";
121 const std::string_view default_blitter =
"8bpp-optimized";
124 const std::string_view bname =
name.empty() ? default_blitter :
name;
151 fmt::format_to(output_iterator,
"List of blitters:\n");
156 fmt::format_to(output_iterator,
"\n");
The base factory, keeping track of all blitters.
static Blitter ** GetActiveBlitter()
Get the currently active blitter.
BlitterFactory(const char *name, const char *description, bool usable=true)
Construct the blitter, and register it.
std::string_view GetName() const
Get the long, human readable, name for the Blitter-class.
static BlitterFactory * GetBlitterFactory(const std::string_view name)
Get the blitter factory with the given name.
virtual bool IsUsable() const
Is the blitter usable with the current drivers and hardware config?
const std::string description
The description of the blitter.
std::map< std::string, BlitterFactory * > Blitters
Map of blitter factories.
static Blitter * GetCurrentBlitter()
Get the current active blitter (always set by calling SelectBlitter).
static Blitters & GetBlitters()
Get the map with currently known blitters.
static void GetBlittersInfo(std::back_insert_iterator< std::string > &output_iterator)
Fill a buffer with information about the blitters.
const std::string name
The name of the blitter factory.
static Blitter * SelectBlitter(const std::string_view name)
Find the requested blitter and return its class.
virtual Blitter * CreateInstance()=0
Create an instance of this Blitter-class.
std::string_view GetDescription() const
Get a nice description of the blitter-class.
How all blitters should look like.
virtual std::string_view GetName()=0
Get the name of the blitter, the same as the Factory-instance returns.
#define Debug(category, level, format_string,...)
Ouptut a line of debugging information.
bool _blitter_autodetected
Was the blitter autodetected or specified by the user?
std::string _ini_blitter
The blitter as stored in the configuration file.
bool StrEqualsIgnoreCase(const std::string_view str1, const std::string_view str2)
Compares two string( view)s for equality, while ignoring the case of the characters.