diff options
author | peter1138 <peter1138@openttd.org> | 2010-01-04 02:32:36 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2010-01-04 02:32:36 +0000 |
commit | abb147d9742f349513d076a76b2957eb573d78e7 (patch) | |
tree | 57b0ff251d966e055785a8e289aacc6431540af4 /src/blitter/32bpp_anim.cpp | |
parent | 5ab64809fe72c38d373bdbed6ffa9b6660dd69d6 (diff) | |
download | openttd-abb147d9742f349513d076a76b2957eb573d78e7.tar.xz |
(svn r18709) -Fix (r10227,FS#3464): Animation buffer for 32bpp-anim blitter was only validated during sprite blitting, other drawing operations didn't check it. Initial startup and window resize could therefore lead to crash.
Diffstat (limited to 'src/blitter/32bpp_anim.cpp')
-rw-r--r-- | src/blitter/32bpp_anim.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index ef42ee0a3..42fbe3fe9 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -202,14 +202,6 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL return; } - if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) { - /* The size of the screen changed; we can assume we can wipe all data from our buffer */ - free(this->anim_buf); - this->anim_buf = CallocT<uint8>(_screen.width * _screen.height); - this->anim_buf_width = _screen.width; - this->anim_buf_height = _screen.height; - } - switch (mode) { default: NOT_REACHED(); case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return; @@ -448,3 +440,14 @@ Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation() { return Blitter::PALETTE_ANIMATION_BLITTER; } + +void Blitter_32bppAnim::PostResize() +{ + if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) { + /* The size of the screen changed; we can assume we can wipe all data from our buffer */ + free(this->anim_buf); + this->anim_buf = CallocT<uint8>(_screen.width * _screen.height); + this->anim_buf_width = _screen.width; + this->anim_buf_height = _screen.height; + } +} |