[Scummvm-cvs-logs] SF.net SVN: scummvm:[34095] scummvm/branches/gsoc2008-vkeybd/backends/ vkeybd

kenny-d at users.sourceforge.net kenny-d at users.sourceforge.net
Fri Aug 22 12:47:37 CEST 2008


Revision: 34095
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34095&view=rev
Author:   kenny-d
Date:     2008-08-22 10:47:36 +0000 (Fri, 22 Aug 2008)

Log Message:
-----------
Fixed display cursor position bug

Modified Paths:
--------------
    scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp
    scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp

Modified: scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp	2008-08-22 10:36:12 UTC (rev 34094)
+++ scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard-gui.cpp	2008-08-22 10:47:36 UTC (rev 34095)
@@ -226,6 +226,7 @@
 			updateDisplay();
 		animateCaret();
 		animateCursor();
+		redraw();
 		_system->updateScreen();
 		Common::Event event;
 		while (eventMan->pollEvent(event)) {
@@ -286,19 +287,22 @@
 }
 
 void VirtualKeyboardGUI::forceRedraw() {
+	updateDisplay();
 	extendDirtyRect(Rect(_overlayBackup.w, _overlayBackup.h));
 	redraw();
 }
 
 void VirtualKeyboardGUI::redraw() {
 	assert(_kbdSurface);
-
+	int16 w = _dirtyRect.width();
+	int16 h = _dirtyRect.height();
+	if (w <= 0 || h <= 0) return;
+	
 	Graphics::SurfaceKeyColored surf;
-	surf.create(_dirtyRect.width(), _dirtyRect.height(), sizeof(OverlayColor));
+	surf.create(w, h, sizeof(OverlayColor));
 
 	OverlayColor *dst = (OverlayColor *)surf.pixels;
 	const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top);
-	int16 h = surf.h;
 
 	while (h--) {
 		memcpy(dst, src, surf.w * sizeof(OverlayColor));
@@ -306,10 +310,14 @@
 		src += _overlayBackup.w;
 	}
 
-	surf.blit(_kbdSurface, _kbdBound.left - _dirtyRect.left, _kbdBound.top - _dirtyRect.top, _kbdTransparentColor);
-	if (_displayEnabled) surf.blit(&_dispSurface, _dispX - _dirtyRect.left, _dispY - _dirtyRect.top, _dispBackColor);
-	_system->copyRectToOverlay((OverlayColor*)surf.pixels, surf.w,
-		_dirtyRect.left, _dirtyRect.top, surf.w, surf.h);
+	surf.blit(_kbdSurface, _kbdBound.left - _dirtyRect.left, 
+			  _kbdBound.top - _dirtyRect.top, _kbdTransparentColor);
+	if (_displayEnabled) {
+		surf.blit(&_dispSurface, _dispX - _dirtyRect.left, 
+				  _dispY - _dirtyRect.top, _dispBackColor);
+	}
+	_system->copyRectToOverlay((OverlayColor*)surf.pixels, surf.w, 
+							   _dirtyRect.left, _dirtyRect.top, surf.w, surf.h);
 
 	surf.free();
 	
@@ -333,14 +341,12 @@
 			_drawCaret = true;			
 			_dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispForeColor);
 			extendDirtyRect(Rect(_dispX + _caretX, _dispY, _dispX + _caretX + 1, _dispY + _dispSurface.h));
-			redraw();
 		}
 	} else {
 		if (_drawCaret) {
 			_drawCaret = false;
 			_dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispBackColor);
 			extendDirtyRect(Rect(_dispX + _caretX, _dispY, _dispX + _caretX + 1, _dispY + _dispSurface.h));
-			redraw();
 		}
 	}
 }
@@ -370,7 +376,6 @@
 	if (_drawCaret) _dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispForeColor);
 
 	extendDirtyRect(Rect(_dispX, _dispY, _dispX + _dispSurface.w, _dispY + _dispSurface.h));
-	redraw();
 }
 
 void VirtualKeyboardGUI::setupCursor() {

Modified: scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp
===================================================================
--- scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp	2008-08-22 10:36:12 UTC (rev 34094)
+++ scummvm/branches/gsoc2008-vkeybd/backends/vkeybd/virtual-keyboard.cpp	2008-08-22 10:47:36 UTC (rev 34095)
@@ -366,7 +366,7 @@
 	_keyPos = _keys.end();
 	_keysStr.clear();
 	_strPos = 0;
-	_flags = 0;
+	clearFlags();
 	_strChanged = true;
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list