diff --git a/src/texteff.cpp b/src/texteff.cpp --- a/src/texteff.cpp +++ b/src/texteff.cpp @@ -55,7 +55,7 @@ static bool _textmessage_visible = false /* The chatbox grows from the bottom so the coordinates are pixels from * the left and pixels from the bottom. The height is the maximum height */ static const Oblong _textmsg_box = {10, 30, 500, 150}; -static uint8 _textmessage_backup[150 * 500 * 4]; // (height * width) +static uint8 _textmessage_backup[150 * 500 * 5]; // (height * width) static inline uint GetTextMessageCount() { @@ -163,7 +163,7 @@ void UndrawTextMessage() _textmessage_visible = false; /* Put our 'shot' back to the screen */ - blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _textmessage_backup, width, height, _textmsg_box.width); + blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _textmessage_backup, width, height); /* And make sure it is updated next time */ _video_driver->make_dirty(x, y, width, height); @@ -223,8 +223,10 @@ void DrawTextMessage() } if (width <= 0 || height <= 0) return; + assert(blitter->BufferSize(width, height) < (int)sizeof(_textmessage_backup)); + /* Make a copy of the screen as it is before painting (for undraw) */ - blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _textmessage_backup, width, height, _textmsg_box.width); + blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _textmessage_backup, width, height); _cur_dpi = &_screen; // switch to _screen painting