summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/blitter/32bpp_anim.hpp5
-rw-r--r--src/blitter/32bpp_optimized.hpp5
-rw-r--r--src/blitter/32bpp_simple.hpp5
-rw-r--r--src/blitter/8bpp_optimized.hpp5
-rw-r--r--src/blitter/8bpp_simple.hpp5
-rw-r--r--src/blitter/factory.hpp66
-rw-r--r--src/blitter/null.hpp5
-rw-r--r--src/bootstrap_gui.cpp2
-rw-r--r--src/crashlog.cpp2
-rw-r--r--src/fontcache.cpp6
-rw-r--r--src/gfx.cpp18
-rw-r--r--src/gfxinit.cpp8
-rw-r--r--src/network/network_chat_gui.cpp6
-rw-r--r--src/openttd.cpp6
-rw-r--r--src/os/macosx/splash.cpp2
-rw-r--r--src/screenshot.cpp6
-rw-r--r--src/settings_gui.cpp2
-rw-r--r--src/smallmap_gui.cpp2
-rw-r--r--src/spritecache.cpp6
-rw-r--r--src/video/allegro_v.cpp6
-rw-r--r--src/video/cocoa/cocoa_v.mm8
-rw-r--r--src/video/cocoa/event.mm2
-rw-r--r--src/video/dedicated_v.cpp4
-rw-r--r--src/video/null_v.cpp2
-rw-r--r--src/video/sdl_v.cpp6
-rw-r--r--src/video/win32_v.cpp14
-rw-r--r--src/viewport.cpp4
-rw-r--r--src/window.cpp4
28 files changed, 100 insertions, 112 deletions
diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp
index b0582e6ce..db5d614a0 100644
--- a/src/blitter/32bpp_anim.hpp
+++ b/src/blitter/32bpp_anim.hpp
@@ -56,10 +56,9 @@ public:
};
/** Factory for the 32bpp blitter with animation. */
-class FBlitter_32bppAnim : public BlitterFactory<FBlitter_32bppAnim> {
+class FBlitter_32bppAnim : public BlitterFactory {
public:
- /* virtual */ const char *GetName() { return "32bpp-anim"; }
- /* virtual */ const char *GetDescription() { return "32bpp Animation Blitter (palette animation)"; }
+ FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
};
diff --git a/src/blitter/32bpp_optimized.hpp b/src/blitter/32bpp_optimized.hpp
index f290f6cf6..c261aa33d 100644
--- a/src/blitter/32bpp_optimized.hpp
+++ b/src/blitter/32bpp_optimized.hpp
@@ -32,10 +32,9 @@ public:
};
/** Factory for the optimised 32 bpp blitter (without palette animation). */
-class FBlitter_32bppOptimized : public BlitterFactory<FBlitter_32bppOptimized> {
+class FBlitter_32bppOptimized : public BlitterFactory {
public:
- /* virtual */ const char *GetName() { return "32bpp-optimized"; }
- /* virtual */ const char *GetDescription() { return "32bpp Optimized Blitter (no palette animation)"; }
+ FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppOptimized(); }
};
diff --git a/src/blitter/32bpp_simple.hpp b/src/blitter/32bpp_simple.hpp
index 49eaab56d..0751f6f75 100644
--- a/src/blitter/32bpp_simple.hpp
+++ b/src/blitter/32bpp_simple.hpp
@@ -34,10 +34,9 @@ public:
};
/** Factory for the simple 32 bpp blitter. */
-class FBlitter_32bppSimple : public BlitterFactory<FBlitter_32bppSimple> {
+class FBlitter_32bppSimple : public BlitterFactory {
public:
- /* virtual */ const char *GetName() { return "32bpp-simple"; }
- /* virtual */ const char *GetDescription() { return "32bpp Simple Blitter (no palette animation)"; }
+ FBlitter_32bppSimple() : BlitterFactory("32bpp-simple", "32bpp Simple Blitter (no palette animation)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
};
diff --git a/src/blitter/8bpp_optimized.hpp b/src/blitter/8bpp_optimized.hpp
index 320e2b829..b5b5324b9 100644
--- a/src/blitter/8bpp_optimized.hpp
+++ b/src/blitter/8bpp_optimized.hpp
@@ -31,10 +31,9 @@ public:
};
/** Factory for the 8bpp blitter optimised for speed. */
-class FBlitter_8bppOptimized : public BlitterFactory<FBlitter_8bppOptimized> {
+class FBlitter_8bppOptimized : public BlitterFactory {
public:
- /* virtual */ const char *GetName() { return "8bpp-optimized"; }
- /* virtual */ const char *GetDescription() { return "8bpp Optimized Blitter (compression + all-ZoomLevel cache)"; }
+ FBlitter_8bppOptimized() : BlitterFactory("8bpp-optimized", "8bpp Optimized Blitter (compression + all-ZoomLevel cache)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppOptimized(); }
};
diff --git a/src/blitter/8bpp_simple.hpp b/src/blitter/8bpp_simple.hpp
index 28b33a280..c00c75ac0 100644
--- a/src/blitter/8bpp_simple.hpp
+++ b/src/blitter/8bpp_simple.hpp
@@ -25,10 +25,9 @@ public:
};
/** Factory for the most trivial 8bpp blitter. */
-class FBlitter_8bppSimple : public BlitterFactory<FBlitter_8bppSimple> {
+class FBlitter_8bppSimple : public BlitterFactory {
public:
- /* virtual */ const char *GetName() { return "8bpp-simple"; }
- /* virtual */ const char *GetDescription() { return "8bpp Simple Blitter (relative slow, but never wrong)"; }
+ FBlitter_8bppSimple() : BlitterFactory("8bpp-simple", "8bpp Simple Blitter (relative slow, but never wrong)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppSimple(); }
};
diff --git a/src/blitter/factory.hpp b/src/blitter/factory.hpp
index eb8d0ce85..7fe498a67 100644
--- a/src/blitter/factory.hpp
+++ b/src/blitter/factory.hpp
@@ -25,11 +25,12 @@ bool QZ_CanDisplay8bpp();
/**
* The base factory, keeping track of all blitters.
*/
-class BlitterFactoryBase {
+class BlitterFactory {
private:
- const char *name; ///< The name of the blitter factory.
+ const char *name; ///< The name of the blitter factory.
+ const char *description; ///< The description of the blitter.
- typedef std::map<const char *, BlitterFactoryBase *, StringCompare> Blitters; ///< Map of blitter factories.
+ typedef std::map<const char *, BlitterFactory *, StringCompare> Blitters; ///< Map of blitter factories.
/**
* Get the map with currently known blitters.
@@ -53,32 +54,28 @@ private:
protected:
/**
- * Register a blitter internally, based on his name.
- * @param name the name of the blitter.
- * @note an assert() will be trigger if 2 blitters with the same name try to register.
+ * Construct the blitter, and register it.
+ * @param name The name of the blitter.
+ * @param description A longer description for the blitter.
+ * @pre name != NULL.
+ * @pre description != NULL.
+ * @pre There is no blitter registered with this name.
*/
- void RegisterBlitter(const char *name)
+ BlitterFactory(const char *name, const char *description) :
+ name(strdup(name)), description(strdup(description))
{
- /* Don't register nameless Blitters */
- if (name == NULL) return;
-
- this->name = strdup(name);
-
- std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(name, this));
+ std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(this->name, this));
assert(P.second);
}
public:
- BlitterFactoryBase() :
- name(NULL)
- {}
-
- virtual ~BlitterFactoryBase()
+ virtual ~BlitterFactory()
{
- if (this->name == NULL) return;
GetBlitters().erase(this->name);
if (GetBlitters().empty()) delete &GetBlitters();
+
free(this->name);
+ free(this->description);
}
/**
@@ -108,7 +105,7 @@ public:
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
- BlitterFactoryBase *b = (*it).second;
+ BlitterFactory *b = (*it).second;
if (strcasecmp(bname, b->name) == 0) {
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
@@ -140,7 +137,7 @@ public:
p += seprintf(p, last, "List of blitters:\n");
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
- BlitterFactoryBase *b = (*it).second;
+ BlitterFactory *b = (*it).second;
p += seprintf(p, last, "%18s: %s\n", b->name, b->GetDescription());
}
p += seprintf(p, last, "\n");
@@ -149,28 +146,25 @@ public:
}
/**
- * Get a nice description of the blitter-class.
+ * Get the long, human readable, name for the Blitter-class.
*/
- virtual const char *GetDescription() = 0;
+ const char *GetName() const
+ {
+ return this->name;
+ }
/**
- * Create an instance of this Blitter-class.
+ * Get a nice description of the blitter-class.
*/
- virtual Blitter *CreateInstance() = 0;
-};
-
-/**
- * A template factory, so ->GetName() works correctly. This because else some compiler will complain.
- */
-template <class T>
-class BlitterFactory : public BlitterFactoryBase {
-public:
- BlitterFactory() { this->RegisterBlitter(((T *)this)->GetName()); }
+ const char *GetDescription() const
+ {
+ return this->description;
+ }
/**
- * Get the long, human readable, name for the Blitter-class.
+ * Create an instance of this Blitter-class.
*/
- const char *GetName();
+ virtual Blitter *CreateInstance() = 0;
};
extern char *_ini_blitter;
diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp
index f703cbd67..a6fed2ebc 100644
--- a/src/blitter/null.hpp
+++ b/src/blitter/null.hpp
@@ -38,10 +38,9 @@ public:
};
/** Factory for the blitter that does nothing. */
-class FBlitter_Null : public BlitterFactory<FBlitter_Null> {
+class FBlitter_Null : public BlitterFactory {
public:
- /* virtual */ const char *GetName() { return "null"; }
- /* virtual */ const char *GetDescription() { return "Null Blitter (does nothing)"; }
+ FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_Null(); }
};
diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp
index 31b99730f..c2b76f0b1 100644
--- a/src/bootstrap_gui.cpp
+++ b/src/bootstrap_gui.cpp
@@ -215,7 +215,7 @@ bool HandleBootstrap()
if (BaseGraphics::GetUsedSet() != NULL) return true;
/* No user interface, bail out with an error. */
- if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
+ if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
/* If there is no network or no freetype, then there is nothing we can do. Go straight to failure. */
#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(WIN32) || defined(__APPLE__))
diff --git a/src/crashlog.cpp b/src/crashlog.cpp
index ef8c70dd1..986736bb3 100644
--- a/src/crashlog.cpp
+++ b/src/crashlog.cpp
@@ -134,7 +134,7 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
" Sound driver: %s\n"
" Sound set: %s (%u)\n"
" Video driver: %s\n\n",
- BlitterFactoryBase::GetCurrentBlitter() == NULL ? "none" : BlitterFactoryBase::GetCurrentBlitter()->GetName(),
+ BlitterFactory::GetCurrentBlitter() == NULL ? "none" : BlitterFactory::GetCurrentBlitter()->GetName(),
BaseGraphics::GetUsedSet() == NULL ? "none" : BaseGraphics::GetUsedSet()->name,
BaseGraphics::GetUsedSet() == NULL ? UINT32_MAX : BaseGraphics::GetUsedSet()->version,
_current_language == NULL ? "none" : _current_language->file,
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 37f949c87..50fbe0d6a 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -439,7 +439,7 @@ static void *AllocateFont(size_t size)
static bool GetFontAAState(FontSize size)
{
/* AA is only supported for 32 bpp */
- if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
+ if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
switch (size) {
default: NOT_REACHED();
@@ -494,7 +494,7 @@ const Sprite *FreeTypeFontCache::GetGlyph(GlyphID key)
builtin_questionmark_data
};
- Sprite *spr = BlitterFactoryBase::GetCurrentBlitter()->Encode(&builtin_questionmark, AllocateFont);
+ Sprite *spr = BlitterFactory::GetCurrentBlitter()->Encode(&builtin_questionmark, AllocateFont);
assert(spr != NULL);
new_glyph.sprite = spr;
new_glyph.width = spr->width + (this->fs != FS_NORMAL);
@@ -551,7 +551,7 @@ const Sprite *FreeTypeFontCache::GetGlyph(GlyphID key)
}
}
- new_glyph.sprite = BlitterFactoryBase::GetCurrentBlitter()->Encode(&sprite, AllocateFont);
+ new_glyph.sprite = BlitterFactory::GetCurrentBlitter()->Encode(&sprite, AllocateFont);
new_glyph.width = slot->advance.x >> 6;
this->SetGlyphPtr(key, &new_glyph);
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 7f488699b..a6ab37a23 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -73,7 +73,7 @@ extern uint _dirty_block_colour;
void GfxScroll(int left, int top, int width, int height, int xo, int yo)
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
if (xo == 0 && yo == 0) return;
@@ -105,7 +105,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo)
*/
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *dpi = _cur_dpi;
void *dst;
const int otop = top;
@@ -166,7 +166,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectM
*/
static inline void GfxDoDrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash = 0)
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
assert(width > 0);
@@ -929,7 +929,7 @@ static void GfxBlitter(const Sprite * const sprite, int x, int y, BlitterMode mo
/* We do not want to catch the mouse. However we also use that spritenumber for unknown (text) sprites. */
if (_newgrf_debug_sprite_picker.mode == SPM_REDRAW && sprite_id != SPR_CURSOR_MOUSE) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
void *topleft = blitter->MoveTo(bp.dst, bp.left, bp.top);
void *bottomright = blitter->MoveTo(topleft, bp.width - 1, bp.height - 1);
@@ -943,7 +943,7 @@ static void GfxBlitter(const Sprite * const sprite, int x, int y, BlitterMode mo
}
}
- BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, zoom);
+ BlitterFactory::GetCurrentBlitter()->Draw(&bp, mode, zoom);
}
static void GfxMainBlitterViewport(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub, SpriteID sprite_id)
@@ -973,7 +973,7 @@ void DoPaletteAnimations()
static int palette_animation_counter = 0;
palette_animation_counter += 8;
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const Colour *s;
const ExtraPaletteValues *ev = &_extra_palette_values;
Colour old_val[PALETTE_ANIM_SIZE];
@@ -1173,7 +1173,7 @@ void UndrawMouseCursor()
if (_screen.dst_ptr == NULL) return;
if (_cursor.visible) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
_cursor.visible = false;
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, _cursor.draw_pos.x, _cursor.draw_pos.y), _cursor_backup.GetBuffer(), _cursor.draw_size.x, _cursor.draw_size.y);
_video_driver->MakeDirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
@@ -1190,7 +1190,7 @@ void DrawMouseCursor()
/* Don't draw the mouse cursor if the screen is not ready */
if (_screen.dst_ptr == NULL) return;
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
int x;
int y;
int w;
@@ -1443,7 +1443,7 @@ void MarkWholeScreenDirty()
*/
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *o = _cur_dpi;
n->zoom = ZOOM_LVL_NORMAL;
diff --git a/src/gfxinit.cpp b/src/gfxinit.cpp
index 0ee82d05e..06326ab3f 100644
--- a/src/gfxinit.cpp
+++ b/src/gfxinit.cpp
@@ -239,12 +239,12 @@ static void SwitchNewGRFBlitter()
}
/* A GRF would like a 32 bpp blitter, switch blitter if needed. Never switch if the blitter was specified by the user. */
- if (_blitter_autodetected && is_32bpp && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() != 0 && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() < 16) {
- const char *cur_blitter = BlitterFactoryBase::GetCurrentBlitter()->GetName();
- if (BlitterFactoryBase::SelectBlitter("32bpp-anim") != NULL) {
+ if (_blitter_autodetected && is_32bpp && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 0 && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() < 16) {
+ const char *cur_blitter = BlitterFactory::GetCurrentBlitter()->GetName();
+ if (BlitterFactory::SelectBlitter("32bpp-anim") != NULL) {
if (!_video_driver->AfterBlitterChange()) {
/* Failed to switch blitter, let's hope we can return to the old one. */
- if (BlitterFactoryBase::SelectBlitter(cur_blitter) == NULL || !_video_driver->AfterBlitterChange()) usererror("Failed to reinitialize video driver for 32 bpp blitter. Specify a fixed blitter in the config");
+ if (BlitterFactory::SelectBlitter(cur_blitter) == NULL || !_video_driver->AfterBlitterChange()) usererror("Failed to reinitialize video driver for 32 bpp blitter. Specify a fixed blitter in the config");
}
}
}
diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp
index 5fa311ba1..8b965feff 100644
--- a/src/network/network_chat_gui.cpp
+++ b/src/network/network_chat_gui.cpp
@@ -108,7 +108,7 @@ void NetworkReInitChatBoxSize()
{
_chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL;
_chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + NETWORK_CHAT_LINE_SPACING) + 2;
- _chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactoryBase::GetCurrentBlitter()->GetBytesPerPixel());
+ _chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel());
}
/** Initialize all buffers of the chat visualisation. */
@@ -149,7 +149,7 @@ void NetworkUndrawChatMessage()
}
if (_chatmessage_visible) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
int x = _chatmsg_box.x;
int y = _screen.height - _chatmsg_box.y - _chatmsg_box.height;
int width = _chatmsg_box.width;
@@ -198,7 +198,7 @@ void NetworkChatMessageLoop()
/** Draw the chat message-box */
void NetworkDrawChatMessage()
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
if (!_chatmessage_dirty) return;
/* First undraw if needed */
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 2c76d9ba6..7a3f84eea 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -192,7 +192,7 @@ static void ShowHelp()
p = DriverFactoryBase::GetDriversInfo(p, lastof(buf));
/* List the blitters */
- p = BlitterFactoryBase::GetBlittersInfo(p, lastof(buf));
+ p = BlitterFactory::GetBlittersInfo(p, lastof(buf));
/* List the debug facilities. */
p = DumpDebugFacilityNames(p, lastof(buf));
@@ -756,8 +756,8 @@ int openttd_main(int argc, char *argv[])
if (blitter == NULL && _ini_blitter != NULL) blitter = strdup(_ini_blitter);
_blitter_autodetected = StrEmpty(blitter);
/* If we have a 32 bpp base set, try to select the 32 bpp blitter first, but only if we autoprobe the blitter. */
- if (!_blitter_autodetected || BaseGraphics::GetUsedSet() == NULL || BaseGraphics::GetUsedSet()->blitter == BLT_8BPP || BlitterFactoryBase::SelectBlitter("32bpp-anim") == NULL) {
- if (BlitterFactoryBase::SelectBlitter(blitter) == NULL) {
+ if (!_blitter_autodetected || BaseGraphics::GetUsedSet() == NULL || BaseGraphics::GetUsedSet()->blitter == BLT_8BPP || BlitterFactory::SelectBlitter("32bpp-anim") == NULL) {
+ if (BlitterFactory::SelectBlitter(blitter) == NULL) {
StrEmpty(blitter) ?
usererror("Failed to autoprobe blitter") :
usererror("Failed to select requested blitter '%s'; does it exist?", blitter);
diff --git a/src/os/macosx/splash.cpp b/src/os/macosx/splash.cpp
index 79bb0a022..bc1cd2dbf 100644
--- a/src/os/macosx/splash.cpp
+++ b/src/os/macosx/splash.cpp
@@ -122,7 +122,7 @@ void DisplaySplashImage()
uint xoff = (_screen.width - width) / 2;
uint yoff = (_screen.height - height) / 2;
- switch (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth()) {
+ switch (BlitterFactory::GetCurrentBlitter()->GetScreenDepth()) {
case 8: {
uint8 *dst_ptr = (uint8 *)_screen.dst_ptr;
/* Initialize buffer */
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 52500a756..6e72dd520 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -634,7 +634,7 @@ void SetScreenshotFormat(uint i)
*/
static void CurrentScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
void *src = blitter->MoveTo(_screen.dst_ptr, 0, y);
blitter->CopyImageToBuffer(src, buf, _screen.width, n, pitch);
}
@@ -740,7 +740,7 @@ static bool MakeSmallScreenshot(bool crashlog)
{
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
return sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension, crashlog), CurrentScreenCallback, NULL, _screen.width, _screen.height,
- BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth(), _cur_palette.palette);
+ BlitterFactory::GetCurrentBlitter()->GetScreenDepth(), _cur_palette.palette);
}
/**
@@ -796,7 +796,7 @@ static bool MakeLargeWorldScreenshot(ScreenshotType t)
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
return sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension), LargeWorldCallback, &vp, vp.width, vp.height,
- BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth(), _cur_palette.palette);
+ BlitterFactory::GetCurrentBlitter()->GetScreenDepth(), _cur_palette.palette);
}
/**
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index dbb7a8ae2..a103a05ca 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -276,7 +276,7 @@ struct GameOptionsWindow : Window {
list = new DropDownList();
*selected_index = _cur_screenshot_format;
for (uint i = 0; i < _num_screenshot_formats; i++) {
- if (!GetScreenshotFormatSupports_32bpp(i) && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) continue;
+ if (!GetScreenshotFormatSupports_32bpp(i) && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 32) continue;
*list->Append() = new DropDownListStringItem(SPECSTR_SCREENSHOT_START + i, i, false);
}
break;
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 99097c571..b1e3370a9 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -941,7 +941,7 @@ void SmallMapWindow::DrawMapIndicators() const
*/
void SmallMapWindow::DrawSmallMap(DrawPixelInfo *dpi) const
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
DrawPixelInfo *old_dpi;
old_dpi = _cur_dpi;
diff --git a/src/spritecache.cpp b/src/spritecache.cpp
index 6d514a8f6..49f2d7ff4 100644
--- a/src/spritecache.cpp
+++ b/src/spritecache.cpp
@@ -394,7 +394,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
sprite[ZOOM_LVL_NORMAL].type = sprite_type;
SpriteLoaderGrf sprite_loader(sc->container_ver);
- if (sprite_type != ST_MAPGEN && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 32) {
+ if (sprite_type != ST_MAPGEN && BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 32) {
/* Try for 32bpp sprites first. */
sprite_avail = sprite_loader.LoadSprite(sprite, file_slot, file_pos, sprite_type, true);
}
@@ -442,7 +442,7 @@ static void *ReadSprite(const SpriteCache *sc, SpriteID id, SpriteType sprite_ty
return (void*)GetRawSprite(SPR_IMG_QUERY, ST_NORMAL, allocator);
}
}
- return BlitterFactoryBase::GetCurrentBlitter()->Encode(sprite, allocator);
+ return BlitterFactory::GetCurrentBlitter()->Encode(sprite, allocator);
}
@@ -847,7 +847,7 @@ void *GetRawSprite(SpriteID sprite, SpriteType type, AllocatorProc *allocator)
static void GfxInitSpriteCache()
{
/* initialize sprite cache heap */
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
uint target_size = (bpp > 0 ? _sprite_cache_size * bpp / 8 : 1) * 1024 * 1024;
/* Remember 'target_size' from the previous allocation attempt, so we do not try to reach the target_size multiple times in case of failure. */
diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp
index 963353f0d..f844c6d0d 100644
--- a/src/video/allegro_v.cpp
+++ b/src/video/allegro_v.cpp
@@ -92,7 +92,7 @@ static void InitPalette()
static void CheckPaletteAnim()
{
if (_cur_palette.count_dirty != 0) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
switch (blitter->UsePaletteAnimation()) {
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
@@ -191,7 +191,7 @@ static void GetAvailableVideoMode(uint *w, uint *h)
static bool CreateMainSurface(uint w, uint h)
{
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
set_color_depth(bpp);
@@ -217,7 +217,7 @@ static bool CreateMainSurface(uint w, uint h)
_cursor.pos.x = mouse_x;
_cursor.pos.y = mouse_y;
- BlitterFactoryBase::GetCurrentBlitter()->PostResize();
+ BlitterFactory::GetCurrentBlitter()->PostResize();
InitPalette();
diff --git a/src/video/cocoa/cocoa_v.mm b/src/video/cocoa/cocoa_v.mm
index df2e7809c..4a95d1901 100644
--- a/src/video/cocoa/cocoa_v.mm
+++ b/src/video/cocoa/cocoa_v.mm
@@ -333,7 +333,7 @@ void QZ_GameSizeChanged()
_screen.dst_ptr = _cocoa_subdriver->GetPixelBuffer();
_fullscreen = _cocoa_subdriver->IsFullscreen();
- BlitterFactoryBase::GetCurrentBlitter()->PostResize();
+ BlitterFactory::GetCurrentBlitter()->PostResize();
GameSizeChanged();
}
@@ -461,7 +461,7 @@ const char *VideoDriver_Cocoa::Start(const char * const *parm)
int width = _cur_resolution.width;
int height = _cur_resolution.height;
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
_cocoa_subdriver = QZ_CreateSubdriver(width, height, bpp, _fullscreen, true);
if (_cocoa_subdriver == NULL) {
@@ -514,7 +514,7 @@ bool VideoDriver_Cocoa::ChangeResolution(int w, int h)
{
assert(_cocoa_subdriver != NULL);
- bool ret = _cocoa_subdriver->ChangeResolution(w, h, BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth());
+ bool ret = _cocoa_subdriver->ChangeResolution(w, h, BlitterFactory::GetCurrentBlitter()->GetScreenDepth());
QZ_GameSizeChanged();
QZ_UpdateVideoModes();
@@ -539,7 +539,7 @@ bool VideoDriver_Cocoa::ToggleFullscreen(bool full_screen)
if (full_screen != oldfs) {
int width = _cocoa_subdriver->GetWidth();
int height = _cocoa_subdriver->GetHeight();
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
delete _cocoa_subdriver;
_cocoa_subdriver = NULL;
diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm
index 4ebb899b5..b4f171a98 100644
--- a/src/video/cocoa/event.mm
+++ b/src/video/cocoa/event.mm
@@ -110,7 +110,7 @@ static void QZ_WarpCursor(int x, int y)
static void QZ_CheckPaletteAnim()
{
if (_cur_palette.count_dirty != 0) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
switch (blitter->UsePaletteAnimation()) {
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp
index 4dcfbbe05..8e5b9ea91 100644
--- a/src/video/dedicated_v.cpp
+++ b/src/video/dedicated_v.cpp
@@ -144,14 +144,14 @@ static FVideoDriver_Dedicated iFVideoDriver_Dedicated;
const char *VideoDriver_Dedicated::Start(const char * const *parm)
{
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
_dedicated_video_mem = (bpp == 0) ? NULL : MallocT<byte>(_cur_resolution.width * _cur_resolution.height * (bpp / 8));
_screen.width = _screen.pitch = _cur_resolution.width;
_screen.height = _cur_resolution.height;
_screen.dst_ptr = _dedicated_video_mem;
ScreenSizeChanged();
- BlitterFactoryBase::GetCurrentBlitter()->PostResize();
+ BlitterFactory::GetCurrentBlitter()->PostResize();
#if defined(WINCE)
/* WinCE doesn't support console stuff */
diff --git a/src/video/null_v.cpp b/src/video/null_v.cpp
index 6fdb87648..f2f7fc5ed 100644
--- a/src/video/null_v.cpp
+++ b/src/video/null_v.cpp
@@ -32,7 +32,7 @@ const char *VideoDriver_Null::Start(const char * const *parm)
/* Do not render, nor blit */
DEBUG(misc, 1, "Forcing blitter 'null'...");
- BlitterFactoryBase::SelectBlitter("null");
+ BlitterFactory::SelectBlitter("null");
return NULL;
}
diff --git a/src/video/sdl_v.cpp b/src/video/sdl_v.cpp
index ba0b07640..462989f55 100644
--- a/src/video/sdl_v.cpp
+++ b/src/video/sdl_v.cpp
@@ -123,7 +123,7 @@ static void InitPalette()
static void CheckPaletteAnim()
{
if (_cur_palette.count_dirty != 0) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
switch (blitter->UsePaletteAnimation()) {
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
@@ -270,7 +270,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
{
SDL_Surface *newscreen, *icon;
char caption[50];
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
bool want_hwpalette;
GetAvailableVideoMode(&w, &h);
@@ -398,7 +398,7 @@ bool VideoDriver_SDL::CreateMainSurface(uint w, uint h)
* appropriate event to know this. */
if (_fullscreen) _cursor.in_window = true;
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
blitter->PostResize();
InitPalette();
diff --git a/src/video/win32_v.cpp b/src/video/win32_v.cpp
index 4ea774854..186ac1025 100644
--- a/src/video/win32_v.cpp
+++ b/src/video/win32_v.cpp
@@ -190,7 +190,7 @@ static void ClientSizeChanged(int w, int h)
_cur_palette.count_dirty = 256;
_local_palette = _cur_palette;
- BlitterFactoryBase::GetCurrentBlitter()->PostResize();
+ BlitterFactory::GetCurrentBlitter()->PostResize();
GameSizeChanged();
@@ -279,7 +279,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
DEVMODE settings;
/* Make sure we are always at least the screen-depth of the blitter */
- if (_fullscreen_bpp < BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth()) _fullscreen_bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ if (_fullscreen_bpp < BlitterFactory::GetCurrentBlitter()->GetScreenDepth()) _fullscreen_bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
memset(&settings, 0, sizeof(settings));
settings.dmSize = sizeof(settings);
@@ -360,7 +360,7 @@ bool VideoDriver_Win32::MakeWindow(bool full_screen)
}
}
- BlitterFactoryBase::GetCurrentBlitter()->PostResize();
+ BlitterFactory::GetCurrentBlitter()->PostResize();
GameSizeChanged(); // invalidate all windows, force redraw
return true; // the request succeeded
@@ -374,7 +374,7 @@ static void PaintWindow(HDC dc)
HPALETTE old_palette = SelectPalette(dc, _wnd.gdi_palette, FALSE);
if (_cur_palette.count_dirty != 0) {
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
switch (blitter->UsePaletteAnimation()) {
case Blitter::PALETTE_ANIMATION_VIDEO_BACKEND:
@@ -1060,7 +1060,7 @@ static bool AllocateDibSection(int w, int h, bool force)
{
BITMAPINFO *bi;
HDC dc;
- int bpp = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
w = max(w, 64);
h = max(h, 64);
@@ -1080,7 +1080,7 @@ static bool AllocateDibSection(int w, int h, bool force)
bi->bmiHeader.biHeight = -(_wnd.height = h);
bi->bmiHeader.biPlanes = 1;
- bi->bmiHeader.biBitCount = BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth();
+ bi->bmiHeader.biBitCount = BlitterFactory::GetCurrentBlitter()->GetScreenDepth();
bi->bmiHeader.biCompression = BI_RGB;
if (_wnd.dib_sect) DeleteObject(_wnd.dib_sect);
@@ -1121,7 +1121,7 @@ static void FindResolutions()
* Doesn't really matter since we don't pass a string anyways, but still
* a letdown */
for (i = 0; EnumDisplaySettingsA(NULL, i, &dm) != 0; i++) {
- if (dm.dmBitsPerPel == BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() &&
+ if (dm.dmBitsPerPel == BlitterFactory::GetCurrentBlitter()->GetScreenDepth() &&
dm.dmPelsWidth >= 640 && dm.dmPelsHeight >= 480) {
uint j;
diff --git a/src/viewport.cpp b/src/viewport.cpp
index e80282d02..b80882270 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1372,7 +1372,7 @@ static void ViewportDrawBoundingBoxes(const ParentSpriteToSortVector *psd)
*/
static void ViewportDrawDirtyBlocks()
{
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
const DrawPixelInfo *dpi = _cur_dpi;
void *dst;
int right = UnScaleByZoom(dpi->width, dpi->zoom);
@@ -1446,7 +1446,7 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
int x = UnScaleByZoom(_vd.dpi.left - (vp->virtual_left & mask), vp->zoom) + vp->left;
int y = UnScaleByZoom(_vd.dpi.top - (vp->virtual_top & mask), vp->zoom) + vp->top;
- _vd.dpi.dst_ptr = BlitterFactoryBase::GetCurrentBlitter()->MoveTo(old_dpi->dst_ptr, x - old_dpi->left, y - old_dpi->top);
+ _vd.dpi.dst_ptr = BlitterFactory::GetCurrentBlitter()->MoveTo(old_dpi->dst_ptr, x - old_dpi->left, y - old_dpi->top);
ViewportAddLandscape();
ViewportAddVehicles(&_vd.dpi);
diff --git a/src/window.cpp b/src/window.cpp
index e21edfc73..df080fa41 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -895,7 +895,7 @@ static void DrawOverlappedWindow(Window *w, int left, int top, int right, int bo
dp->left = left - w->left;
dp->top = top - w->top;
dp->pitch = _screen.pitch;
- dp->dst_ptr = BlitterFactoryBase::GetCurrentBlitter()->MoveTo(_screen.dst_ptr, left, top);
+ dp->dst_ptr = BlitterFactory::GetCurrentBlitter()->MoveTo(_screen.dst_ptr, left, top);
dp->zoom = ZOOM_LVL_NORMAL;
w->OnPaint();
}
@@ -2902,7 +2902,7 @@ void HandleMouseEvents()
if (click == MC_LEFT && _newgrf_debug_sprite_picker.mode == SPM_WAIT_CLICK) {
/* Mark whole screen dirty, and wait for the next realtime tick, when drawing is finished. */
- Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
+ Blitter *blitter = BlitterFactory::GetCurrentBlitter();
_newgrf_debug_sprite_picker.clicked_pixel = blitter->MoveTo(_screen.dst_ptr, _cursor.pos.x, _cursor.pos.y);
_newgrf_debug_sprite_picker.click_time = _realtime_tick;
_newgrf_debug_sprite_picker.sprites.Clear();