From db924a4681f019a6372f5192693af5aede36d080 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Tue, 16 Jan 2018 23:23:52 +0000 Subject: 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. --- src/blitter/8bpp_base.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/blitter/8bpp_base.cpp') diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index eab6eaa0d..dccfda3d7 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -12,6 +12,7 @@ #include "../stdafx.h" #include "../gfx_func.h" #include "8bpp_base.hpp" +#include "common.hpp" #include "../safeguards.h" @@ -35,6 +36,13 @@ void Blitter_8bppBase::SetPixel(void *video, int x, int y, uint8 colour) *((uint8 *)video + x + y * _screen.pitch) = colour; } +void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash) +{ + this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) { + *((uint8 *)video + x + y * _screen.pitch) = colour; + }); +} + void Blitter_8bppBase::DrawRect(void *video, int width, int height, uint8 colour) { do { -- cgit v1.2.3-70-g09d2