summaryrefslogtreecommitdiff
path: root/src/blitter
diff options
context:
space:
mode:
authorglx <glx@openttd.org>2008-08-15 22:06:58 +0000
committerglx <glx@openttd.org>2008-08-15 22:06:58 +0000
commitc10691faffc9d08b6342b18c3be6f27e659fb43e (patch)
treeeaf62e145b2293b076052608efe28f50ee6f32d7 /src/blitter
parent7672cd43d5c53a97ede3c9bc434ebca28f84bb23 (diff)
downloadopenttd-c10691faffc9d08b6342b18c3be6f27e659fb43e.tar.xz
(svn r14080) -Fix (r14052): assert triggered when drawing chat window with 32bpp-anim blitter (backup buffer was too small)
Diffstat (limited to 'src/blitter')
-rw-r--r--src/blitter/32bpp_anim.hpp1
-rw-r--r--src/blitter/32bpp_base.hpp1
-rw-r--r--src/blitter/8bpp_base.hpp1
-rw-r--r--src/blitter/base.hpp7
-rw-r--r--src/blitter/null.hpp1
5 files changed, 10 insertions, 1 deletions
diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp
index f26919611..c16104c7a 100644
--- a/src/blitter/32bpp_anim.hpp
+++ b/src/blitter/32bpp_anim.hpp
@@ -34,6 +34,7 @@ public:
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
/* virtual */ const char *GetName() { return "32bpp-anim"; }
+ /* virtual */ int GetBytesPerPixel() { return 5; }
template <BlitterMode mode> void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
};
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index e69a7cbfd..f8be717b3 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -26,6 +26,7 @@ public:
/* virtual */ int BufferSize(int width, int height);
/* virtual */ void PaletteAnimate(uint start, uint count);
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
+ /* virtual */ int GetBytesPerPixel() { return 4; }
/**
* Compose a colour based on RGB values.
diff --git a/src/blitter/8bpp_base.hpp b/src/blitter/8bpp_base.hpp
index eecd6e139..df0f51513 100644
--- a/src/blitter/8bpp_base.hpp
+++ b/src/blitter/8bpp_base.hpp
@@ -25,6 +25,7 @@ public:
/* virtual */ int BufferSize(int width, int height);
/* virtual */ void PaletteAnimate(uint start, uint count);
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
+ /* virtual */ int GetBytesPerPixel() { return 1; }
};
#endif /* BLITTER_8BPP_BASE_HPP */
diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp
index 6a4e4196a..c05f21a5d 100644
--- a/src/blitter/base.hpp
+++ b/src/blitter/base.hpp
@@ -183,10 +183,15 @@ public:
virtual Blitter::PaletteAnimation UsePaletteAnimation() = 0;
/**
- * Get the naem of the blitter, the same as the Factory-instance returns.
+ * Get the name of the blitter, the same as the Factory-instance returns.
*/
virtual const char *GetName() = 0;
+ /**
+ * Get how many bytes are needed to store a pixel.
+ */
+ virtual int GetBytesPerPixel() = 0;
+
virtual ~Blitter() { }
};
diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp
index d9589bd51..aae238fc3 100644
--- a/src/blitter/null.hpp
+++ b/src/blitter/null.hpp
@@ -28,6 +28,7 @@ public:
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation() { return Blitter::PALETTE_ANIMATION_NONE; };
/* virtual */ const char *GetName() { return "null"; }
+ /* virtual */ int GetBytesPerPixel() { return 0; }
};
class FBlitter_Null: public BlitterFactory<FBlitter_Null> {