Fixed display cursor position bug
svn-id: r34095
This commit is contained in:
parent
2d52f129bb
commit
648f6ed934
2 changed files with 16 additions and 11 deletions
|
@ -226,6 +226,7 @@ void VirtualKeyboardGUI::mainLoop() {
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
animateCaret();
|
animateCaret();
|
||||||
animateCursor();
|
animateCursor();
|
||||||
|
redraw();
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
Common::Event event;
|
Common::Event event;
|
||||||
while (eventMan->pollEvent(event)) {
|
while (eventMan->pollEvent(event)) {
|
||||||
|
@ -286,19 +287,22 @@ void VirtualKeyboardGUI::resetDirtyRect() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboardGUI::forceRedraw() {
|
void VirtualKeyboardGUI::forceRedraw() {
|
||||||
|
updateDisplay();
|
||||||
extendDirtyRect(Rect(_overlayBackup.w, _overlayBackup.h));
|
extendDirtyRect(Rect(_overlayBackup.w, _overlayBackup.h));
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboardGUI::redraw() {
|
void VirtualKeyboardGUI::redraw() {
|
||||||
assert(_kbdSurface);
|
assert(_kbdSurface);
|
||||||
|
int16 w = _dirtyRect.width();
|
||||||
|
int16 h = _dirtyRect.height();
|
||||||
|
if (w <= 0 || h <= 0) return;
|
||||||
|
|
||||||
Graphics::SurfaceKeyColored surf;
|
Graphics::SurfaceKeyColored surf;
|
||||||
surf.create(_dirtyRect.width(), _dirtyRect.height(), sizeof(OverlayColor));
|
surf.create(w, h, sizeof(OverlayColor));
|
||||||
|
|
||||||
OverlayColor *dst = (OverlayColor *)surf.pixels;
|
OverlayColor *dst = (OverlayColor *)surf.pixels;
|
||||||
const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top);
|
const OverlayColor *src = (OverlayColor *) _overlayBackup.getBasePtr(_dirtyRect.left, _dirtyRect.top);
|
||||||
int16 h = surf.h;
|
|
||||||
|
|
||||||
while (h--) {
|
while (h--) {
|
||||||
memcpy(dst, src, surf.w * sizeof(OverlayColor));
|
memcpy(dst, src, surf.w * sizeof(OverlayColor));
|
||||||
|
@ -306,10 +310,14 @@ void VirtualKeyboardGUI::redraw() {
|
||||||
src += _overlayBackup.w;
|
src += _overlayBackup.w;
|
||||||
}
|
}
|
||||||
|
|
||||||
surf.blit(_kbdSurface, _kbdBound.left - _dirtyRect.left, _kbdBound.top - _dirtyRect.top, _kbdTransparentColor);
|
surf.blit(_kbdSurface, _kbdBound.left - _dirtyRect.left,
|
||||||
if (_displayEnabled) surf.blit(&_dispSurface, _dispX - _dirtyRect.left, _dispY - _dirtyRect.top, _dispBackColor);
|
_kbdBound.top - _dirtyRect.top, _kbdTransparentColor);
|
||||||
_system->copyRectToOverlay((OverlayColor*)surf.pixels, surf.w,
|
if (_displayEnabled) {
|
||||||
_dirtyRect.left, _dirtyRect.top, surf.w, surf.h);
|
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();
|
surf.free();
|
||||||
|
|
||||||
|
@ -333,14 +341,12 @@ void VirtualKeyboardGUI::animateCaret() {
|
||||||
_drawCaret = true;
|
_drawCaret = true;
|
||||||
_dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispForeColor);
|
_dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispForeColor);
|
||||||
extendDirtyRect(Rect(_dispX + _caretX, _dispY, _dispX + _caretX + 1, _dispY + _dispSurface.h));
|
extendDirtyRect(Rect(_dispX + _caretX, _dispY, _dispX + _caretX + 1, _dispY + _dispSurface.h));
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (_drawCaret) {
|
if (_drawCaret) {
|
||||||
_drawCaret = false;
|
_drawCaret = false;
|
||||||
_dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispBackColor);
|
_dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispBackColor);
|
||||||
extendDirtyRect(Rect(_dispX + _caretX, _dispY, _dispX + _caretX + 1, _dispY + _dispSurface.h));
|
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);
|
if (_drawCaret) _dispSurface.drawLine(_caretX, 0, _caretX, _dispSurface.h, _dispForeColor);
|
||||||
|
|
||||||
extendDirtyRect(Rect(_dispX, _dispY, _dispX + _dispSurface.w, _dispY + _dispSurface.h));
|
extendDirtyRect(Rect(_dispX, _dispY, _dispX + _dispSurface.w, _dispY + _dispSurface.h));
|
||||||
redraw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VirtualKeyboardGUI::setupCursor() {
|
void VirtualKeyboardGUI::setupCursor() {
|
||||||
|
|
|
@ -366,7 +366,7 @@ void VirtualKeyboard::KeyPressQueue::clear() {
|
||||||
_keyPos = _keys.end();
|
_keyPos = _keys.end();
|
||||||
_keysStr.clear();
|
_keysStr.clear();
|
||||||
_strPos = 0;
|
_strPos = 0;
|
||||||
_flags = 0;
|
clearFlags();
|
||||||
_strChanged = true;
|
_strChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue