summaryrefslogtreecommitdiff
path: root/src/blitter
diff options
context:
space:
mode:
authortruelight <truelight@openttd.org>2007-06-11 13:38:11 +0000
committertruelight <truelight@openttd.org>2007-06-11 13:38:11 +0000
commitbe0f5cf877bb2d7a74855f8988e50ca09624aabe (patch)
tree2a0bd663d5cf57d1410220f8083c018e6b10b0ac /src/blitter
parent9d570fa018a7c449853c113c9d2190e5246a8f09 (diff)
downloadopenttd-be0f5cf877bb2d7a74855f8988e50ca09624aabe.tar.xz
(svn r10096) -Fix r10092: freetype bypassed the Blitter::Encode, making fonts look weird
Diffstat (limited to 'src/blitter')
-rw-r--r--src/blitter/8bpp_debug.cpp6
-rw-r--r--src/blitter/8bpp_debug.hpp2
-rw-r--r--src/blitter/8bpp_optimized.cpp6
-rw-r--r--src/blitter/8bpp_optimized.hpp2
-rw-r--r--src/blitter/8bpp_slow.cpp6
-rw-r--r--src/blitter/8bpp_slow.hpp2
-rw-r--r--src/blitter/blitter.hpp4
7 files changed, 12 insertions, 16 deletions
diff --git a/src/blitter/8bpp_debug.cpp b/src/blitter/8bpp_debug.cpp
index dea100c3f..3779508e9 100644
--- a/src/blitter/8bpp_debug.cpp
+++ b/src/blitter/8bpp_debug.cpp
@@ -6,8 +6,6 @@
static FBlitter_8bppDebug iFBlitter_8bppDebug;
-extern void* AllocSprite(size_t);
-
void Blitter_8bppDebug::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const byte *src, *src_line;
@@ -33,10 +31,10 @@ void Blitter_8bppDebug::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
}
}
-Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite)
+Sprite *Blitter_8bppDebug::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
{
Sprite *dest_sprite;
- dest_sprite = (Sprite *)AllocSprite(sizeof(*dest_sprite) + sprite->height * sprite->width);
+ dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;
diff --git a/src/blitter/8bpp_debug.hpp b/src/blitter/8bpp_debug.hpp
index 67b12b652..c096200e6 100644
--- a/src/blitter/8bpp_debug.hpp
+++ b/src/blitter/8bpp_debug.hpp
@@ -15,7 +15,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
- Sprite *Encode(SpriteLoader::Sprite *sprite);
+ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
};
class FBlitter_8bppDebug: public BlitterFactory<FBlitter_8bppDebug> {
diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp
index 62397a045..51e11767e 100644
--- a/src/blitter/8bpp_optimized.cpp
+++ b/src/blitter/8bpp_optimized.cpp
@@ -6,8 +6,6 @@
static FBlitter_8bppOptimized iFBlitter_8bppOptimized;
-extern void* AllocSprite(size_t);
-
void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const byte *src, *src_next;
@@ -100,7 +98,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
}
}
-Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite)
+Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
{
Sprite *dest_sprite;
byte *temp_dst;
@@ -191,7 +189,7 @@ Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite)
assert(index < memory);
/* Allocate the exact amount of memory we need */
- dest_sprite = (Sprite *)AllocSprite(sizeof(*dest_sprite) + index);
+ dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + index);
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;
diff --git a/src/blitter/8bpp_optimized.hpp b/src/blitter/8bpp_optimized.hpp
index 8f251fb2c..761f0aea6 100644
--- a/src/blitter/8bpp_optimized.hpp
+++ b/src/blitter/8bpp_optimized.hpp
@@ -15,7 +15,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
- Sprite *Encode(SpriteLoader::Sprite *sprite);
+ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
};
class FBlitter_8bppOptimized: public BlitterFactory<FBlitter_8bppOptimized> {
diff --git a/src/blitter/8bpp_slow.cpp b/src/blitter/8bpp_slow.cpp
index 99c43a4f5..ad83cff20 100644
--- a/src/blitter/8bpp_slow.cpp
+++ b/src/blitter/8bpp_slow.cpp
@@ -5,8 +5,6 @@
static FBlitter_8bppSimple iFBlitter_8bppSimple;
-extern void* AllocSprite(size_t);
-
void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const byte *src, *src_line;
@@ -46,10 +44,10 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
}
}
-Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite)
+Sprite *Blitter_8bppSimple::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
{
Sprite *dest_sprite;
- dest_sprite = (Sprite *)AllocSprite(sizeof(*dest_sprite) + sprite->height * sprite->width);
+ dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width);;
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;
diff --git a/src/blitter/8bpp_slow.hpp b/src/blitter/8bpp_slow.hpp
index ac60e3262..fabab0529 100644
--- a/src/blitter/8bpp_slow.hpp
+++ b/src/blitter/8bpp_slow.hpp
@@ -15,7 +15,7 @@ public:
void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
- Sprite *Encode(SpriteLoader::Sprite *sprite);
+ Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator);
};
class FBlitter_8bppSimple: public BlitterFactory<FBlitter_8bppSimple> {
diff --git a/src/blitter/blitter.hpp b/src/blitter/blitter.hpp
index 4920da426..1114dbf58 100644
--- a/src/blitter/blitter.hpp
+++ b/src/blitter/blitter.hpp
@@ -35,6 +35,8 @@ public:
int pitch; ///< The pitch of the destination buffer
};
+ typedef void *AllocatorProc(size_t size);
+
/**
* Get the screen depth this blitter works for.
* This is either: 8, 16, 24 or 32.
@@ -49,7 +51,7 @@ public:
/**
* Convert a sprite from the loader to our own format.
*/
- virtual Sprite *Encode(SpriteLoader::Sprite *sprite) = 0;
+ virtual Sprite *Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator) = 0;
virtual ~Blitter() { }
};