diff options
author | Stephen Kennedy | 2008-08-22 10:47:36 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-08-22 10:47:36 +0000 |
commit | 648f6ed9341775457c301e9055afd40a37b02d6a (patch) | |
tree | fc684dc0ece9b0c36210cf0b8152cb5d536f6906 /backends | |
parent | 2d52f129bb1312d1914c00a8204aded9d872bb1e (diff) | |
download | scummvm-rg350-648f6ed9341775457c301e9055afd40a37b02d6a.tar.gz scummvm-rg350-648f6ed9341775457c301e9055afd40a37b02d6a.tar.bz2 scummvm-rg350-648f6ed9341775457c301e9055afd40a37b02d6a.zip |
Fixed display cursor position bug
svn-id: r34095
Diffstat (limited to 'backends')
-rw-r--r-- | backends/vkeybd/virtual-keyboard-gui.cpp | 25 | ||||
-rw-r--r-- | backends/vkeybd/virtual-keyboard.cpp | 2 |
2 files changed, 16 insertions, 11 deletions
diff --git a/backends/vkeybd/virtual-keyboard-gui.cpp b/backends/vkeybd/virtual-keyboard-gui.cpp index 8f1ed6588c..a66e0721f8 100644 --- a/backends/vkeybd/virtual-keyboard-gui.cpp +++ b/backends/vkeybd/virtual-keyboard-gui.cpp @@ -226,6 +226,7 @@ void VirtualKeyboardGUI::mainLoop() { updateDisplay(); animateCaret(); animateCursor(); + redraw(); _system->updateScreen(); Common::Event event; while (eventMan->pollEvent(event)) { @@ -286,19 +287,22 @@ void VirtualKeyboardGUI::resetDirtyRect() { } 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 @@ void VirtualKeyboardGUI::redraw() { 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 @@ void VirtualKeyboardGUI::animateCaret() { _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 @@ void VirtualKeyboardGUI::updateDisplay() { if (_drawCaret) _dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispForeColor); extendDirtyRect(Rect(_dispX, _dispY, _dispX + _dispSurface.w, _dispY + _dispSurface.h)); - redraw(); } void VirtualKeyboardGUI::setupCursor() { diff --git a/backends/vkeybd/virtual-keyboard.cpp b/backends/vkeybd/virtual-keyboard.cpp index bb80affeaa..0b2933fca0 100644 --- a/backends/vkeybd/virtual-keyboard.cpp +++ b/backends/vkeybd/virtual-keyboard.cpp @@ -366,7 +366,7 @@ void VirtualKeyboard::KeyPressQueue::clear() { _keyPos = _keys.end(); _keysStr.clear(); _strPos = 0; - _flags = 0; + clearFlags(); _strChanged = true; } |