Fixed 16bpp blitter

This commit is contained in:
Sergii Pylypenko
2019-04-24 18:21:22 +03:00
committed by pelya
parent 3405519815
commit 57e7680dd5
4 changed files with 13 additions and 3 deletions

View File

@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 16bpp_anim.cpp Implementation of the optimized 32 bpp blitter with animation support. */
/** @file 16bpp_anim.cpp Implementation of the optimized 16 bpp blitter with animation support, currently broken. */
#include "../stdafx.h"
#include "../video/video_driver.hpp"

View File

@@ -7,10 +7,11 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 16bpp_base.cpp Implementation of base for 32 bpp blitters. */
/** @file 16bpp_base.cpp Implementation of base for 16 bpp blitters. */
#include "../stdafx.h"
#include "16bpp_base.hpp"
#include "common.hpp"
void *Blitter_16bppBase::MoveTo(void *video, int x, int y)
{
@@ -22,6 +23,14 @@ void Blitter_16bppBase::SetPixel(void *video, int x, int y, uint8 colour)
*((Colour16 *)video + x + y * _screen.pitch) = LookupColourInPalette(colour);
}
void Blitter_16bppBase::DrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash)
{
const Colour16 c = LookupColourInPalette(colour);
this->DrawLineGeneric(x, y, x2, y2, screen_width, screen_height, width, dash, [=](int x, int y) {
*((Colour16 *)video + x + y * _screen.pitch) = c;
});
}
void Blitter_16bppBase::DrawRect(void *video, int width, int height, uint8 colour)
{
Colour16 target = LookupColourInPalette(colour);

View File

@@ -42,6 +42,7 @@ public:
/* virtual */ uint8 GetScreenDepth() { return 16; }
/* virtual */ void *MoveTo(void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 colour);
/* 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);
/* virtual */ void DrawRect(void *video, int width, int height, uint8 colour);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height);

View File

@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_simple.cpp Implementation of the simple 32 bpp blitter. */
/** @file 32bpp_simple.cpp Implementation of the simple 16 bpp blitter. */
#include "../stdafx.h"
#include "../zoom_func.h"