diff --git a/projects/generate b/projects/generate
index e218d96349..dc43f6be09 100755
--- a/projects/generate
+++ b/projects/generate
@@ -40,7 +40,7 @@ file_prefix="..\\\\src\\\\"
safety_check() {
li=""
- for i in `cat $1 | grep -v "#" | xargs -n 1 basename | sort`; do
+ for i in `cat $1 | grep -v "#\|ottdres.rc\|win32.cpp\|win32_v.cpp" | xargs -n 1 basename | sort`; do
if [ "$li" = "$i" ]; then
echo " !! ERROR !!"
echo ""
diff --git a/projects/openttd.vcproj b/projects/openttd.vcproj
index 899464bf8c..de6df4f636 100644
--- a/projects/openttd.vcproj
+++ b/projects/openttd.vcproj
@@ -967,12 +967,24 @@
+
+
+
+
+
+
+
+
@@ -992,7 +1004,10 @@
RelativePath=".\..\src\blitter\8bpp_simple.hpp">
+ RelativePath=".\..\src\blitter\base.hpp">
+
+
@@ -1020,31 +1035,6 @@
RelativePath=".\..\src\spriteloader\spriteloader.hpp">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index 93f7d12415..e58eb48b2a 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -1511,6 +1511,14 @@
+
+
+
+
@@ -1519,6 +1527,14 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
+
+
+
+
@@ -1544,7 +1560,11 @@
>
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/source.list b/source.list
index f45e6ab098..e64b20c8bb 100644
--- a/source.list
+++ b/source.list
@@ -293,15 +293,20 @@ ai/trolly/shared.cpp
ai/trolly/trolly.cpp
# Blitters
+blitter/32bpp_base.cpp
+blitter/32bpp_base.hpp
blitter/32bpp_simple.cpp
blitter/32bpp_simple.hpp
+blitter/8bpp_base.cpp
+blitter/8bpp_base.hpp
blitter/8bpp_debug.cpp
blitter/8bpp_debug.hpp
blitter/8bpp_optimized.cpp
blitter/8bpp_optimized.hpp
blitter/8bpp_simple.cpp
blitter/8bpp_simple.hpp
-blitter/blitter.hpp
+blitter/base.hpp
+blitter/factory.hpp
blitter/null.cpp
blitter/null.hpp
@@ -314,15 +319,6 @@ spriteloader/png.hpp
#end
spriteloader/spriteloader.hpp
-# Renderer
-renderer/32bpp.cpp
-renderer/32bpp.hpp
-renderer/8bpp.cpp
-renderer/8bpp.hpp
-renderer/null.cpp
-renderer/null.hpp
-renderer/renderer.hpp
-
# NewGRF
newgrf.cpp
newgrf_canal.cpp
diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp
new file mode 100644
index 0000000000..a3211a02a1
--- /dev/null
+++ b/src/blitter/32bpp_base.cpp
@@ -0,0 +1,125 @@
+#include "../stdafx.h"
+#include "../gfx.h"
+#include "32bpp_base.hpp"
+
+void *Blitter_32bppBase::MoveTo(const void *video, int x, int y)
+{
+ return (uint32 *)video + x + y * _screen.pitch;
+}
+
+void Blitter_32bppBase::SetPixel(void *video, int x, int y, uint8 color)
+{
+ *((uint32 *)video + x + y * _screen.pitch) = LookupColourInPalette(color);
+}
+
+void Blitter_32bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
+{
+ uint32 *dst = (uint32 *)video + x + y * _screen.pitch;
+ if (*dst == 0) *dst = LookupColourInPalette(color);
+}
+
+void Blitter_32bppBase::SetHorizontalLine(void *video, int width, uint8 color)
+{
+ uint32 *dst = (uint32 *)video;
+ uint32 color32 = LookupColourInPalette(color);
+
+ for (; width > 0; width--) {
+ *dst = color32;
+ dst++;
+ }
+}
+
+void Blitter_32bppBase::DrawLine(void *video, int x, int y, int x2, int y2, uint8 color)
+{
+ int dy;
+ int dx;
+ int stepx;
+ int stepy;
+ int frac;
+
+ dy = (y2 - y) * 2;
+ if (dy < 0) {
+ dy = -dy;
+ stepy = -1;
+ } else {
+ stepy = 1;
+ }
+
+ dx = (x2 - x) * 2;
+ if (dx < 0) {
+ dx = -dx;
+ stepx = -1;
+ } else {
+ stepx = 1;
+ }
+
+ this->SetPixel(video, x, y, color);
+ if (dx > dy) {
+ frac = dy - (dx >> 1);
+ while (x != x2) {
+ if (frac >= 0) {
+ y += stepy;
+ frac -= dx;
+ }
+ x += stepx;
+ frac += dy;
+ this->SetPixel(video, x, y, color);
+ }
+ } else {
+ frac = dx - (dy >> 1);
+ while (y != y2) {
+ if (frac >= 0) {
+ x += stepx;
+ frac -= dy;
+ }
+ y += stepy;
+ frac += dx;
+ this->SetPixel(video, x, y, color);
+ }
+ }
+}
+
+void Blitter_32bppBase::CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch)
+{
+ int direction = (height < 0) ? -1 : 1;
+ uint32 *dst = (uint32 *)video;
+ uint32 *usrc = (uint32 *)src;
+
+ height = abs(height);
+ for (; height > 0; height--) {
+ memcpy(dst, usrc, width * sizeof(uint32));
+ usrc += src_pitch * direction;
+ dst += _screen.pitch * direction;
+ }
+}
+
+void Blitter_32bppBase::CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
+{
+ int direction = (height < 0) ? -1 : 1;
+ uint32 *udst = (uint32 *)dst;
+ uint32 *src = (uint32 *)video;
+
+ height = abs(height);
+ for (; height > 0; height--) {
+ memcpy(udst, src, width * sizeof(uint32));
+ src += _screen.pitch * direction;
+ udst += dst_pitch * direction;
+ }
+}
+
+void Blitter_32bppBase::MoveBuffer(void *video_dst, const void *video_src, int width, int height)
+{
+ uint32 *dst = (uint32 *)video_dst;
+ uint32 *src = (uint32 *)video_src;
+
+ for (; height > 0; height--) {
+ memmove(dst, src, width * sizeof(uint32));
+ src += _screen.pitch;
+ dst += _screen.pitch;
+ }
+}
+
+int Blitter_32bppBase::BufferSize(int width, int height)
+{
+ return width * height * sizeof(uint32);
+}
diff --git a/src/renderer/32bpp.hpp b/src/blitter/32bpp_base.hpp
similarity index 62%
rename from src/renderer/32bpp.hpp
rename to src/blitter/32bpp_base.hpp
index 7f0283754f..85ce070623 100644
--- a/src/renderer/32bpp.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -1,18 +1,23 @@
/* $Id$ */
-/** @file 32bpp.hpp */
+/** @file 32bpp_base.hpp */
-#ifndef RENDERER_32BPP_HPP
-#define RENDERER_32BPP_HPP
+#ifndef BLITTER_32BPP_BASE_HPP
+#define BLITTER_32BPP_BASE_HPP
-#include "renderer.hpp"
+#include "base.hpp"
-class Renderer_32bpp : public Renderer {
+class Blitter_32bppBase : public Blitter {
public:
+ /* virtual */ uint8 GetScreenDepth() { return 32; }
+// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
+// /* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
+// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
/* virtual */ void *MoveTo(const void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
/* virtual */ void SetHorizontalLine(void *video, int width, uint8 color);
+ /* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, uint8 color);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
/* virtual */ void MoveBuffer(void *video_dst, const void *video_src, int width, int height);
@@ -25,11 +30,4 @@ public:
}
};
-class FRenderer_32bpp: public RendererFactory {
-public:
- /* virtual */ const char *GetName() { return "32bpp"; }
-
- /* virtual */ Renderer *CreateInstance() { return new Renderer_32bpp(); }
-};
-
-#endif /* RENDERER_32BPP_HPP */
+#endif /* BLITTER_32BPP_BASE_HPP */
diff --git a/src/blitter/32bpp_simple.cpp b/src/blitter/32bpp_simple.cpp
index c858736cf3..3dc5ee0963 100644
--- a/src/blitter/32bpp_simple.cpp
+++ b/src/blitter/32bpp_simple.cpp
@@ -3,7 +3,6 @@
#include "../gfx.h"
#include "../debug.h"
#include "../table/sprites.h"
-#include "../renderer/32bpp.hpp"
#include "32bpp_simple.hpp"
static FBlitter_32bppSimple iFBlitter_32bppSimple;
@@ -108,7 +107,7 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
if (src->m == 0) {
if (src->a != 0) *dst = ComposeColorRGBA(src->r, src->g, src->b, src->a, *dst);
} else {
- if (bp->remap[src->m] != 0) *dst = ComposeColorPA(Renderer_32bpp::LookupColourInPalette(bp->remap[src->m]), src->a, *dst);
+ if (bp->remap[src->m] != 0) *dst = ComposeColorPA(this->LookupColourInPalette(bp->remap[src->m]), src->a, *dst);
}
break;
@@ -176,7 +175,7 @@ Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::Alloc
for (int i = 0; i < sprite->height * sprite->width; i++) {
if (dst[i].m != 0) {
/* Pre-convert the mapping channel to a RGB value */
- uint color = Renderer_32bpp::LookupColourInPalette(dst[i].m);
+ uint color = this->LookupColourInPalette(dst[i].m);
dst[i].r = GB(color, 16, 8);
dst[i].g = GB(color, 8, 8);
dst[i].b = GB(color, 0, 8);
diff --git a/src/blitter/32bpp_simple.hpp b/src/blitter/32bpp_simple.hpp
index cafaaab00e..a8d6d1d587 100644
--- a/src/blitter/32bpp_simple.hpp
+++ b/src/blitter/32bpp_simple.hpp
@@ -5,27 +5,20 @@
#ifndef BLITTER_32BPP_SIMPLE_HPP
#define BLITTER_32BPP_SIMPLE_HPP
-#include "blitter.hpp"
+#include "32bpp_base.hpp"
+#include "factory.hpp"
-class Blitter_32bppSimple : public Blitter {
+class Blitter_32bppSimple : public Blitter_32bppBase {
public:
- /* virtual */ uint8 GetScreenDepth() { return 32; }
-
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
-
/* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
-
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
-
- /* virtual */ const char *GetRenderer() { return "32bpp"; }
};
class FBlitter_32bppSimple: public BlitterFactory {
public:
/* virtual */ const char *GetName() { return "32bpp-simple"; }
-
/* virtual */ const char *GetDescription() { return "32bpp Simple Blitter (no palette animation)"; }
-
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
};
diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp
new file mode 100644
index 0000000000..e745ee627c
--- /dev/null
+++ b/src/blitter/8bpp_base.cpp
@@ -0,0 +1,129 @@
+#include "../stdafx.h"
+#include "../gfx.h"
+#include "8bpp_base.hpp"
+
+void Blitter_8bppBase::DrawColorMappingRect(void *dst, int width, int height, int pal)
+{
+ const uint8 *ctab = GetNonSprite(pal) + 1;
+
+ do {
+ for (int i = 0; i != width; i++) *((uint8 *)dst + i) = ctab[((uint8 *)dst)[i]];
+ dst = (uint8 *)dst + _screen.pitch;
+ } while (height--);
+}
+
+void *Blitter_8bppBase::MoveTo(const void *video, int x, int y)
+{
+ return (uint8 *)video + x + y * _screen.pitch;
+}
+
+void Blitter_8bppBase::SetPixel(void *video, int x, int y, uint8 color)
+{
+ *((uint8 *)video + x + y * _screen.pitch) = color;
+}
+
+void Blitter_8bppBase::SetPixelIfEmpty(void *video, int x, int y, uint8 color)
+{
+ uint8 *dst = (uint8 *)video + x + y * _screen.pitch;
+ if (*dst == 0) *dst = color;
+}
+
+void Blitter_8bppBase::SetHorizontalLine(void *video, int width, uint8 color)
+{
+ memset(video, color, width);
+}
+
+void Blitter_8bppBase::DrawLine(void *video, int x, int y, int x2, int y2, uint8 color)
+{
+ int dy;
+ int dx;
+ int stepx;
+ int stepy;
+ int frac;
+
+ dy = (y2 - y) * 2;
+ if (dy < 0) {
+ dy = -dy;
+ stepy = -1;
+ } else {
+ stepy = 1;
+ }
+
+ dx = (x2 - x) * 2;
+ if (dx < 0) {
+ dx = -dx;
+ stepx = -1;
+ } else {
+ stepx = 1;
+ }
+
+ this->SetPixel(video, x, y, color);
+ if (dx > dy) {
+ frac = dy - (dx / 2);
+ while (x != x2) {
+ if (frac >= 0) {
+ y += stepy;
+ frac -= dx;
+ }
+ x += stepx;
+ frac += dy;
+ this->SetPixel(video, x, y, color);
+ }
+ } else {
+ frac = dx - (dy / 2);
+ while (y != y2) {
+ if (frac >= 0) {
+ x += stepx;
+ frac -= dy;
+ }
+ y += stepy;
+ frac += dx;
+ this->SetPixel(video, x, y, color);
+ }
+ }
+}
+
+void Blitter_8bppBase::CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch)
+{
+ int direction = (height < 0) ? -1 : 1;
+ uint8 *dst = (uint8 *)video;
+ uint8 *usrc = (uint8 *)src;
+
+ height = abs(height);
+ for (; height > 0; height--) {
+ memcpy(dst, usrc, width);
+ usrc += src_pitch * direction;
+ dst += _screen.pitch * direction;
+ }
+}
+
+void Blitter_8bppBase::CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch)
+{
+ int direction = (height < 0) ? -1 : 1;
+ uint8 *udst = (uint8 *)dst;
+ uint8 *src = (uint8 *)video;
+
+ height = abs(height);
+ for (; height > 0; height--) {
+ memcpy(udst, src, width);
+ src += _screen.pitch * direction;
+ udst += dst_pitch * direction;
+ }
+}
+
+void Blitter_8bppBase::MoveBuffer(void *video_dst, const void *video_src, int width, int height)
+{
+ uint8 *dst = (uint8 *)video_dst;
+ uint8 *src = (uint8 *)video_src;
+
+ for (; height > 0; height--) {
+ memmove(dst, src, width);
+ src += _screen.pitch;
+ dst += _screen.pitch;
+ }
+}
+
+int Blitter_8bppBase::BufferSize(int width, int height)
+{
+ return width * height;
+}
diff --git a/src/renderer/8bpp.hpp b/src/blitter/8bpp_base.hpp
similarity index 52%
rename from src/renderer/8bpp.hpp
rename to src/blitter/8bpp_base.hpp
index a8bb27a486..7ed862ca0d 100644
--- a/src/renderer/8bpp.hpp
+++ b/src/blitter/8bpp_base.hpp
@@ -1,29 +1,27 @@
/* $Id$ */
-/** @file 8bpp.hpp */
+/** @file 8bpp_base.hpp */
-#ifndef RENDERER_8BPP_HPP
-#define RENDERER_8BPP_HPP
+#ifndef BLITTER_8BPP_BASE_HPP
+#define BLITTER_8BPP_BASE_HPP
-#include "renderer.hpp"
+#include "base.hpp"
-class Renderer_8bpp : public Renderer {
+class Blitter_8bppBase : public Blitter {
public:
+ /* virtual */ uint8 GetScreenDepth() { return 8; }
+// /* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
+ /* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
+// /* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
/* virtual */ void *MoveTo(const void *video, int x, int y);
/* virtual */ void SetPixel(void *video, int x, int y, uint8 color);
/* virtual */ void SetPixelIfEmpty(void *video, int x, int y, uint8 color);
/* virtual */ void SetHorizontalLine(void *video, int width, uint8 color);
+ /* virtual */ void DrawLine(void *video, int x, int y, int x2, int y2, uint8 color);
/* virtual */ void CopyFromBuffer(void *video, const void *src, int width, int height, int src_pitch);
/* virtual */ void CopyToBuffer(const void *video, void *dst, int width, int height, int dst_pitch);
/* virtual */ void MoveBuffer(void *video_dst, const void *video_src, int width, int height);
/* virtual */ int BufferSize(int width, int height);
};
-class FRenderer_8bpp: public RendererFactory {
-public:
- /* virtual */ const char *GetName() { return "8bpp"; }
-
- /* virtual */ Renderer *CreateInstance() { return new Renderer_8bpp(); }
-};
-
-#endif /* RENDERER_8BPP_HPP */
+#endif /* BLITTER_8BPP_BASE_HPP */
diff --git a/src/blitter/8bpp_debug.cpp b/src/blitter/8bpp_debug.cpp
index e1ad988d35..3a9b52d2ab 100644
--- a/src/blitter/8bpp_debug.cpp
+++ b/src/blitter/8bpp_debug.cpp
@@ -35,16 +35,6 @@ void Blitter_8bppDebug::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
}
}
-void Blitter_8bppDebug::DrawColorMappingRect(void *dst, int width, int height, int pal)
-{
- const uint8 *ctab = GetNonSprite(pal) + 1;
-
- do {
- for (int i = 0; i != width; i++) _screen.renderer->SetPixel(dst, i, 0, ctab[((uint8 *)dst)[i]]);
- dst = _screen.renderer->MoveTo(dst, 0, 1);
- } while (height--);
-}
-
Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
{
Sprite *dest_sprite;
diff --git a/src/blitter/8bpp_debug.hpp b/src/blitter/8bpp_debug.hpp
index d3b52988b1..9fd2a2d8e1 100644
--- a/src/blitter/8bpp_debug.hpp
+++ b/src/blitter/8bpp_debug.hpp
@@ -5,27 +5,19 @@
#ifndef BLITTER_8BPP_DEBUG_HPP
#define BLITTER_8BPP_DEBUG_HPP
-#include "blitter.hpp"
+#include "8bpp_base.hpp"
+#include "factory.hpp"
-class Blitter_8bppDebug : public Blitter {
+class Blitter_8bppDebug : public Blitter_8bppBase {
public:
- /* virtual */ uint8 GetScreenDepth() { return 8; }
-
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
-
- /* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
-
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
-
- /* virtual */ const char *GetRenderer() { return "8bpp"; }
};
class FBlitter_8bppDebug: public BlitterFactory {
public:
/* virtual */ const char *GetName() { return "8bpp-debug"; }
-
/* virtual */ const char *GetDescription() { return "8bpp Debug Blitter (testing only)"; }
-
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppDebug(); }
};
diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp
index 09c5886f07..9af922e30b 100644
--- a/src/blitter/8bpp_optimized.cpp
+++ b/src/blitter/8bpp_optimized.cpp
@@ -102,16 +102,6 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
}
}
-void Blitter_8bppOptimized::DrawColorMappingRect(void *dst, int width, int height, int pal)
-{
- const uint8 *ctab = GetNonSprite(pal) + 1;
-
- do {
- for (int i = 0; i != width; i++) _screen.renderer->SetPixel(dst, i, 0, ctab[((uint8 *)dst)[i]]);
- dst = _screen.renderer->MoveTo(dst, 0, 1);
- } while (height--);
-}
-
Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
{
Sprite *dest_sprite;
diff --git a/src/blitter/8bpp_optimized.hpp b/src/blitter/8bpp_optimized.hpp
index 0c9cb2dee5..bbade00808 100644
--- a/src/blitter/8bpp_optimized.hpp
+++ b/src/blitter/8bpp_optimized.hpp
@@ -5,27 +5,19 @@
#ifndef BLITTER_8BPP_OPTIMIZED_HPP
#define BLITTER_8BPP_OPTIMIZED_HPP
-#include "blitter.hpp"
+#include "8bpp_base.hpp"
+#include "factory.hpp"
-class Blitter_8bppOptimized : public Blitter {
+class Blitter_8bppOptimized : public Blitter_8bppBase {
public:
- /* virtual */ uint8 GetScreenDepth() { return 8; }
-
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
-
- /* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
-
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
-
- /* virtual */ const char *GetRenderer() { return "8bpp"; }
};
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)"; }
-
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppOptimized(); }
};
diff --git a/src/blitter/8bpp_simple.cpp b/src/blitter/8bpp_simple.cpp
index 47ebe8fc40..010066f8a8 100644
--- a/src/blitter/8bpp_simple.cpp
+++ b/src/blitter/8bpp_simple.cpp
@@ -48,16 +48,6 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
}
}
-void Blitter_8bppSimple::DrawColorMappingRect(void *dst, int width, int height, int pal)
-{
- const uint8 *ctab = GetNonSprite(pal) + 1;
-
- do {
- for (int i = 0; i != width; i++) _screen.renderer->SetPixel(dst, i, 0, ctab[((uint8 *)dst)[i]]);
- dst = _screen.renderer->MoveTo(dst, 0, 1);
- } while (height--);
-}
-
Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
{
Sprite *dest_sprite;
diff --git a/src/blitter/8bpp_simple.hpp b/src/blitter/8bpp_simple.hpp
index 2c848d7c17..589df29f3e 100644
--- a/src/blitter/8bpp_simple.hpp
+++ b/src/blitter/8bpp_simple.hpp
@@ -5,27 +5,19 @@
#ifndef BLITTER_8BPP_SIMPLE_HPP
#define BLITTER_8BPP_SIMPLE_HPP
-#include "blitter.hpp"
+#include "8bpp_base.hpp"
+#include "factory.hpp"
-class Blitter_8bppSimple : public Blitter {
+class Blitter_8bppSimple : public Blitter_8bppBase {
public:
- /* virtual */ uint8 GetScreenDepth() { return 8; }
-
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
-
- /* virtual */ void DrawColorMappingRect(void *dst, int width, int height, int pal);
-
/* virtual */ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
-
- /* virtual */ const char *GetRenderer() { return "8bpp"; }
};
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)"; }
-
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppSimple(); }
};
diff --git a/src/renderer/renderer.hpp b/src/blitter/base.hpp
similarity index 59%
rename from src/renderer/renderer.hpp
rename to src/blitter/base.hpp
index 7b7ad0f4fe..66550d42da 100644
--- a/src/renderer/renderer.hpp
+++ b/src/blitter/base.hpp
@@ -1,16 +1,64 @@
/* $Id$ */
-/** @file renderer.hpp */
+#ifndef BLITTER_BASE_HPP
+#define BLITTER_BASE_HPP
-#ifndef RENDERER_HPP
-#define RENDERER_HPP
+#include "../spritecache.h"
+#include "../spriteloader/spriteloader.hpp"
-#include
-#include