mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-25 13:18:22 +01:00
vwebp: fix file name display in windows unicode build
glutBitmapCharacter() isn't limited to 8-bit characters; add PrintStringW() to iterate through the file name. This may not fix all cases, non-existent characters in the font used have no effect. https://www.opengl.org/resources/libraries/glut/spec3/node76.html#SECTION000111000000000000000 Change-Id: Idb0379539d556a89ec694127f766eb662f09d597
This commit is contained in:
parent
67c44ac5db
commit
bcb872c31f
@ -292,6 +292,19 @@ static void PrintString(const char* const text) {
|
||||
}
|
||||
}
|
||||
|
||||
static void PrintStringW(const char* const text) {
|
||||
#if defined(_WIN32) && defined(_UNICODE)
|
||||
void* const font = GLUT_BITMAP_9_BY_15;
|
||||
const W_CHAR* const wtext = (const W_CHAR*)text;
|
||||
int i;
|
||||
for (i = 0; wtext[i]; ++i) {
|
||||
glutBitmapCharacter(font, wtext[i]);
|
||||
}
|
||||
#else
|
||||
PrintString(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
static float GetColorf(uint32_t color, int shift) {
|
||||
return ((color >> shift) & 0xff) / 255.f;
|
||||
}
|
||||
@ -396,7 +409,7 @@ static void HandleDisplay(void) {
|
||||
|
||||
glColor4f(0.90f, 0.0f, 0.90f, 1.0f);
|
||||
glRasterPos2f(-0.95f, 0.90f);
|
||||
PrintString(kParams.file_name);
|
||||
PrintStringW(kParams.file_name);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "Dimension:%d x %d", pic->width, pic->height);
|
||||
glColor4f(0.90f, 0.0f, 0.90f, 1.0f);
|
||||
|
Loading…
Reference in New Issue
Block a user