summaryrefslogtreecommitdiff
path: root/src/blitter/base.hpp
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2018-01-16 23:23:52 +0000
committerPeterN <peter@fuzzle.org>2019-01-24 11:12:06 +0000
commitdb924a4681f019a6372f5192693af5aede36d080 (patch)
tree210488cfd3c478b086e353c10826ee834d605d6b /src/blitter/base.hpp
parented325ada887f09904b3351020903899a033c6b51 (diff)
downloadopenttd-db924a4681f019a6372f5192693af5aede36d080.tar.xz
Codechange: [Blitter] Change DrawLine to be templated
This is remove per-pixel overheads due to use of the SetPixel virtual method. These overheads included: * expensive virtual method call which prevents inlining * palette lookup for every pixel * branch on whether palette animation is enabled on every pixel Regenerate project files.
Diffstat (limited to 'src/blitter/base.hpp')
-rw-r--r--src/blitter/base.hpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp
index a9403b339..388359441 100644
--- a/src/blitter/base.hpp
+++ b/src/blitter/base.hpp
@@ -122,7 +122,7 @@ public:
* @param width Line width.
* @param dash Length of dashes for dashed lines. 0 means solid line.
*/
- virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash = 0);
+ virtual void DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash = 0) = 0;
/**
* Copy from a buffer to the screen.
@@ -203,6 +203,8 @@ public:
virtual void PostResize() { };
virtual ~Blitter() { }
+
+ template <typename SetPixelT> void DrawLineGeneric(int x, int y, int x2, int y2, int screen_width, int screen_height, int width, int dash, SetPixelT set_pixel);
};
#endif /* BLITTER_BASE_HPP */