src/texteff.cpp
branchgamebalance
changeset 9913 e79cd19772dd
parent 9912 1ac8aac92385
--- a/src/texteff.cpp	Wed Jun 13 12:05:56 2007 +0000
+++ b/src/texteff.cpp	Tue Jun 19 07:21:01 2007 +0000
@@ -16,6 +16,7 @@
 #include "string.h"
 #include "variables.h"
 #include "table/sprites.h"
+#include "blitter/factory.hpp"
 #include <stdarg.h> /* va_list */
 #include "date.h"
 
@@ -54,9 +55,7 @@
 /* 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 Pixel _textmessage_backup[150 * 500]; // (height * width)
-
-extern void memcpy_pitch(void *dst, void *src, int w, int h, int srcpitch, int dstpitch);
+static uint8 _textmessage_backup[150 * 500 * 4]; // (height * width)
 
 static inline uint GetTextMessageCount()
 {
@@ -128,6 +127,7 @@
 void UndrawTextMessage()
 {
 	if (_textmessage_visible) {
+		Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 		/* Sometimes we also need to hide the cursor
 		 *   This is because both textmessage and the cursor take a shot of the
 		 *   screen before drawing.
@@ -163,11 +163,7 @@
 
 		_textmessage_visible = false;
 		/* Put our 'shot' back to the screen */
-		memcpy_pitch(
-			_screen.dst_ptr + x + y * _screen.pitch,
-			_textmessage_backup,
-			width, height, _textmsg_box.width, _screen.pitch);
-
+		blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _textmessage_backup, width, height, _textmsg_box.width);
 		/* And make sure it is updated next time */
 		_video_driver->make_dirty(x, y, width, height);
 
@@ -202,6 +198,7 @@
 /** Draw the textmessage-box */
 void DrawTextMessage()
 {
+	Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
 	if (!_textmessage_dirty) return;
 
 	/* First undraw if needed */
@@ -227,10 +224,7 @@
 	if (width <= 0 || height <= 0) return;
 
 	/* Make a copy of the screen as it is before painting (for undraw) */
-	memcpy_pitch(
-		_textmessage_backup,
-		_screen.dst_ptr + x + y * _screen.pitch,
-		width, height, _screen.pitch, _textmsg_box.width);
+	blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _textmessage_backup, width, height, _textmsg_box.width);
 
 	_cur_dpi = &_screen; // switch to _screen painting