[Scummvm-cvs-logs] CVS: scummvm/gui console.cpp,1.72,1.73 theme.cpp,1.5,1.6 theme.h,1.4,1.5

Johannes Schickel lordhoto at users.sourceforge.net
Tue Jan 31 12:20:03 CET 2006


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28498

Modified Files:
	console.cpp theme.cpp theme.h 
Log Message:
Implements the usage of cached backgrounds in the old theme as well,
that should fix redrawing bugs with the about dialog.
Also I displayed cached background usage in the console for now, since
it produces redraw bugs with the old theme (maybe someone with knowledge how
redrawing of that dialog is handled should look at that).


Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- console.cpp	28 Jan 2006 23:03:39 -0000	1.72
+++ console.cpp	31 Jan 2006 20:19:47 -0000	1.73
@@ -122,7 +122,7 @@
 	// visible screen area, then shift it down in handleTickle() over a
 	// certain period of time.
 	
-	_drawingHints = THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
+	_drawingHints |= THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND;
 
 	_y = -_h;
 	_slideTime = g_system->getMillis();
@@ -145,7 +145,9 @@
 	int y = _y + 2;
 
 	g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x+_w, _y+_h), _drawingHints);
-	_drawingHints = THEME_HINT_SAVE_BACKGROUND;
+	// FIXME: for the old theme the frame around the console vanishes
+	// when any action is processed if we enable this
+	// _drawingHints &= ~THEME_HINT_FIRST_DRAW;
 
 	for (int line = 0; line < _linesPerPage; line++) {
 		int x = _x + 1;

Index: theme.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/theme.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- theme.cpp	31 Jan 2006 14:38:42 -0000	1.5
+++ theme.cpp	31 Jan 2006 20:19:47 -0000	1.6
@@ -132,10 +132,16 @@
 void ThemeClassic::drawDialogBackground(const Common::Rect &r, uint16 hints, kState state) {
 	if (!_initOk)
 		return;
-
+	
 	restoreBackground(r);
+	
+	if ((hints & THEME_HINT_SAVE_BACKGROUND) && !(hints & THEME_HINT_FIRST_DRAW)) {
+		addDirtyRect(r);
+		return;
+	}
+
 	box(r.left, r.top, r.width(), r.height(), _color, _shadowcolor);
-	addDirtyRect(r);
+	addDirtyRect(r, (hints & THEME_HINT_SAVE_BACKGROUND) != 0);
 }
 
 void ThemeClassic::drawText(const Common::Rect &r, const Common::String &str, kState state, kTextAlign align, bool inverted, int deltax, bool useEllipsis) {
@@ -391,6 +397,7 @@
 
 void ThemeClassic::restoreBackground(Common::Rect r) {
 	r.clip(_screen.w, _screen.h);
+	r.clip(_drawArea);
 #ifndef OLDGUI_TRANSPARENCY
 	_screen.fillRect(r, _bgcolor);
 #else
@@ -415,12 +422,24 @@
 #endif
 }
 
-bool ThemeClassic::addDirtyRect(Common::Rect r) {
+bool ThemeClassic::addDirtyRect(Common::Rect r, bool save) {
 	// TODO: implement proper dirty rect handling
 	// FIXME: problem with the 'pitch'
 	r.clip(_screen.w, _screen.h);
 	r.clip(_drawArea);
 	_system->copyRectToOverlay((OverlayColor*)_screen.getBasePtr(r.left, r.top), _screen.w, r.left, r.top, r.width(), r.height());
+	if (_dialog && save) {
+		if (_dialog->screen.pixels) {
+			OverlayColor *dst = (OverlayColor*)_dialog->screen.getBasePtr(r.left, r.top);
+			const OverlayColor *src = (const OverlayColor*)_screen.getBasePtr(r.left, r.top);
+			int h = r.height();
+			while (h--) {
+				memcpy(dst, src, r.width()*sizeof(OverlayColor));
+				dst += _dialog->screen.w;
+				src += _screen.w;
+			}
+		}
+	}
 	return true;
 }
 

Index: theme.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/theme.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- theme.h	31 Jan 2006 19:35:33 -0000	1.4
+++ theme.h	31 Jan 2006 20:19:47 -0000	1.5
@@ -202,7 +202,7 @@
 	void drawLineSeparator(const Common::Rect &r, kState state);
 private:
 	void restoreBackground(Common::Rect r);
-	bool addDirtyRect(Common::Rect r);
+	bool addDirtyRect(Common::Rect r, bool save = false);
 
 	void box(int x, int y, int width, int height, OverlayColor colorA, OverlayColor colorB);
 	void box(int x, int y, int width, int height);





More information about the Scummvm-git-logs mailing list