Closed KevinShuuichi closed 3 years ago
I can't see what's wrong with your code.
You can check whether the system memory is sufficient.
Thanks for reply. I checked my stack and malloc heap, I don't think there is any problem with it. I can use malloc anywhere correctly. I resized the main_stack to 32K ( 16K by default) at the file: minigui_startup.c, nothing changed. I called the CreateSettingsWindow at MiniGUIMain before it fall into the loop, something like this:
int MiniGUIMain(int argc, const char *argv[])
{
...
SetDefaultWindowElementRenderer("skin");
CreateMeasureSysFont();
if (mainWindow = CreateMeasureMainWindow() < 0)
exit(-1);
CreateSettingsWindow();
......
while (GetMessage(&Msg, mainWindow)) {
printf("Msg = %#x.\n", Msg.message);
DispatchMessage(&Msg);
}
return 0;
FAILED:
DestroyMainWindow(mainWindow);
MainWindowThreadCleanup(mainWindow);
return -1;
}
I created mainWindow first, and set the settingWindow's hosting window as mainWindow (CreateInfo.hHosting = mainWindow), is it correct ? Or if I have other way to optimize the flickers ? maybe higher version or using privateDC ? By the way , I don't know what private DC actually does.
Some suggestions:
shadow
engine.fbcon
engine in MiniGUI 5.0.I tried shadow engine with real engine = commlcd, it worked just fine. But it 's too slow to show a big window. (about 1.5s to show a window with size of 540*800) If I want to show a big window immediately, the best way I know is dbuff first and then using bitblt to show.
I changed the way of creating the secondDC, it worked, and the system won't down again.
First, I changed
CreateInfo.dwExStyle = WS_EX_NOCLOSEBOX | WS_EX_TROUNDCNS | WS_EX_BROUNDCNS | WS_EX_AUTOSECONDARYDC;
to:
CreateInfo.dwExStyle = WS_EX_NOCLOSEBOX | WS_EX_TROUNDCNS | WS_EX_BROUNDCNS;
then create the secondDC by myself,
exposureWndSecDC = CreateSecondaryDC(s_settingsInfo.exposureWnd);
SetSecondaryDC(s_settingsInfo.exposureWnd, exposureWndSecDC, ON_UPDSECDC_DONOTHING);
ShowWindow(s_settingsInfo.exposureWnd, SW_SHOWNORMAL);
when I want to show the window, I use bitblt like this:
GetWindowRect(s_settingsInfo.exposureWnd, &rect);
BitBlt(exposureWndSecDC, 0, 0, RECTW(rect), RECTH(rect), HDC_SCREEN, 40*SCREEN_RATIO_X, 240*SCREEN_RATIO_Y, 0);
But sometimes the result area is totally black or something like this :
any suggestions ?
Try to call the following functions after handle MSG_PAINT
:
case MSG_PAINT:
BeginPaint();
...
EndPaint();
GetWindowRect(s_settingsInfo.exposureWnd, &rect);
BitBlt(exposureWndSecDC, 0, 0, RECTW(rect), RECTH(rect), HDC_SCREEN, 40*SCREEN_RATIO_X, 240*SCREEN_RATIO_Y, 0);
return 0;
...
It didn't work. Finally, I used the shadow engine, and I changed the shadow_refresh function to DMA instead of memcpy. now, the window shows soon enough. But I still don't understand why dbuff doesn't work. It takes time to track the source code. I'm just new to MiniGUI. Anyway, Thanks for your advice.
That's great!
Hi, Dear VincentWei : I'm trying to use MiniGUI3.2.3 Dbuff to optimize the issue of flickers. Limited by the basic frequency of the CPU(up to 200M), everytime I tried to show a MainWindow (such as a soft-keyboard, which contains dozens of button controls), it took times. I followed the steps introduced by MINIGUI-PROG-GUIDE-V3.0, here is my code
When the code runs to BeginPaint of the Static control (almost the last one whose caption is "K"), I found the InvRgn pointer is pointing to somewhere wild. And the system went down. Is there any problems in my code ? I tracked the bug for days, looking forward to your reply, thanks.