OpenTTD Source 20241224-master-gf74b0cf984
|
The base factory, keeping track of all blitters. More...
#include <factory.hpp>
Public Member Functions | |
std::string_view | GetName () const |
Get the long, human readable, name for the Blitter-class. | |
std::string_view | GetDescription () const |
Get a nice description of the blitter-class. | |
virtual Blitter * | CreateInstance ()=0 |
Create an instance of this Blitter-class. | |
Static Public Member Functions | |
static Blitter * | SelectBlitter (const std::string_view name) |
Find the requested blitter and return its class. | |
static BlitterFactory * | GetBlitterFactory (const std::string_view name) |
Get the blitter factory with the given name. | |
static Blitter * | GetCurrentBlitter () |
Get the current active blitter (always set by calling SelectBlitter). | |
static void | GetBlittersInfo (std::back_insert_iterator< std::string > &output_iterator) |
Fill a buffer with information about the blitters. | |
Protected Member Functions | |
BlitterFactory (const char *name, const char *description, bool usable=true) | |
Construct the blitter, and register it. | |
virtual bool | IsUsable () const |
Is the blitter usable with the current drivers and hardware config? | |
Private Types | |
typedef std::map< std::string, BlitterFactory * > | Blitters |
Map of blitter factories. | |
Static Private Member Functions | |
static Blitters & | GetBlitters () |
Get the map with currently known blitters. | |
static Blitter ** | GetActiveBlitter () |
Get the currently active blitter. | |
Private Attributes | |
const std::string | name |
The name of the blitter factory. | |
const std::string | description |
The description of the blitter. | |
The base factory, keeping track of all blitters.
Definition at line 21 of file factory.hpp.
|
private |
Map of blitter factories.
Definition at line 26 of file factory.hpp.
|
inlineprotected |
Construct the blitter, and register it.
name | The name of the blitter. |
description | A longer description for the blitter. |
usable | Whether the blitter is usable (on the current computer). For example for disabling SSE blitters when the CPU can't handle them. |
Definition at line 58 of file factory.hpp.
References Debug, GetBlitters(), and name.
|
inlinevirtual |
Definition at line 85 of file factory.hpp.
|
pure virtual |
Create an instance of this Blitter-class.
Implemented in FBlitter_32bppAnim, FBlitter_32bppOptimized, FBlitter_32bppSimple, FBlitter_40bppAnim, FBlitter_8bppOptimized, FBlitter_8bppSimple, and FBlitter_Null.
Referenced by SelectBlitter().
|
inlinestaticprivate |
Get the currently active blitter.
Definition at line 42 of file factory.hpp.
Referenced by GetCurrentBlitter(), and SelectBlitter().
|
inlinestatic |
Get the blitter factory with the given name.
name | the blitter factory to select. |
Definition at line 114 of file factory.hpp.
References GetBlitters(), IsUsable(), name, and StrEqualsIgnoreCase().
Referenced by SelectBlitter(), and SwitchNewGRFBlitter().
|
inlinestaticprivate |
Get the map with currently known blitters.
Definition at line 32 of file factory.hpp.
Referenced by BlitterFactory(), GetBlitterFactory(), and GetBlittersInfo().
|
inlinestatic |
Fill a buffer with information about the blitters.
p | The buffer to fill. |
last | The last element of the buffer. |
Definition at line 149 of file factory.hpp.
References GetBlitters(), GetDescription(), and name.
Referenced by ShowHelp().
|
inlinestatic |
Get the current active blitter (always set by calling SelectBlitter).
Definition at line 138 of file factory.hpp.
References GetActiveBlitter().
Referenced by VideoDriver_SDL_Base::AfterBlitterChange(), VideoDriver_Win32GDI::AfterBlitterChange(), VideoDriver_SDL_Default::AllocateBackingStore(), VideoDriver_Win32GDI::AllocateBackingStore(), VideoDriver_SDL::CheckPaletteAnim(), VideoDriver_SDL_Base::ClientSizeChanged(), CurrentScreenCallback(), DrawOverlappedWindow(), SmallMapWindow::DrawSmallMap(), DrawSpriteToRgbaBuffer(), FillDrawPixelInfo(), VideoDriver_Win32Base::GetFullscreenBpp(), OpenGLBackend::GetVideoBuffer(), VideoDriver_SDL_OpenGL::GetVideoPointer(), GfxBlitter(), GfxDoDrawLine(), GfxFillPolygon(), GfxFillRect(), HandleBootstrap(), HandleMouseEvents(), MakeLargeWorldScreenshot(), MakeSmallScreenshot(), VideoDriver_Win32Base::MakeWindow(), NetworkDrawChatMessage(), NetworkUndrawChatMessage(), OpenGLBackend::Paint(), VideoDriver_SDL_Default::Paint(), VideoDriver_SDL_OpenGL::Paint(), VideoDriver_Win32GDI::Paint(), ReadSprite(), OpenGLBackend::ReleaseVideoBuffer(), OpenGLBackend::Resize(), VideoDriver_Dedicated::Start(), VideoDriver_SDL_Base::Start(), VideoDriver_Win32GDI::Start(), SurveyConfiguration(), SwitchNewGRFBlitter(), and ViewportDrawDirtyBlocks().
|
inline |
Get a nice description of the blitter-class.
Definition at line 170 of file factory.hpp.
References description.
Referenced by GetBlittersInfo().
|
inline |
Get the long, human readable, name for the Blitter-class.
Definition at line 162 of file factory.hpp.
References name.
|
inlineprotectedvirtual |
Is the blitter usable with the current drivers and hardware config?
Reimplemented in FBlitter_40bppAnim.
Definition at line 79 of file factory.hpp.
Referenced by GetBlitterFactory().
|
inlinestatic |
Find the requested blitter and return its class.
name | the blitter to select. |
Definition at line 96 of file factory.hpp.
References CreateInstance(), Debug, GetActiveBlitter(), GetBlitterFactory(), Blitter::GetName(), and name.
Referenced by openttd_main(), and VideoDriver_Null::Start().
|
private |
The description of the blitter.
Definition at line 24 of file factory.hpp.
Referenced by GetDescription().
|
private |
The name of the blitter factory.
Definition at line 23 of file factory.hpp.
Referenced by BlitterFactory(), GetBlitterFactory(), GetBlittersInfo(), GetName(), and SelectBlitter().