GUI: Fix display of virtual keyboard for OpenGL/OpenGLES

This commit is contained in:
Laurent Merckx 2020-10-19 10:38:51 +02:00 committed by Eugene Sandulenko
parent d7500078ff
commit 237211a7fe

View File

@ -106,8 +106,17 @@ VirtualKeyboardGUI::~VirtualKeyboardGUI() {
void VirtualKeyboardGUI::initMode(VirtualKeyboard::Mode *mode) {
assert(mode->image);
_kbdSurface = mode->image;
_kbdTransparentColor = mode->transparentColor;
Graphics::PixelFormat kbdFormat = mode->image->format;
Graphics::PixelFormat overlayFormat = _system->getOverlayFormat();
if (kbdFormat.bytesPerPixel == overlayFormat.bytesPerPixel) {
_kbdSurface = mode->image;
_kbdTransparentColor = mode->transparentColor;
} else {
_kbdSurface = mode->image->convertTo(overlayFormat);
byte a, r, g, b;
kbdFormat.colorToARGB(mode->transparentColor, a, r, g, b);
_kbdTransparentColor = overlayFormat.ARGBToColor(a, r, g, b);
}
_kbdBound.setWidth(_kbdSurface->w);
_kbdBound.setHeight(_kbdSurface->h);