diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/blitter/factory.hpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp index 83edd99aa..cda470510 100644 --- a/src/blitter/factory.hpp +++ b/src/blitter/factory.hpp @@ -95,6 +95,24 @@ public: */ static Blitter *SelectBlitter(const char *name) { + BlitterFactory *b = GetBlitterFactory(name); + if (b == NULL) return NULL; + + Blitter *newb = b->CreateInstance(); + delete *GetActiveBlitter(); + *GetActiveBlitter() = newb; + + DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", newb->GetName()); + return newb; + } + + /** + * Get the blitter factory with the given name. + * @param name the blitter factory to select. + * @return The blitter factory, or NULL when there isn't one with the wanted name. + */ + static BlitterFactory *GetBlitterFactory(const char *name) + { #if defined(DEDICATED) const char *default_blitter = "null"; #else @@ -117,12 +135,7 @@ public: for (; it != GetBlitters().end(); it++) { BlitterFactory *b = (*it).second; if (strcasecmp(bname, b->name) == 0) { - Blitter *newb = b->CreateInstance(); - delete *GetActiveBlitter(); - *GetActiveBlitter() = newb; - - DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", bname); - return newb; + return b; } } return NULL; |