mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-25 11:07:54 +08:00
Call GetScreenRect for usage of &g_rcScr
This commit is contained in:
+32
-33
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -76,34 +76,33 @@ static LRESULT ToolTipWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||
SetTimer (hWnd, _ID_TIMER, timeout / 10);
|
||||
|
||||
info = GetWindowInfo (hWnd);
|
||||
iBorder =
|
||||
iBorder =
|
||||
info->we_rdr->calc_we_area (hWnd, LFRDR_METRICS_BORDER, NULL);
|
||||
SetWindowFont (hWnd,
|
||||
SetWindowFont (hWnd,
|
||||
(PLOGFONT)GetWindowElementAttr(hWnd, WE_FONT_TOOLTIP));
|
||||
break;
|
||||
}
|
||||
|
||||
case MSG_TIMER:
|
||||
KillTimer (hWnd, _ID_TIMER);
|
||||
if(IsWindowVisible(hWnd))
|
||||
{
|
||||
ShowWindow (hWnd, SW_HIDE);
|
||||
}
|
||||
if(IsWindowVisible(hWnd)) {
|
||||
ShowWindow (hWnd, SW_HIDE);
|
||||
}
|
||||
break;
|
||||
|
||||
case MSG_PAINT:
|
||||
{
|
||||
HDC hdc;
|
||||
const char* text;
|
||||
|
||||
|
||||
hdc = BeginPaint (hWnd);
|
||||
|
||||
|
||||
text = GetWindowCaption (hWnd);
|
||||
SetBkMode (hdc, BM_TRANSPARENT);
|
||||
|
||||
SetTextColor (hdc, GetWindowElementPixel(hWnd, WE_FGC_TOOLTIP));
|
||||
TabbedTextOut (hdc, iBorder, iBorder, text);
|
||||
|
||||
|
||||
EndPaint (hWnd, hdc);
|
||||
return 0;
|
||||
}
|
||||
@@ -125,12 +124,12 @@ static LRESULT ToolTipWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lP
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return DefaultMainWinProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
/* ToolTip Win without border or frame. */
|
||||
HWND CreateToolTipWin (HWND hParentWnd, int x, int y, int timeout_ms,
|
||||
HWND CreateToolTipWin (HWND hParentWnd, int x, int y, int timeout_ms,
|
||||
const char* text, ...)
|
||||
{
|
||||
HWND hwnd;
|
||||
@@ -152,8 +151,8 @@ HWND CreateToolTipWin (HWND hParentWnd, int x, int y, int timeout_ms,
|
||||
} while (i == size);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
SelectFont (HDC_SCREEN,
|
||||
|
||||
SelectFont (HDC_SCREEN,
|
||||
(PLOGFONT)GetWindowElementAttr(hParentWnd, WE_FONT_TOOLTIP));
|
||||
GetTabbedTextExtent (HDC_SCREEN, buf ? buf : text, -1, &text_size);
|
||||
|
||||
@@ -205,7 +204,7 @@ void ResetToolTipWin (HWND hwnd, int x, int y, const char* text, ...)
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
SelectFont (HDC_SCREEN,
|
||||
SelectFont (HDC_SCREEN,
|
||||
(PLOGFONT)GetWindowElementAttr(hwnd, WE_FONT_TOOLTIP));
|
||||
GetTabbedTextExtent (HDC_SCREEN, buf ? buf : text, -1, &text_size);
|
||||
|
||||
@@ -249,7 +248,7 @@ void GUIAPI NotifyParentEx (HWND hwnd, LINT id, int code, DWORD add_data)
|
||||
notif_proc (hwnd, id, code, add_data);
|
||||
}
|
||||
else {
|
||||
SendNotifyMessage (GetParent (hwnd), MSG_COMMAND,
|
||||
SendNotifyMessage (GetParent (hwnd), MSG_COMMAND,
|
||||
(WPARAM) MAKELONG (id, code), (LPARAM)hwnd);
|
||||
}
|
||||
}
|
||||
@@ -268,7 +267,7 @@ LRESULT GUIAPI DefaultPageProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
return GetDlgCtrlID (hDef);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
case MSG_DESTROY:
|
||||
DestroyAllControls (hWnd);
|
||||
break;
|
||||
@@ -292,10 +291,10 @@ LRESULT GUIAPI DefaultPageProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case MSG_KEYDOWN:
|
||||
if ((hCurFocus = GetFocusChild (hWnd))) {
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
& DLGC_WANTALLKEYS)
|
||||
break;
|
||||
}
|
||||
@@ -326,7 +325,7 @@ LRESULT GUIAPI DefaultPageProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
HWND hNewFocus;
|
||||
|
||||
if (hCurFocus) {
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
& DLGC_WANTTAB)
|
||||
break;
|
||||
}
|
||||
@@ -350,9 +349,9 @@ LRESULT GUIAPI DefaultPageProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
case SCANCODE_CURSORBLOCKLEFT:
|
||||
{
|
||||
HWND hNewFocus;
|
||||
|
||||
|
||||
if (hCurFocus) {
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
& DLGC_WANTARROWS)
|
||||
break;
|
||||
}
|
||||
@@ -362,9 +361,9 @@ LRESULT GUIAPI DefaultPageProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
hNewFocus = GetNextDlgGroupItem (hWnd, hCurFocus, FALSE);
|
||||
else
|
||||
hNewFocus = GetNextDlgGroupItem (hWnd, hCurFocus, TRUE);
|
||||
|
||||
|
||||
if (hNewFocus != hCurFocus) {
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
if (SendMessage (hCurFocus, MSG_GETDLGCODE, 0, 0L)
|
||||
& DLGC_STATIC)
|
||||
return 0;
|
||||
|
||||
@@ -385,7 +384,7 @@ LRESULT GUIAPI DefaultPageProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM l
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return DefaultControlProc (hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -912,7 +912,7 @@ static void get_box_xy (HWND hParentWnd, DWORD dwStyle, DLGTEMPLATE* MsgBoxData)
|
||||
GetWindowRect (hParentWnd, &rcTemp);
|
||||
}
|
||||
else {
|
||||
rcTemp = g_rcDesktop;
|
||||
rcTemp = g_rcScr;
|
||||
}
|
||||
|
||||
switch (dwStyle & MB_ALIGNMASK) {
|
||||
@@ -942,12 +942,12 @@ static void get_box_xy (HWND hParentWnd, DWORD dwStyle, DLGTEMPLATE* MsgBoxData)
|
||||
break;
|
||||
}
|
||||
|
||||
if ((MsgBoxData->x + MsgBoxData->w) > g_rcDesktop.right) {
|
||||
MsgBoxData->x = g_rcDesktop.right - MsgBoxData->w;
|
||||
if ((MsgBoxData->x + MsgBoxData->w) > g_rcScr.right) {
|
||||
MsgBoxData->x = g_rcScr.right - MsgBoxData->w;
|
||||
}
|
||||
|
||||
if ((MsgBoxData->y + MsgBoxData->h) > g_rcDesktop.bottom) {
|
||||
MsgBoxData->y = g_rcDesktop.bottom - MsgBoxData->h;
|
||||
if ((MsgBoxData->y + MsgBoxData->h) > g_rcScr.bottom) {
|
||||
MsgBoxData->y = g_rcScr.bottom - MsgBoxData->h;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -88,8 +88,8 @@ void __mg_unlock_gcrinfo (PDC pdc);
|
||||
#define LOCK_GCRINFO(pdc) __mg_lock_recalc_gcrinfo (pdc)
|
||||
#define UNLOCK_GCRINFO(pdc) if (dc_IsGeneralDC(pdc)) __mg_unlock_gcrinfo (pdc)
|
||||
#else
|
||||
RECT g_rcScr;
|
||||
PLOGFONT g_SysLogFont[1];
|
||||
RECT g_rcScr; // TODO: bad coding
|
||||
PLOGFONT g_SysLogFont[1]; // TODO: bad coding
|
||||
#define LOCK_GCRINFO(pdc)
|
||||
#define UNLOCK_GCRINFO(pdc)
|
||||
#define __mg_hwnd_desktop 0xFFFFFFFD
|
||||
|
||||
@@ -828,11 +828,15 @@ GAL_Surface * GAL_DisplayFormat (GAL_Surface *surface);
|
||||
*/
|
||||
GAL_Surface * GAL_DisplayFormatAlpha (GAL_Surface *surface);
|
||||
|
||||
/* Not in public API at the moment - do not use! */
|
||||
int GAL_SoftStretch (GAL_Surface *src, GAL_Rect *srcrect,
|
||||
GAL_Surface *dst, GAL_Rect *dstrect);
|
||||
|
||||
GAL_Surface* __gal_screen;
|
||||
#ifdef _MGUSE_COMPOSITING
|
||||
extern GAL_Surface* __gal_screen;
|
||||
extern GAL_Surface* __gal_fake_screen;
|
||||
#else
|
||||
extern GAL_Surface* __gal_screen;
|
||||
#endif
|
||||
|
||||
#define WIDTHOFPHYGC (__gal_screen->w)
|
||||
#define HEIGHTOFPHYGC (__gal_screen->h)
|
||||
|
||||
@@ -446,6 +446,7 @@ static int dskEndTrackPopupMenu (PTRACKMENUINFO ptmi)
|
||||
ZORDERINFO* zi = __mg_zorder_info;
|
||||
PTRACKMENUINFO plast = NULL;
|
||||
RECT rc;
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (sg_ptmi == ptmi) {
|
||||
sg_ptmi = NULL;
|
||||
@@ -475,7 +476,7 @@ static int dskEndTrackPopupMenu (PTRACKMENUINFO ptmi)
|
||||
}
|
||||
ptmi = ptmi->next;
|
||||
}
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1260,6 +1261,8 @@ static int dskStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info)
|
||||
|
||||
static int dskCancelDragWindow (PMAINWIN pWin)
|
||||
{
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (!(pWin->dwStyle & WS_VISIBLE))
|
||||
return -1;
|
||||
|
||||
@@ -1268,8 +1271,7 @@ static int dskCancelDragWindow (PMAINWIN pWin)
|
||||
|
||||
_dd_info.hwnd = (HWND)-1;
|
||||
unlock_zorder_info ();
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
// SetDefaultCursor (GetSystemCursor (IDC_ARROW));
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1338,6 +1340,8 @@ static int do_drag_drop_window (UINT msg, int x, int y)
|
||||
_dd_info.last_y = y;
|
||||
}
|
||||
else {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
SetPenColor (HDC_SCREEN_SYS, PIXEL_lightwhite);
|
||||
FocusRect (HDC_SCREEN_SYS, _dd_info.rc.left, _dd_info.rc.top,
|
||||
_dd_info.rc.right, _dd_info.rc.bottom);
|
||||
@@ -1347,7 +1351,7 @@ static int do_drag_drop_window (UINT msg, int x, int y)
|
||||
MAKELONG (_dd_info.rc.left, _dd_info.rc.top),
|
||||
MAKELONG (_dd_info.rc.right, _dd_info.rc.bottom));
|
||||
unlock_zorder_info ();
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
|
||||
if(_dd_info.hwnd != (HWND)gui_GetMainWindowPtrUnderPoint (x, y))
|
||||
SetDefaultCursor (GetSystemCursor (IDC_ARROW));
|
||||
|
||||
+18
-10
@@ -617,8 +617,10 @@ static intptr_t cliChangeCaption (PMAINWIN pWin)
|
||||
|
||||
void __mg_start_server_desktop (void)
|
||||
{
|
||||
RECT rcScr = GetScreenRect ();
|
||||
|
||||
InitClipRgn (&sg_ScrGCRInfo.crgn, &sg_FreeClipRectList);
|
||||
SetClipRgn (&sg_ScrGCRInfo.crgn, &g_rcScr);
|
||||
SetClipRgn (&sg_ScrGCRInfo.crgn, &rcScr);
|
||||
sg_ScrGCRInfo.age = 0;
|
||||
sg_ScrGCRInfo.old_zi_age = 0;
|
||||
|
||||
@@ -721,6 +723,7 @@ static BOOL _cb_update_cli_znode (void* context,
|
||||
const ZORDERINFO* zi, ZORDERNODE* znode)
|
||||
{
|
||||
RECT rcInv;
|
||||
RECT rcScr = GetScreenRect ();
|
||||
int cli = (int)(intptr_t)context;
|
||||
|
||||
if (znode->cli == cli && znode->flags & ZOF_VISIBLE && znode->fortestinghwnd) {
|
||||
@@ -728,7 +731,7 @@ static BOOL _cb_update_cli_znode (void* context,
|
||||
|
||||
if (!IsRectEmpty(&(znode->dirty_rc))) {
|
||||
|
||||
IntersectRect(&rcInv, &znode->dirty_rc, &g_rcScr);
|
||||
IntersectRect(&rcInv, &znode->dirty_rc, &rcScr);
|
||||
|
||||
msg.wParam = MAKELONG (rcInv.left, rcInv.top);
|
||||
msg.lParam = MAKELONG (rcInv.right, rcInv.bottom);
|
||||
@@ -844,6 +847,7 @@ static int srvStartDragWindow (int cli, int idx_znode,
|
||||
{
|
||||
ZORDERINFO* zi = _get_zorder_info(cli);
|
||||
ZORDERNODE* nodes;
|
||||
RECT rcScr = GetScreenRect ();
|
||||
|
||||
if (idx_znode > (zi->max_nr_globals
|
||||
+ zi->max_nr_topmosts + zi->max_nr_normals) ||
|
||||
@@ -899,7 +903,7 @@ static int srvStartDragWindow (int cli, int idx_znode,
|
||||
}
|
||||
|
||||
SetPenColor (HDC_SCREEN_SYS, PIXEL_lightwhite);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
do_for_all_znodes (NULL, zi, _cb_exclude_rc, ZT_GLOBAL);
|
||||
FocusRect (HDC_SCREEN_SYS, _dd_info.rc.left, _dd_info.rc.top,
|
||||
_dd_info.rc.right, _dd_info.rc.bottom);
|
||||
@@ -913,6 +917,7 @@ static int srvStartDragWindow (int cli, int idx_znode,
|
||||
static int srvCancelDragWindow (int cli, int idx_znode)
|
||||
{
|
||||
ZORDERINFO* zi = _get_zorder_info(cli);
|
||||
RECT rcScr = GetScreenRect ();
|
||||
|
||||
if (idx_znode > (zi->max_nr_globals
|
||||
+ zi->max_nr_topmosts + zi->max_nr_normals) ||
|
||||
@@ -927,7 +932,7 @@ static int srvCancelDragWindow (int cli, int idx_znode)
|
||||
|
||||
_dd_info.cli = -1;
|
||||
unlock_zi_for_change (zi);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
//SetDefaultCursor (GetSystemCursor (IDC_ARROW));
|
||||
|
||||
if (OnZNodeOperation)
|
||||
@@ -939,6 +944,7 @@ static int srvCancelDragWindow (int cli, int idx_znode)
|
||||
int __mg_do_drag_drop_window (int msg, int x, int y)
|
||||
{
|
||||
HWND hwnd;
|
||||
RECT rcScr = GetScreenRect ();
|
||||
|
||||
if (_dd_info.cli < 0)
|
||||
return 0;
|
||||
@@ -1023,7 +1029,7 @@ int __mg_do_drag_drop_window (int msg, int x, int y)
|
||||
}
|
||||
|
||||
unlock_zi_for_change (_dd_info.zi);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
__mg_get_znode_at_point (__mg_zorder_info, x, y, &hwnd);
|
||||
if(_dd_info.hwnd != hwnd)
|
||||
SetDefaultCursor (GetSystemCursor (IDC_ARROW));
|
||||
@@ -1191,6 +1197,7 @@ int __mg_remove_all_znodes_of_client (int cli)
|
||||
ZORDERNODE* nodes;
|
||||
int slot, slot2, old_active;
|
||||
RECT rc_bound = {0, 0, 0, 0};
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
nodes = GET_ZORDERNODE(zi);
|
||||
|
||||
@@ -1212,7 +1219,7 @@ int __mg_remove_all_znodes_of_client (int cli)
|
||||
/* check influenced window zorder nodes */
|
||||
do_for_all_znodes ((void*)(intptr_t)cli, zi, _cb_update_rc_nocli, ZT_ALL);
|
||||
|
||||
if (SubtractClipRect (&sg_UpdateRgn, &g_rcScr)) {
|
||||
if (SubtractClipRect (&sg_UpdateRgn, &rcScr)) {
|
||||
nodes [0].age ++;
|
||||
nodes [0].flags |= ZOF_REFERENCE;
|
||||
}
|
||||
@@ -1251,7 +1258,7 @@ int __mg_remove_all_znodes_of_client (int cli)
|
||||
_cb_intersect_rc_no_cli, ZT_NORMAL);
|
||||
|
||||
if (!(nodes [0].flags & ZOF_REFERENCE) &&
|
||||
SubtractClipRect (&sg_UpdateRgn, &g_rcScr)) {
|
||||
SubtractClipRect (&sg_UpdateRgn, &rcScr)) {
|
||||
nodes [0].age ++;
|
||||
nodes [0].flags |= ZOF_REFERENCE;
|
||||
}
|
||||
@@ -1287,7 +1294,7 @@ int __mg_remove_all_znodes_of_client (int cli)
|
||||
}
|
||||
}
|
||||
if (!(nodes [0].flags & ZOF_REFERENCE) &&
|
||||
SubtractClipRect (&sg_UpdateRgn, &g_rcScr)) {
|
||||
SubtractClipRect (&sg_UpdateRgn, &rcScr)) {
|
||||
nodes [0].age ++;
|
||||
nodes [0].flags |= ZOF_REFERENCE;
|
||||
}
|
||||
@@ -1754,6 +1761,7 @@ static int dskEndTrackPopupMenu (PTRACKMENUINFO ptmi)
|
||||
{
|
||||
PTRACKMENUINFO plast = NULL;
|
||||
RECT rc;
|
||||
RECT rcScr = GetScreenRect ();
|
||||
|
||||
if (sg_ptmi == ptmi) {
|
||||
sg_ptmi = NULL;
|
||||
@@ -1787,7 +1795,7 @@ static int dskEndTrackPopupMenu (PTRACKMENUINFO ptmi)
|
||||
}
|
||||
ptmi = ptmi->next;
|
||||
}
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -3283,7 +3291,7 @@ static void srvSaveScreen (BOOL active)
|
||||
if (cliActive == -1) {
|
||||
cliActive = 0;
|
||||
hwndActive = 0;
|
||||
rcActive = g_rcScr;
|
||||
rcActive = GetScreenRect();
|
||||
}
|
||||
|
||||
sprintf (buffer, "%d-%p-%d.bmp", cliActive, hwndActive, n);
|
||||
|
||||
+14
-12
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -102,7 +102,9 @@ static BOOL InitWndManagementInfo (void)
|
||||
|
||||
BOOL mg_InitDesktop (void)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
/*
|
||||
* Init ZOrderInfo here.
|
||||
*/
|
||||
@@ -111,7 +113,7 @@ BOOL mg_InitDesktop (void)
|
||||
_WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Init heap of clipping rects.
|
||||
*/
|
||||
@@ -129,7 +131,7 @@ BOOL mg_InitDesktop (void)
|
||||
init_desktop_win ();
|
||||
|
||||
InitClipRgn (&sg_ScrGCRInfo.crgn, &sg_FreeClipRectList);
|
||||
SetClipRgn (&sg_ScrGCRInfo.crgn, &g_rcScr);
|
||||
SetClipRgn (&sg_ScrGCRInfo.crgn, &rcScr);
|
||||
sg_ScrGCRInfo.age = 0;
|
||||
sg_ScrGCRInfo.old_zi_age = 0;
|
||||
|
||||
|
||||
+20
-18
@@ -11,39 +11,39 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
/*
|
||||
** desktop-ths.c: The desktop for MiniGUI-Threads.
|
||||
**
|
||||
** Current maintainer: Wei Yongming.
|
||||
@@ -85,6 +85,8 @@ PMSGQUEUE __mg_dsk_msg_queue;
|
||||
|
||||
static BOOL InitWndManagementInfo (void)
|
||||
{
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
__mg_capture_wnd = 0;
|
||||
|
||||
#ifdef _MGHAVE_MENU
|
||||
@@ -95,7 +97,7 @@ static BOOL InitWndManagementInfo (void)
|
||||
sg_hCaretWnd = 0;
|
||||
|
||||
InitClipRgn (&sg_ScrGCRInfo.crgn, &sg_FreeClipRectList);
|
||||
SetClipRgn (&sg_ScrGCRInfo.crgn, &g_rcScr);
|
||||
SetClipRgn (&sg_ScrGCRInfo.crgn, &rcScr);
|
||||
pthread_mutex_init (&sg_ScrGCRInfo.lock, NULL);
|
||||
sg_ScrGCRInfo.age = 0;
|
||||
sg_ScrGCRInfo.old_zi_age = 0;
|
||||
@@ -108,13 +110,13 @@ static BOOL InitWndManagementInfo (void)
|
||||
|
||||
BOOL mg_InitDesktop (void)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Init ZOrderInfo here.
|
||||
*/
|
||||
ret = kernel_alloc_z_order_info (DEF_NR_TOPMOSTS, DEF_NR_NORMALS);
|
||||
|
||||
|
||||
if (ret < 0) {
|
||||
_WRN_PRINTF ("KERNEL>Desktop: Can not initialize ZOrderInfo!\n");
|
||||
return FALSE;
|
||||
@@ -173,15 +175,15 @@ void* DesktopMain (void* data)
|
||||
}
|
||||
#endif
|
||||
|
||||
lRet = DesktopWinProc (HWND_DESKTOP,
|
||||
lRet = DesktopWinProc (HWND_DESKTOP,
|
||||
Msg.message, Msg.wParam, Msg.lParam);
|
||||
|
||||
if (Msg.pAdd) /* this is a sync message. */
|
||||
{
|
||||
PSYNCMSG pSyncMsg = (PSYNCMSG)(Msg.pAdd);
|
||||
pSyncMsg->retval = lRet;
|
||||
if(pSyncMsg->sem_handle)
|
||||
sem_post(pSyncMsg->sem_handle);
|
||||
if(pSyncMsg->sem_handle)
|
||||
sem_post(pSyncMsg->sem_handle);
|
||||
}
|
||||
|
||||
#ifdef _MGHAVE_TRACE_MSG
|
||||
@@ -200,7 +202,7 @@ void* DesktopMain (void* data)
|
||||
}
|
||||
|
||||
pthread_t GUIAPI GetMainWinThread(HWND hMainWnd)
|
||||
{
|
||||
{
|
||||
#ifdef WIN32
|
||||
pthread_t ret;
|
||||
memset(&ret, 0, sizeof(pthread_t));
|
||||
@@ -208,7 +210,7 @@ pthread_t GUIAPI GetMainWinThread(HWND hMainWnd)
|
||||
#else
|
||||
MG_CHECK_RET (MG_IS_WINDOW(hMainWnd), 0);
|
||||
#endif
|
||||
|
||||
|
||||
return ((PMAINWIN)hMainWnd)->th;
|
||||
}
|
||||
|
||||
|
||||
+261
-251
File diff suppressed because it is too large
Load Diff
@@ -165,10 +165,12 @@ int InitGUI (int argc, const char* agr[])
|
||||
step++;
|
||||
atexit (mg_TerminateScreenDC);
|
||||
|
||||
#if 0
|
||||
g_rcScr.left = 0;
|
||||
g_rcScr.top = 0;
|
||||
g_rcScr.right = GetGDCapability (HDC_SCREEN_SYS, GDCAP_MAXX) + 1;
|
||||
g_rcScr.bottom = GetGDCapability (HDC_SCREEN_SYS, GDCAP_MAXY) + 1;
|
||||
#endif
|
||||
|
||||
mg_TerminateMgEtc ();
|
||||
return 0;
|
||||
@@ -454,10 +456,12 @@ int InitGUI (int argc, const char* agr[])
|
||||
step++;
|
||||
atexit (mg_TerminateScreenDC);
|
||||
|
||||
#if 0
|
||||
g_rcScr.left = 0;
|
||||
g_rcScr.top = 0;
|
||||
g_rcScr.right = GetGDCapability (HDC_SCREEN_SYS, GDCAP_MAXX) + 1;
|
||||
g_rcScr.bottom = GetGDCapability (HDC_SCREEN_SYS, GDCAP_MAXY) + 1;
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
if (_is_server) {
|
||||
|
||||
@@ -511,10 +511,12 @@ int GUIAPI InitGUI (int args, const char *agr[])
|
||||
goto failure1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
g_rcScr.left = 0;
|
||||
g_rcScr.top = 0;
|
||||
g_rcScr.right = GetGDCapability (HDC_SCREEN_SYS, GDCAP_MAXX) + 1;
|
||||
g_rcScr.bottom = GetGDCapability (HDC_SCREEN_SYS, GDCAP_MAXY) + 1;
|
||||
#endif
|
||||
|
||||
license_create();
|
||||
splash_draw_framework();
|
||||
|
||||
+29
-17
@@ -158,18 +158,20 @@ static void watermark_update(void)
|
||||
|
||||
static void watermark_init(void)
|
||||
{
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
fourcorner_info[0].bmp = &g_license_bitmaps[WATERMARK_1];
|
||||
fourcorner_info[1].bmp = &g_license_bitmaps[WATERMARK_2];
|
||||
fourcorner_info[2].bmp = &g_license_bitmaps[WATERMARK_3];
|
||||
fourcorner_info[3].bmp = &g_license_bitmaps[WATERMARK_3];
|
||||
|
||||
/* right-top.*/
|
||||
fourcorner_info[1].pos.x += RECTW(g_rcScr) - fourcorner_info[1].bmp->bmWidth;
|
||||
fourcorner_info[1].pos.x += RECTW(rcScr) - fourcorner_info[1].bmp->bmWidth;
|
||||
/* left-bottom.*/
|
||||
fourcorner_info[2].pos.y += RECTH(g_rcScr) - fourcorner_info[2].bmp->bmHeight;
|
||||
fourcorner_info[2].pos.y += RECTH(rcScr) - fourcorner_info[2].bmp->bmHeight;
|
||||
/* right-bottom.*/
|
||||
fourcorner_info[3].pos.x += RECTW(g_rcScr) - fourcorner_info[3].bmp->bmWidth;
|
||||
fourcorner_info[3].pos.y += RECTH(g_rcScr) - fourcorner_info[3].bmp->bmHeight;
|
||||
fourcorner_info[3].pos.x += RECTW(rcScr) - fourcorner_info[3].bmp->bmWidth;
|
||||
fourcorner_info[3].pos.y += RECTH(rcScr) - fourcorner_info[3].bmp->bmHeight;
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -197,8 +199,8 @@ void screensaver_create(void)
|
||||
{
|
||||
/* create screensaver node. */
|
||||
if (!s_screensaver_node) {
|
||||
RECT rc = g_rcScr;
|
||||
s_screensaver_node = dskCreateTopZOrderNode(0, &rc);
|
||||
RECT rcScr = GetScreenRect();
|
||||
s_screensaver_node = dskCreateTopZOrderNode(0, &rcScr);
|
||||
dskSetTopForEver(0, s_screensaver_node, TRUE);
|
||||
screensaver_hide();
|
||||
}
|
||||
@@ -215,21 +217,23 @@ void screensaver_destroy(void)
|
||||
|
||||
static void screensaver_update(void)
|
||||
{
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
/* fixed size 200 * 99 */
|
||||
/* g_bitmap_minigui 200 * 55 at 0 * 44 */
|
||||
/* g_bitmap_feiman 118 * 41 at 61 * 0 */
|
||||
/* g_bitmap_fmsoft 50 * 11 at 4 * 30 */
|
||||
|
||||
int pos_x = (RECTW(g_rcScr) > 200)
|
||||
? (rand() % (RECTW(g_rcScr) - 200))
|
||||
int pos_x = (RECTW(rcScr) > 200)
|
||||
? (rand() % (RECTW(rcScr) - 200))
|
||||
: 0;
|
||||
int pos_y = (RECTH(g_rcScr) > 99)
|
||||
? (rand() % (RECTH(g_rcScr) - 99))
|
||||
int pos_y = (RECTH(rcScr) > 99)
|
||||
? (rand() % (RECTH(rcScr) - 99))
|
||||
: 0;
|
||||
|
||||
/* clean screen */
|
||||
SetBrushColor (HDC_SCREEN_SYS, PIXEL_black);
|
||||
FillBox (HDC_SCREEN_SYS, 0, 0, RECTW(g_rcScr), RECTH(g_rcScr));
|
||||
FillBox (HDC_SCREEN_SYS, 0, 0, RECTW(rcScr), RECTH(rcScr));
|
||||
|
||||
/* put picture to screen */
|
||||
/* g_bitmap_minigui */
|
||||
@@ -280,12 +284,15 @@ static int splash_bar_direction;
|
||||
#define SPLASH_BAR_LEFT 0
|
||||
#define SPLASH_BAR_RIGHT 1
|
||||
|
||||
static void splash_init(void) {
|
||||
static void splash_init(void)
|
||||
{
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
splash_bar_postion = 0;
|
||||
splash_bar_direction = SPLASH_BAR_RIGHT;
|
||||
|
||||
splash_adjust_x = (RECTW(g_rcScr) - SPLASH_W) / 2;
|
||||
splash_adjust_y = (RECTH(g_rcScr) - SPLASH_H)*3 / 5;
|
||||
splash_adjust_x = (RECTW(rcScr) - SPLASH_W) / 2;
|
||||
splash_adjust_y = (RECTH(rcScr) - SPLASH_H)*3 / 5;
|
||||
}
|
||||
|
||||
void splash_draw_framework (void)
|
||||
@@ -293,6 +300,7 @@ void splash_draw_framework (void)
|
||||
char text[64];
|
||||
RECT rc_text;
|
||||
PLOGFONT font, old_font;
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
gal_pixel old_brush = SetBrushColor(HDC_SCREEN_SYS, PIXEL_black);
|
||||
gal_pixel old_text = SetTextColor(HDC_SCREEN_SYS, RGB2Pixel(HDC_SCREEN_SYS, 0x32, 0xa0, 0xe4));
|
||||
@@ -304,7 +312,7 @@ void splash_draw_framework (void)
|
||||
8, 0);
|
||||
old_font = SelectFont(HDC_SCREEN_SYS, font);
|
||||
|
||||
FillBox(HDC_SCREEN_SYS, 0 ,0, RECTW(g_rcScr), RECTH(g_rcScr));
|
||||
FillBox(HDC_SCREEN_SYS, 0 ,0, RECTW(rcScr), RECTH(rcScr));
|
||||
|
||||
FillBoxWithBitmap(HDC_SCREEN_SYS, SPLASH_FEIMAN_X, SPLASH_FEIMAN_Y, 0, 0, &g_bitmap_feiman);
|
||||
FillBoxWithBitmap(HDC_SCREEN_SYS, SPLASH_FMSOFT_X, SPLASH_FMSOFT_Y, 0, 0, &g_bitmap_fmsoft);
|
||||
@@ -313,7 +321,7 @@ void splash_draw_framework (void)
|
||||
FillBoxWithBitmap(HDC_SCREEN_SYS, SPLASH_BAR_X, SPLASH_BAR_Y, 0, 0, &g_bitmap_progressbar);
|
||||
|
||||
memset(text, 0, sizeof(text));
|
||||
SetRect(&rc_text, SPLASH_ID_X, SPLASH_ID_Y, SPLASH_ID_X+SPLASH_ID_W, RECTH(g_rcScr));
|
||||
SetRect(&rc_text, SPLASH_ID_X, SPLASH_ID_Y, SPLASH_ID_X+SPLASH_ID_W, RECTH(rcScr));
|
||||
|
||||
#ifdef _MG_PRODUCTID
|
||||
int customer_id = license_get_customer_id();
|
||||
@@ -542,6 +550,10 @@ void license_destroy (void) {
|
||||
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
|
||||
void license_on_input(void)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
RECT rcScr = GetScreenRect();
|
||||
#endif
|
||||
|
||||
s_tick_last_input = GetTickCount();
|
||||
|
||||
if (screensaver_running == TRUE) {
|
||||
@@ -560,7 +572,7 @@ void license_on_input(void)
|
||||
#else
|
||||
screensaver_hide();
|
||||
#if defined(_MGRM_PROCESSES)
|
||||
dskRefreshAllClient (&g_rcScr);
|
||||
dskRefreshAllClient (&rcScr);
|
||||
#elif defined(_MGRM_STANDALONE)
|
||||
SendNotifyMessage (HWND_DESKTOP, MSG_PAINT, 0, 0);
|
||||
#else
|
||||
|
||||
@@ -416,7 +416,8 @@ static void BF533_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->update = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -147,7 +147,9 @@ static void COMMLCD_UpdateRects_Async (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->rc_dirty = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -47,7 +47,7 @@
|
||||
** $Id: em85xxyuv.c 8944 2007-12-29 08:29:16Z xwyan $
|
||||
**
|
||||
** em85xxyuv.c: NEWGAL driver for EM85xx YUV.
|
||||
**
|
||||
**
|
||||
** Copyright (C) 2007 Feynman Software.
|
||||
*/
|
||||
|
||||
@@ -99,9 +99,9 @@ union semun {
|
||||
#endif
|
||||
/* Initialization/Query functions */
|
||||
static int EM85XXYUV_VideoInit(_THIS, GAL_PixelFormat *vformat);
|
||||
static GAL_Rect **EM85XXYUV_ListModes(_THIS, GAL_PixelFormat *format,
|
||||
static GAL_Rect **EM85XXYUV_ListModes(_THIS, GAL_PixelFormat *format,
|
||||
Uint32 flags);
|
||||
static GAL_Surface *EM85XXYUV_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
static GAL_Surface *EM85XXYUV_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
int width, int height, int bpp, Uint32 flags);
|
||||
static int EM85XXYUV_SetColors(_THIS, int first, int count, GAL_Color *palette);
|
||||
static void EM85XXYUV_VideoQuit(_THIS);
|
||||
@@ -164,7 +164,7 @@ static __inline BYTE rgb2y (BYTE r, BYTE g, BYTE b)
|
||||
{
|
||||
DWORD y = 257*(DWORD)r + 504*(DWORD)g + 98*(DWORD)b + 16000;
|
||||
if (y > 255000)
|
||||
y = 255000;
|
||||
y = 255000;
|
||||
y >>= 10;
|
||||
return (BYTE)y;
|
||||
}
|
||||
@@ -173,7 +173,7 @@ static __inline BYTE rgb2u (BYTE r, BYTE g, BYTE b)
|
||||
{
|
||||
DWORD u = -148*(DWORD)r - 291*(DWORD)g + 449*(DWORD)b + 128000;
|
||||
if (u > 255000)
|
||||
u = 255000;
|
||||
u = 255000;
|
||||
u >>= 10;
|
||||
return (BYTE)u;
|
||||
}
|
||||
@@ -182,7 +182,7 @@ static __inline BYTE rgb2v (BYTE r, BYTE g, BYTE b)
|
||||
{
|
||||
DWORD v = 439*(DWORD)r - 368*(DWORD)g - 71*(DWORD)b + 128000;
|
||||
if (v > 255000)
|
||||
v = 255000;
|
||||
v = 255000;
|
||||
v >>= 10;
|
||||
return (BYTE)v;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ static YUV* init_rgb2yuv_map_16bit (void)
|
||||
|
||||
tmp = map;
|
||||
for (i = 0; i < 65536; i++) {
|
||||
RGB2YUV (((i & 0xF800) >> 8), ((i & 0x07E0) >> 3), ((i & 0x001F) << 3),
|
||||
RGB2YUV (((i & 0xF800) >> 8), ((i & 0x07E0) >> 3), ((i & 0x001F) << 3),
|
||||
&tmp->y, &tmp->u, &tmp->v);
|
||||
tmp++;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ static void transfer_yuv_frame (_THIS, int x, int y, int width, int height)
|
||||
int y_offset, uv_offset, y_xferlen, uv_xferlen, y_left, uv_left;
|
||||
BYTE* Y = plane_Y;
|
||||
BYTE* UV = plane_UV;
|
||||
|
||||
|
||||
#if 0
|
||||
Wnd_type Wnd;
|
||||
evYUVWriteParams_type yuv_param;
|
||||
@@ -316,7 +316,7 @@ static void transfer_yuv_frame (_THIS, int x, int y, int width, int height)
|
||||
yuv_param.wWidth = FRAME_WIDTH;
|
||||
yuv_param.wHeight = FRAME_HEIGHT;
|
||||
yuv_param.YUVFormat = YUV_420_UNPACKED;
|
||||
RUA_DECODER_SET_PROPERTY(h, VIDEO_SET, evYUVWriteParams,
|
||||
RUA_DECODER_SET_PROPERTY(h, VIDEO_SET, evYUVWriteParams,
|
||||
sizeof(yuv_param), &yuv_param);
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET, evSourceWindow, sizeof(Wnd), &Wnd);
|
||||
RUA_DECODER_CLEAR_SCREEN(h);
|
||||
@@ -330,7 +330,7 @@ static void transfer_yuv_frame (_THIS, int x, int y, int width, int height)
|
||||
* so we do a loop for the complete transfer
|
||||
*/
|
||||
|
||||
y_offset = 0;
|
||||
y_offset = 0;
|
||||
uv_offset = 0;
|
||||
y_left = FRAME_WIDTH * FRAME_HEIGHT;
|
||||
uv_left = FRAME_WIDTH * FRAME_HEIGHT / 2;
|
||||
@@ -347,16 +347,16 @@ static void transfer_yuv_frame (_THIS, int x, int y, int width, int height)
|
||||
/* do the transfer */
|
||||
f.Yaddr = y_offset;
|
||||
|
||||
/*
|
||||
* don't worry about the warning from the compiler here
|
||||
/*
|
||||
* don't worry about the warning from the compiler here
|
||||
* we know that this cast is safe
|
||||
*/
|
||||
f.pY = (DWORD *)Y;
|
||||
f.nYbytes = y_xferlen;
|
||||
f.UVaddr = uv_offset;
|
||||
|
||||
/*
|
||||
* don't worry about the warning from the compiler here
|
||||
/*
|
||||
* don't worry about the warning from the compiler here
|
||||
* we know that this cast is safe
|
||||
*/
|
||||
f.pUV = (DWORD *)UV;
|
||||
@@ -396,14 +396,14 @@ static int task_do_update (void* data)
|
||||
bound = this->hidden->update;
|
||||
round_rect_to_even (&bound);
|
||||
|
||||
convert2yuv (this, bound.left, bound.top,
|
||||
convert2yuv (this, bound.left, bound.top,
|
||||
RECTW (bound), RECTH (bound));
|
||||
this->hidden->dirty = FALSE;
|
||||
SetRect (&this->hidden->update, 0, 0, 0, 0);
|
||||
|
||||
update_unlock (this->hidden->lock);
|
||||
|
||||
transfer_yuv_frame (this, bound.left, bound.top,
|
||||
transfer_yuv_frame (this, bound.left, bound.top,
|
||||
RECTW (bound), RECTH (bound));
|
||||
}
|
||||
}
|
||||
@@ -515,7 +515,7 @@ static int EM85XXYUV_VideoInit(_THIS, GAL_PixelFormat *vformat)
|
||||
if (RUA_OSDFB_REFRESH (this->hidden->handle, &osdbuffer) != 0) {
|
||||
fprintf (stderr, "NEWGAL>EM85xxYUV: Error getting the OSD buffer.\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this->hidden->osd_buffer = osdbuffer.framebuffer;
|
||||
this->hidden->w = osdbuffer.width;
|
||||
@@ -524,7 +524,7 @@ static int EM85XXYUV_VideoInit(_THIS, GAL_PixelFormat *vformat)
|
||||
this->hidden->fb = osdbuffer.framebuffer + 8 + 1024;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* set the tv output to be ntsc */
|
||||
Wnd.x = 0;
|
||||
Wnd.y = 0;
|
||||
@@ -533,36 +533,36 @@ static int EM85XXYUV_VideoInit(_THIS, GAL_PixelFormat *vformat)
|
||||
TvStandard = evTvStandard_NTSC;
|
||||
TvOutputFormat = evTvOutputFormat_COMPOSITE;
|
||||
OutputDevice = evOutputDevice_TV;
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
evTvOutputFormat, sizeof(TvOutputFormat), &TvOutputFormat);
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
evTvStandard, sizeof(TvStandard), &TvStandard);
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
evOutputDevice, sizeof(OutputDevice), &OutputDevice);
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
evDestinationWindow, sizeof(Wnd), &Wnd);
|
||||
|
||||
yuv_param.wWidth = FRAME_WIDTH;
|
||||
yuv_param.wHeight = FRAME_HEIGHT;
|
||||
yuv_param.YUVFormat = YUV_420_UNPACKED;
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
evYUVWriteParams, sizeof(yuv_param), &yuv_param);
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, VIDEO_SET,
|
||||
evSourceWindow, sizeof(Wnd), &Wnd);
|
||||
RUA_DECODER_CLEAR_SCREEN (h);
|
||||
|
||||
#if 0
|
||||
/* Setup the flicker filter
|
||||
* XXX - its also set in the kernel module, but it seems not to work
|
||||
* very well.
|
||||
* We reset it here, so that the microcode as already seen an osd frame.
|
||||
* XXX - its also set in the kernel module, but it seems not to work
|
||||
* very well.
|
||||
* We reset it here, so that the microcode as already seen an osd frame.
|
||||
* 0 <= flicker <= 15
|
||||
*/
|
||||
flicker = 15;
|
||||
RUA_DECODER_SET_PROPERTY (this->hidden->handle,
|
||||
RUA_DECODER_SET_PROPERTY (this->hidden->handle,
|
||||
DECODER_SET, edecOsdFlicker, sizeof(flicker), &flicker);
|
||||
|
||||
/*
|
||||
/*
|
||||
* set the osd window destination
|
||||
* do not scale - just center the image
|
||||
*/
|
||||
@@ -570,7 +570,7 @@ static int EM85XXYUV_VideoInit(_THIS, GAL_PixelFormat *vformat)
|
||||
Wnd.y = (480 - osdbuffer.height) / 2;
|
||||
Wnd.w = osdbuffer.width;
|
||||
Wnd.h = osdbuffer.height;
|
||||
RUA_DECODER_SET_PROPERTY (h, OSD_SET,
|
||||
RUA_DECODER_SET_PROPERTY (h, OSD_SET,
|
||||
eOsdDestinationWindow, sizeof(Wnd), &Wnd);
|
||||
#endif
|
||||
|
||||
@@ -603,7 +603,7 @@ static GAL_Rect* modes [] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static GAL_Rect **EM85XXYUV_ListModes(_THIS, GAL_PixelFormat *format,
|
||||
static GAL_Rect **EM85XXYUV_ListModes(_THIS, GAL_PixelFormat *format,
|
||||
Uint32 flags)
|
||||
{
|
||||
if (format->BitsPerPixel == 16) {
|
||||
@@ -627,7 +627,7 @@ static GAL_Surface *EM85XXYUV_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
clone (task_do_update, stack_updater + 512,
|
||||
clone (task_do_update, stack_updater + 512,
|
||||
CLONE_VM | CLONE_FS | CLONE_FILES, this);
|
||||
|
||||
/* We're done */
|
||||
@@ -662,7 +662,7 @@ static void EM85XXYUV_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -671,7 +671,8 @@ static void EM85XXYUV_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->update = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
|
||||
@@ -481,7 +481,9 @@ static void MB93493_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->update = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
|
||||
+148
-146
File diff suppressed because it is too large
Load Diff
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -94,12 +94,12 @@
|
||||
}
|
||||
/* Initialization/Query functions */
|
||||
static int MLSHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat);
|
||||
static GAL_Rect **MLSHADOW_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
static GAL_Rect **MLSHADOW_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
Uint32 flags);
|
||||
static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
int width, int height, int bpp, Uint32 flags);
|
||||
static GAL_VideoDevice *MLSHADOW_CreateDevice(int devindex);
|
||||
static int MLSHADOW_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
static int MLSHADOW_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
GAL_Color *colors);
|
||||
static void MLSHADOW_VideoQuit (_THIS);
|
||||
static void MLSHADOW_UpdateRects (_THIS, int numrects, GAL_Rect *rects);
|
||||
@@ -112,7 +112,7 @@ static void MLSHADOW_DeleteDevice(GAL_VideoDevice *device);
|
||||
static int MLSHADOW_AllocHWSurface (_THIS, GAL_Surface *surface);
|
||||
static void MLSHADOW_FreeHWSurface (_THIS, GAL_Surface *surface);
|
||||
|
||||
static int MLSHADOW_SetSurfaceColors(GAL_Surface* surface,
|
||||
static int MLSHADOW_SetSurfaceColors(GAL_Surface* surface,
|
||||
int firstcolor, int ncolors, GAL_Color *colors);
|
||||
static int MLSHADOW_Available(void);
|
||||
|
||||
@@ -128,11 +128,11 @@ VideoBootStrap MLSHADOW_bootstrap = {
|
||||
};
|
||||
|
||||
/****************************/
|
||||
typedef struct __mlshadow_node
|
||||
typedef struct __mlshadow_node
|
||||
{
|
||||
list_t node;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
DWORD flags;
|
||||
RECT updaterect;
|
||||
GAL_Surface* shadow_surface;
|
||||
@@ -175,7 +175,7 @@ BOOL mlsEnableSlaveScreen (HDC dc_mls, BOOL enable)
|
||||
if(enable == TRUE) //bugfix...
|
||||
node->flags |= MLSF_ENABLED;
|
||||
else if(enable == FALSE)
|
||||
node->flags &= ~MLSF_ENABLED;
|
||||
node->flags &= ~MLSF_ENABLED;
|
||||
|
||||
pthread_mutex_unlock (&this->hidden->update_lock);
|
||||
|
||||
@@ -198,11 +198,11 @@ void mlshadow_show_list (_THIS)
|
||||
node = (mlshadow_node *)pos;
|
||||
fprintf(stderr, "\nstruct __mlshadow_node \n "
|
||||
"node = %p\n "
|
||||
"offset_x = %d\n "
|
||||
"offset_x = %d\n "
|
||||
"offset_y = %d\n "
|
||||
"flags = %d\n "
|
||||
"shadow_surface = %p\n",
|
||||
node, node->offset_x, node->offset_y,
|
||||
node, node->offset_x, node->offset_y,
|
||||
node->flags, node->shadow_surface);
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ BOOL GUIAPI mlsGetSlaveScreenInfo (HDC dc_mls, DWORD mask,int* offset_x, int* of
|
||||
if (node->shadow_surface == dc_HDC2PDC(dc_mls)->surface) {
|
||||
flag = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag){
|
||||
pthread_mutex_unlock (&this->hidden->update_lock);
|
||||
@@ -274,8 +274,8 @@ BOOL GUIAPI mlsGetSlaveScreenInfo (HDC dc_mls, DWORD mask,int* offset_x, int* of
|
||||
return flag;
|
||||
}
|
||||
|
||||
BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask,
|
||||
int offset_x, int offset_y, DWORD blend_flags,
|
||||
BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask,
|
||||
int offset_x, int offset_y, DWORD blend_flags,
|
||||
gal_pixel color_key, int alpha, int z_order)
|
||||
{
|
||||
list_t * pos;
|
||||
@@ -300,7 +300,7 @@ BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask,
|
||||
if (node->shadow_surface == dc_HDC2PDC(dc_mls)->surface) {
|
||||
flag = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag){
|
||||
@@ -315,7 +315,7 @@ BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask,
|
||||
rect.x = node->offset_x; rect.y = node->offset_y;
|
||||
rect.w = node->shadow_surface->w + rect.x;
|
||||
rect.h = node->shadow_surface->h + rect.y;
|
||||
/* bugfixed houhh 20071116, should update the surface's old rect
|
||||
/* bugfixed houhh 20071116, should update the surface's old rect
|
||||
* by update the master surface. before update surface, should be
|
||||
* set current surface's offset.
|
||||
*/
|
||||
@@ -333,9 +333,9 @@ BOOL GUIAPI mlsSetSlaveScreenInfo (HDC dc_mls, DWORD mask,
|
||||
|
||||
if (mask & MLS_INFOMASK_BLEND) {
|
||||
if ((blend_flags & MLS_BLENDMODE_COLORKEY) == MLS_BLENDMODE_COLORKEY) {
|
||||
GAL_SetColorKey (node->shadow_surface, GAL_SRCCOLORKEY, color_key);
|
||||
// node->flags |= MLSF_ALPHA;
|
||||
node->flags |= MLSF_COLORKEY; //bugfix...
|
||||
GAL_SetColorKey (node->shadow_surface, GAL_SRCCOLORKEY, color_key);
|
||||
// node->flags |= MLSF_ALPHA;
|
||||
node->flags |= MLSF_COLORKEY; //bugfix...
|
||||
}
|
||||
|
||||
if ((blend_flags & MLS_BLENDMODE_ALPHA) == MLS_BLENDMODE_ALPHA) {
|
||||
@@ -374,11 +374,11 @@ static mlshadow_node* get_node(_THIS, GAL_Surface* surface)
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* houhh 20071115
|
||||
* save the updaterect for each surface (master and slave surface).
|
||||
* GAL_Rect *rects's coordinate is relative slave surface.
|
||||
* the mlshadow_list's node is saved the updaterect that is relatived
|
||||
* the mlshadow_list's node is saved the updaterect that is relatived
|
||||
* the master surface, not himself slave surface.
|
||||
*/
|
||||
static void MLSHADOW_UpdateSurfaceRects (_THIS, GAL_Surface* surface, int numrects, GAL_Rect *rects)
|
||||
@@ -386,7 +386,7 @@ static void MLSHADOW_UpdateSurfaceRects (_THIS, GAL_Surface* surface, int numrec
|
||||
int i;
|
||||
RECT bound;
|
||||
mlshadow_node* pnode = NULL;
|
||||
if(surface && this){
|
||||
if(surface && this){
|
||||
pthread_mutex_lock (&this->hidden->update_lock);
|
||||
// bound = this->hidden->update;
|
||||
pnode = get_node(surface->video, surface);
|
||||
@@ -399,7 +399,7 @@ static void MLSHADOW_UpdateSurfaceRects (_THIS, GAL_Surface* surface, int numrec
|
||||
RECT rc;
|
||||
rects[i].x += pnode->offset_x;
|
||||
rects[i].y += pnode->offset_y;
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -407,10 +407,12 @@ static void MLSHADOW_UpdateSurfaceRects (_THIS, GAL_Surface* surface, int numrec
|
||||
GetBoundRect (&bound, &bound, &rc);
|
||||
}
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
/* bugfixed houhh 20071116, the surface's dirty_rect can not beyond it's rect */
|
||||
RECT rect = {0};
|
||||
SetRect(&rect, pnode->offset_x, pnode->offset_y,
|
||||
SetRect(&rect, pnode->offset_x, pnode->offset_y,
|
||||
surface->w + pnode->offset_x, surface->h + pnode->offset_y);
|
||||
if(IntersectRect (&bound, &bound, &rect)){
|
||||
pnode->updaterect = bound;
|
||||
@@ -432,7 +434,7 @@ static void MLSHADOW_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
bound = this->hidden->update;
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -440,7 +442,9 @@ static void MLSHADOW_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
GetBoundRect (&bound, &bound, &rc);
|
||||
}
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->update = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
@@ -502,7 +506,7 @@ static int MLSHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
char system_engine [LEN_ENGINE_NAME + 1];
|
||||
char double_buffer[20];
|
||||
GAL_PixelFormat real_vformat;
|
||||
|
||||
|
||||
/* houhh 20071116, if mlshadow is not the gal_engine, but call InitSlaveScreen. */
|
||||
if (GetMgEtcValue ("system", "gal_engine", system_engine, LEN_ENGINE_NAME) < 0) {
|
||||
return -1;
|
||||
@@ -511,14 +515,14 @@ static int MLSHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (this->hidden->_real_surface != NULL)
|
||||
if (this->hidden->_real_surface != NULL)
|
||||
return 0;
|
||||
|
||||
this->hidden->dirty = FALSE;
|
||||
SetRect (&this->hidden->update, 0, 0, 0, 0);
|
||||
pthread_mutex_init (&this->hidden->update_lock, NULL);
|
||||
|
||||
if (GetMgEtcValue (MLSHADOW_NAME, "real_engine",
|
||||
if (GetMgEtcValue (MLSHADOW_NAME, "real_engine",
|
||||
real_engine, LEN_ENGINE_NAME) < 0) {
|
||||
return -1;
|
||||
}
|
||||
@@ -530,35 +534,35 @@ static int MLSHADOW_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
}
|
||||
|
||||
memset (&real_vformat, 0, sizeof(real_vformat));
|
||||
if (this->hidden->_real_device->VideoInit (this->hidden->_real_device,
|
||||
if (this->hidden->_real_device->VideoInit (this->hidden->_real_device,
|
||||
&real_vformat) < 0 ) {
|
||||
return (-1);
|
||||
}
|
||||
|
||||
if (GetMgEtcValue (MLSHADOW_NAME, "def_bgcolor",
|
||||
if (GetMgEtcValue (MLSHADOW_NAME, "def_bgcolor",
|
||||
real_engine, LEN_ENGINE_NAME) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
this->hidden->_real_def_bgcolor = strtoul(real_engine, NULL, 0);
|
||||
if(this->hidden->_real_def_bgcolor > 0xffffff
|
||||
if(this->hidden->_real_def_bgcolor > 0xffffff
|
||||
|| this->hidden->_real_def_bgcolor < 0) {
|
||||
this->hidden->_real_def_bgcolor = 0;
|
||||
}
|
||||
|
||||
GetMgEtcValue (MLSHADOW_NAME, "double_buffer", double_buffer, LEN_ENGINE_NAME);
|
||||
GetMgEtcValue (MLSHADOW_NAME, "double_buffer", double_buffer, LEN_ENGINE_NAME);
|
||||
if(!strncmp(double_buffer, "enable", sizeof("enable"))) {
|
||||
this->hidden->swap_surface = malloc(sizeof(GAL_Surface));
|
||||
}
|
||||
|
||||
this->hidden->_real_surface = GAL_CreateRGBSurface (GAL_SWSURFACE,
|
||||
0, 0, real_vformat.BitsPerPixel, real_vformat.Rmask,
|
||||
this->hidden->_real_surface = GAL_CreateRGBSurface (GAL_SWSURFACE,
|
||||
0, 0, real_vformat.BitsPerPixel, real_vformat.Rmask,
|
||||
real_vformat.Gmask, real_vformat.Bmask, 0);
|
||||
|
||||
if (this->hidden->_real_surface == NULL ) {
|
||||
this->hidden->_real_device->free (this->hidden->_real_device);
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
this->hidden->_real_surface->video = this->hidden->_real_device;
|
||||
this->hidden->_real_device->info.vfmt = this->hidden->_real_surface->format;
|
||||
@@ -589,7 +593,7 @@ static void refresh_surface (_THIS, RECT* updaterect)
|
||||
RECT intersect_rect;
|
||||
GAL_Rect cache_rect;
|
||||
mlshadow_node* pnode = NULL, *pnode2 = NULL, *master_node = NULL;
|
||||
GAL_Rect src = {0}, dst = {0};
|
||||
GAL_Rect src = {0}, dst = {0};
|
||||
RECT* dirty_rect = NULL;
|
||||
RECT updatecache_rect = {0};
|
||||
|
||||
@@ -597,7 +601,7 @@ static void refresh_surface (_THIS, RECT* updaterect)
|
||||
updaterect = updaterect;
|
||||
|
||||
list_for_each (me, &this->hidden->_mlshadow_list) {
|
||||
pnode = list_entry (me, mlshadow_node, node);
|
||||
pnode = list_entry (me, mlshadow_node, node);
|
||||
if (pnode && pnode->shadow_surface) {
|
||||
dirty_rect = &pnode->updaterect;
|
||||
if(IsRectEmpty(dirty_rect))
|
||||
@@ -607,35 +611,35 @@ static void refresh_surface (_THIS, RECT* updaterect)
|
||||
cache_rect.w = RECTWP(dirty_rect);
|
||||
cache_rect.h = RECTHP(dirty_rect);
|
||||
|
||||
if (master_node->shadow_surface && (master_node->flags & MLSF_ALPHA)) {
|
||||
Uint32 color = this->hidden->_real_def_bgcolor;
|
||||
GAL_FillRect (this->hidden->_real_surface, &cache_rect,
|
||||
if (master_node->shadow_surface && (master_node->flags & MLSF_ALPHA)) {
|
||||
Uint32 color = this->hidden->_real_def_bgcolor;
|
||||
GAL_FillRect (this->hidden->_real_surface, &cache_rect,
|
||||
RGB2Pixel(HDC_SCREEN, color & 0xff, (color & 0xff00) >> 8, (color & 0xff0000) >> 16));
|
||||
}
|
||||
startnode = me->prev;
|
||||
if((pnode->flags & MLSF_ALPHA) || (pnode->flags & MLSF_COLORKEY)){
|
||||
startnode = &this->hidden->_mlshadow_list; // even surface is not enabled, it will affect other surface...
|
||||
}
|
||||
// list_for_each (me2, &this->hidden->_mlshadow_list) // refresh the all list's surface...
|
||||
}
|
||||
// list_for_each (me2, &this->hidden->_mlshadow_list) // refresh the all list's surface...
|
||||
list_for_each (me2, startnode){ // only refresh the surface zorder hight...
|
||||
if(me2 == &this->hidden->_mlshadow_list){ // have reach end...
|
||||
if(me2 == &this->hidden->_mlshadow_list){ // have reach end...
|
||||
break;
|
||||
}
|
||||
pnode2 = list_entry (me2, mlshadow_node, node);
|
||||
pnode2 = list_entry (me2, mlshadow_node, node);
|
||||
if(pnode2 && pnode2->shadow_surface){
|
||||
dst.x = pnode2->offset_x;
|
||||
dst.y = pnode2->offset_y;
|
||||
dst.w = pnode2->shadow_surface->w;
|
||||
dst.w = pnode2->shadow_surface->w;
|
||||
dst.h = pnode2->shadow_surface->h;
|
||||
src = dst;
|
||||
if (pnode2->flags & MLSF_ENABLED) {
|
||||
SetRect(&intersect_rect, dst.x, dst.y,
|
||||
SetRect(&intersect_rect, dst.x, dst.y,
|
||||
dst.x + dst.w, dst.y + dst.h);
|
||||
|
||||
if (IntersectRect (&intersect_rect, &intersect_rect, dirty_rect)) {
|
||||
dst.x = intersect_rect.left; dst.y = intersect_rect.top;
|
||||
dst.w = RECTW(intersect_rect);
|
||||
dst.h = RECTH(intersect_rect);
|
||||
dst.x = intersect_rect.left; dst.y = intersect_rect.top;
|
||||
dst.w = RECTW(intersect_rect);
|
||||
dst.h = RECTH(intersect_rect);
|
||||
|
||||
src.x = dst.x - src.x; src.y = dst.y - src.y;
|
||||
src.w = dst.w; src.h = dst.h;
|
||||
@@ -648,20 +652,20 @@ static void refresh_surface (_THIS, RECT* updaterect)
|
||||
else
|
||||
GetBoundRect (&updatecache_rect, &updatecache_rect, &intersect_rect);
|
||||
#if 0
|
||||
fprintf(stderr, "update_rect:(%d,%d)%d,%d,%d,%d\n", pnode2->offset_x, pnode2->offset_y,
|
||||
fprintf(stderr, "update_rect:(%d,%d)%d,%d,%d,%d\n", pnode2->offset_x, pnode2->offset_y,
|
||||
dirty_rect->left, dirty_rect->top, RECTWP(dirty_rect), RECTHP(dirty_rect));
|
||||
fprintf(stderr, "clip_rect:%d,%d,%d,%d\n", intersect_rect.left, intersect_rect.top,
|
||||
fprintf(stderr, "clip_rect:%d,%d,%d,%d\n", intersect_rect.left, intersect_rect.top,
|
||||
RECTW(intersect_rect), RECTH(intersect_rect));
|
||||
#endif
|
||||
}
|
||||
else{
|
||||
//fprintf(stderr, "no swap_surface:clip_rect:%d,%d,%d,%d\n", intersect_rect.left, intersect_rect.top,
|
||||
//fprintf(stderr, "no swap_surface:clip_rect:%d,%d,%d,%d\n", intersect_rect.left, intersect_rect.top,
|
||||
// RECTW(intersect_rect), RECTH(intersect_rect));
|
||||
GAL_BlitSurface (pnode2->shadow_surface, &src,
|
||||
this->hidden->_real_surface, &dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// if has enable the double_buffer, do real surface blit now...
|
||||
@@ -676,7 +680,7 @@ static void refresh_surface (_THIS, RECT* updaterect)
|
||||
|
||||
/* houhh 2007116, if has enable the double_buffer, do _real_surface blit here...
|
||||
* paint the cache surface to real surface...
|
||||
*/
|
||||
*/
|
||||
if(this->hidden->swap_surface && !IsRectEmpty(&updatecache_rect)){
|
||||
//static int cc = 0;
|
||||
GAL_Rect rect = {0};
|
||||
@@ -688,7 +692,7 @@ static void refresh_surface (_THIS, RECT* updaterect)
|
||||
this->hidden->_real_surface, &rect);
|
||||
//fprintf(stderr, "%d:cacherect:%d,%d,%d,%d\n", cc++, rect.x, rect.y, rect.w, rect.h);
|
||||
if(this->hidden->_real_device->UpdateRects){
|
||||
this->hidden->_real_device->UpdateRects (this->hidden->_real_device,
|
||||
this->hidden->_real_device->UpdateRects (this->hidden->_real_device,
|
||||
1, &rect);
|
||||
}
|
||||
updatecache_rect.right = updatecache_rect.left;
|
||||
@@ -700,7 +704,7 @@ static void* task_do_update (void* data)
|
||||
{
|
||||
_THIS;
|
||||
this = data;
|
||||
while (1) {
|
||||
while (1) {
|
||||
__mg_os_time_delay (20);
|
||||
if (this->hidden->dirty) {
|
||||
pthread_mutex_lock (&this->hidden->update_lock);
|
||||
@@ -732,13 +736,13 @@ static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
|
||||
if (list_empty (&this->hidden->_mlshadow_list)) {
|
||||
|
||||
/* create real surface. */
|
||||
if (GetMgEtcValue (MLSHADOW_NAME, "real_engine",
|
||||
/* create real surface. */
|
||||
if (GetMgEtcValue (MLSHADOW_NAME, "real_engine",
|
||||
real_engine, LEN_ENGINE_NAME) < 0) {
|
||||
fprintf (stderr, "NEWGAL>MLShadow: real_engine not defined.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (GetMgEtcValue (real_engine, "defaultmode", mode, LEN_MODE) < 0) {
|
||||
if (GetMgEtcValue ("system", "defaultmode", mode, LEN_MODE) < 0) {
|
||||
fprintf (stderr, "NEWGAL>MLShadow: default mode not defined.\n");
|
||||
@@ -750,10 +754,10 @@ static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
fprintf (stderr, "NEWGAL>MLShadow: bad real video mode parameter: %s.\n", mode);
|
||||
return NULL;
|
||||
}
|
||||
if (!(this->hidden->_real_surface
|
||||
if (!(this->hidden->_real_surface
|
||||
= this->hidden->_real_device->SetVideoMode (
|
||||
this->hidden->_real_device,
|
||||
this->hidden->_real_surface,
|
||||
this->hidden->_real_device,
|
||||
this->hidden->_real_surface,
|
||||
w, h, depth, GAL_HWPALETTE))) {
|
||||
fprintf (stderr, "NEWGAL>MLShadow: can not set video mode for real engine: %s.\n", mode);
|
||||
return NULL;
|
||||
@@ -761,8 +765,8 @@ static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
|
||||
/* houhh 20071116 bugfix, reset the surface w/h/pitch.
|
||||
* if the input width/height/bpp is diffirent with the real_device.
|
||||
*/
|
||||
|
||||
*/
|
||||
|
||||
current->w = w;
|
||||
current->h = h;
|
||||
current->pitch = w * ((depth + 7) / 8);
|
||||
@@ -778,13 +782,13 @@ static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
GAL_PixelFormat real_vformat = *this->hidden->_real_surface->format;
|
||||
__mg_bmp_compute_pitch(depth, (unsigned int)w, (unsigned int* )&swap_fb_pitch, 1);
|
||||
swap_fb_size = swap_fb_pitch * h;
|
||||
|
||||
/* bugfixed 20071116, This will result GAL_FreeSurface() error.
|
||||
|
||||
/* bugfixed 20071116, This will result GAL_FreeSurface() error.
|
||||
* memcpy(this->hidden->swap_surface, this->hidden->_real_surface.
|
||||
* sizeof(GAL_Surface));
|
||||
*/
|
||||
this->hidden->swap_surface = GAL_CreateRGBSurface (GAL_SWSURFACE, w, h,
|
||||
real_vformat.BitsPerPixel, real_vformat.Rmask,
|
||||
this->hidden->swap_surface = GAL_CreateRGBSurface (GAL_SWSURFACE, w, h,
|
||||
real_vformat.BitsPerPixel, real_vformat.Rmask,
|
||||
real_vformat.Gmask, real_vformat.Bmask, 0);
|
||||
if (this->hidden->swap_surface) {
|
||||
this->hidden->swap_surface->pixels = calloc(1, swap_fb_size);
|
||||
@@ -816,7 +820,7 @@ static GAL_Surface *MLSHADOW_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
pthread_attr_setstacksize (&new_attr, 512);
|
||||
#endif
|
||||
pthread_attr_setdetachstate (&new_attr, PTHREAD_CREATE_DETACHED);
|
||||
ret = pthread_create (&this->hidden->update_th,
|
||||
ret = pthread_create (&this->hidden->update_th,
|
||||
&new_attr, task_do_update, this);
|
||||
pthread_attr_destroy (&new_attr);
|
||||
}
|
||||
@@ -875,7 +879,7 @@ static void MLSHADOW_DeleteSurface (_THIS, GAL_Surface* surface)
|
||||
|
||||
if (!flag) {
|
||||
pthread_mutex_unlock (&this->hidden->update_lock);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
list_del(pos);
|
||||
if (list_empty(&this->hidden->_mlshadow_list)) {
|
||||
@@ -911,7 +915,7 @@ static void MLSHADOW_VideoQuit (_THIS)
|
||||
pthread_mutex_destroy (&this->hidden->update_lock);
|
||||
}
|
||||
|
||||
static GAL_Rect **MLSHADOW_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
static GAL_Rect **MLSHADOW_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
Uint32 flags)
|
||||
{
|
||||
return (GAL_Rect **) -1;
|
||||
@@ -933,8 +937,8 @@ static void MLSHADOW_FreeHWSurface (_THIS, GAL_Surface *surface)
|
||||
* SetSurfaceColors() is used to set surface's palette when need.
|
||||
* it is distinguish with the SetColors().
|
||||
* it will call SetColors() when set the master surface.
|
||||
*/
|
||||
static int MLSHADOW_SetSurfaceColors (GAL_Surface* surface,
|
||||
*/
|
||||
static int MLSHADOW_SetSurfaceColors (GAL_Surface* surface,
|
||||
int firstcolor, int ncolors, GAL_Color *colors)
|
||||
{
|
||||
list_t * pos, *back;
|
||||
@@ -983,10 +987,10 @@ static int MLSHADOW_SetSurfaceColors (GAL_Surface* surface,
|
||||
}
|
||||
|
||||
/* houhh 20071115.
|
||||
* if the surface is master surface, then set the master.
|
||||
* surface's palette and the _real_device's palette.
|
||||
* if the surface is master surface, then set the master.
|
||||
* surface's palette and the _real_device's palette.
|
||||
* set the swap_surface and real_surface and _real_device palette.
|
||||
*/
|
||||
*/
|
||||
static int MLSHADOW_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
GAL_Color *colors)
|
||||
{
|
||||
@@ -1008,7 +1012,7 @@ static int MLSHADOW_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
}
|
||||
}
|
||||
}
|
||||
this->hidden->_real_device->SetColors(this->hidden->_real_device,
|
||||
this->hidden->_real_device->SetColors(this->hidden->_real_device,
|
||||
firstcolor, ncolors, colors);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -68,8 +68,8 @@ static void* do_update (void* data)
|
||||
int timer = 0;
|
||||
int screen_w, screen_h;
|
||||
|
||||
screen_w =g_rcDesktop.right - g_rcDesktop.left;
|
||||
screen_h =g_rcDesktop.bottom - g_rcDesktop.top;
|
||||
screen_w =g_rcScr.right - g_rcScr.left;
|
||||
screen_h =g_rcScr.bottom - g_rcScr.top;
|
||||
|
||||
while (1) {
|
||||
usleep (10000);
|
||||
|
||||
+54
-52
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -69,12 +69,12 @@
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
|
||||
#include <errno.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/sem.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
union semun {
|
||||
int val; /* value for SETVAL */
|
||||
@@ -83,7 +83,7 @@ union semun {
|
||||
struct seminfo *__buf; /* buffer for IPC_INFO */
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "minigui.h"
|
||||
#include "newgal.h"
|
||||
@@ -99,8 +99,8 @@ union semun {
|
||||
#define _ROT_DIR_HFLIP 0x08
|
||||
#define _ROT_DIR_VFLIP 0x10
|
||||
|
||||
#define SHADOW_SHM_KEY 0x4D475344
|
||||
#define SHADOW_SEM_KEY 0x4D475344
|
||||
#define SHADOW_SHM_KEY 0x4D475344
|
||||
#define SHADOW_SEM_KEY 0x4D475344
|
||||
|
||||
#define LEN_ENGINE_NAME 10
|
||||
#define LEN_MODE 20
|
||||
@@ -173,7 +173,7 @@ again:
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static ShadowFBHeader* _shadowfbheader;
|
||||
|
||||
@@ -208,7 +208,7 @@ static void SHADOW_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -217,7 +217,9 @@ static void SHADOW_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
_shadowfbheader->dirty_rect = bound;
|
||||
_shadowfbheader->dirty = TRUE;
|
||||
}
|
||||
@@ -239,7 +241,7 @@ static GAL_VideoDevice *SHADOW_CreateDevice(int devindex)
|
||||
device = (GAL_VideoDevice *)malloc(sizeof(GAL_VideoDevice));
|
||||
if (device) {
|
||||
memset (device, 0, (sizeof *device));
|
||||
device->hidden = (struct GAL_PrivateVideoData *)
|
||||
device->hidden = (struct GAL_PrivateVideoData *)
|
||||
malloc (sizeof(struct GAL_PrivateVideoData));
|
||||
}
|
||||
if ( (device == NULL) || (device->hidden == NULL)) {
|
||||
@@ -312,13 +314,13 @@ static int RealEngine_GetInfo (RealFBInfo * realfb_info)
|
||||
real_device->VideoInit(realfb_info->real_device, &real_vformat);
|
||||
|
||||
real_device->screen = GAL_CreateRGBSurface (GAL_SWSURFACE,
|
||||
0, 0, real_vformat.BitsPerPixel, real_vformat.Rmask,
|
||||
0, 0, real_vformat.BitsPerPixel, real_vformat.Rmask,
|
||||
real_vformat.Gmask, real_vformat.Bmask, 0);
|
||||
|
||||
if (real_device->screen == NULL)
|
||||
fprintf (stderr, "NEWGAL>SHADOW: can't create screen of real engine.\n");
|
||||
fprintf (stderr, "NEWGAL>SHADOW: can't create screen of real engine.\n");
|
||||
|
||||
real_device->SetVideoMode(realfb_info->real_device,
|
||||
real_device->SetVideoMode(realfb_info->real_device,
|
||||
real_device->screen, w, h, depth, GAL_HWPALETTE);
|
||||
|
||||
realfb_info->height = real_device->screen->h;
|
||||
@@ -326,7 +328,7 @@ static int RealEngine_GetInfo (RealFBInfo * realfb_info)
|
||||
realfb_info->depth = real_device->screen->format->BitsPerPixel;
|
||||
realfb_info->fb = real_device->screen->pixels;
|
||||
realfb_info->pitch = real_device->screen->pitch;
|
||||
realfb_info->flags = 0;
|
||||
realfb_info->flags = 0;
|
||||
|
||||
if (realfb_info->depth <= 8)
|
||||
pitch_size = realfb_info->width;
|
||||
@@ -383,8 +385,8 @@ static int RealEngine_Release(RealFBInfo * realfb_info)
|
||||
if (realfb_info->flags == FLAG_REALFB_PREALLOC)
|
||||
realfb_info->fb = NULL;
|
||||
|
||||
video->VideoQuit (this);
|
||||
if (video->physpal)
|
||||
video->VideoQuit (this);
|
||||
if (video->physpal)
|
||||
{
|
||||
free (video->physpal->colors);
|
||||
free (video->physpal);
|
||||
@@ -398,14 +400,14 @@ static int RealEngine_Release(RealFBInfo * realfb_info)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int RealEngine_SetPalette(RealFBInfo *realfb_info, int firstcolor,
|
||||
static int RealEngine_SetPalette(RealFBInfo *realfb_info, int firstcolor,
|
||||
int ncolors, void *colors)
|
||||
{
|
||||
GAL_Color* pal_colors;
|
||||
pal_colors = (GAL_Color*)((char*)_shadowfbheader + _shadowfbheader->palette_offset);
|
||||
|
||||
if (colors != pal_colors + firstcolor)
|
||||
memcpy (pal_colors + firstcolor, colors, ncolors * sizeof(GAL_Color));
|
||||
memcpy (pal_colors + firstcolor, colors, ncolors * sizeof(GAL_Color));
|
||||
|
||||
return 1;
|
||||
}
|
||||
@@ -428,7 +430,7 @@ static int RealEngine_Init(void)
|
||||
fprintf(stderr, "NEWGAL>SHADOW: RealEngine_Init failure.\n");
|
||||
return -1;
|
||||
}
|
||||
memset(__mg_shadow_fb_ops, 0, sizeof(ShadowFBOps));
|
||||
memset(__mg_shadow_fb_ops, 0, sizeof(ShadowFBOps));
|
||||
|
||||
__mg_shadow_fb_ops->get_realfb_info = RealEngine_GetInfo;
|
||||
__mg_shadow_fb_ops->init = RealEngine_Init;
|
||||
@@ -507,7 +509,7 @@ static void* task_do_update (void* data)
|
||||
break;
|
||||
}
|
||||
|
||||
if (_shadowfbheader->dirty || _shadowfbheader->palette_changed)
|
||||
if (_shadowfbheader->dirty || _shadowfbheader->palette_changed)
|
||||
{
|
||||
#ifdef _MGRM_PROCESSES
|
||||
_sysvipc_sem_op (this->hidden->semid, 0, -1);
|
||||
@@ -521,25 +523,25 @@ static void* task_do_update (void* data)
|
||||
_shadowfbheader->ncolors,
|
||||
(GAL_Color*)((char*)_shadowfbheader + _shadowfbheader->palette_offset));
|
||||
SetRect (&_shadowfbheader->dirty_rect, 0, 0,
|
||||
_shadowfbheader->width, _shadowfbheader->height);
|
||||
_shadowfbheader->width, _shadowfbheader->height);
|
||||
}
|
||||
|
||||
__mg_shadow_fb_ops->refresh (_shadowfbheader,
|
||||
this->hidden->realfb_info, &(_shadowfbheader->dirty_rect));
|
||||
|
||||
if (this->hidden->realfb_info->flags & _ROT_DIR_CW) {
|
||||
_get_dst_rect_cw (&qvfb_rect, &(_shadowfbheader->dirty_rect),
|
||||
_get_dst_rect_cw (&qvfb_rect, &(_shadowfbheader->dirty_rect),
|
||||
this->hidden->realfb_info);
|
||||
}
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_CCW)
|
||||
_get_dst_rect_ccw (&qvfb_rect, &(_shadowfbheader->dirty_rect),
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_CCW)
|
||||
_get_dst_rect_ccw (&qvfb_rect, &(_shadowfbheader->dirty_rect),
|
||||
this->hidden->realfb_info);
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_HFLIP)
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_HFLIP)
|
||||
{
|
||||
qvfb_rect = _shadowfbheader->dirty_rect;
|
||||
_get_dst_rect_hflip (&qvfb_rect, this->hidden->realfb_info);
|
||||
}
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_VFLIP)
|
||||
else if (this->hidden->realfb_info->flags & _ROT_DIR_VFLIP)
|
||||
{
|
||||
qvfb_rect = _shadowfbheader->dirty_rect;
|
||||
_get_dst_rect_vflip (&qvfb_rect, this->hidden->realfb_info);
|
||||
@@ -682,7 +684,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
_shadowfbheader->info_size = size;
|
||||
|
||||
_shadowfbheader->dirty = FALSE;
|
||||
SetRect (&(_shadowfbheader->dirty_rect), 0, 0, 0, 0);
|
||||
SetRect (&(_shadowfbheader->dirty_rect), 0, 0, 0, 0);
|
||||
_shadowfbheader->palette_changed = FALSE;
|
||||
_shadowfbheader->palette_offset = sizeof(ShadowFBHeader);
|
||||
|
||||
@@ -692,11 +694,11 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
_shadowfbheader->fb_offset = _shadowfbheader->palette_offset;
|
||||
|
||||
if ((realfb_info->real_device))
|
||||
GAL_SetClipRect (real_device->screen, NULL);
|
||||
GAL_SetClipRect (real_device->screen, NULL);
|
||||
|
||||
if (!GAL_ReallocFormat (current, _shadowfbheader->depth,
|
||||
real_device->screen->format->Rmask,
|
||||
real_device->screen->format->Gmask,
|
||||
if (!GAL_ReallocFormat (current, _shadowfbheader->depth,
|
||||
real_device->screen->format->Rmask,
|
||||
real_device->screen->format->Gmask,
|
||||
real_device->screen->format->Bmask,
|
||||
real_device->screen->format->Amask))
|
||||
{
|
||||
@@ -725,7 +727,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
pthread_attr_setstacksize (&new_attr, 512);
|
||||
#endif
|
||||
pthread_attr_setdetachstate (&new_attr, PTHREAD_CREATE_DETACHED);
|
||||
ret = pthread_create (&this->hidden->update_th, &new_attr,
|
||||
ret = pthread_create (&this->hidden->update_th, &new_attr,
|
||||
task_do_update, this);
|
||||
pthread_attr_destroy (&new_attr);
|
||||
}
|
||||
@@ -772,7 +774,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
RealFBInfo * realfb_info;
|
||||
GAL_VideoDevice* real_device = NULL;
|
||||
realfb_info = NULL;
|
||||
shmid = 0;
|
||||
shmid = 0;
|
||||
size = 0;
|
||||
ret = 0;
|
||||
|
||||
@@ -839,7 +841,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
_shadowfbheader = (ShadowFBHeader *) shmat (shmid, 0, 0);
|
||||
_shadowfbheader = (ShadowFBHeader *) shmat (shmid, 0, 0);
|
||||
memcpy (_shadowfbheader, &shadowfbheader, sizeof (ShadowFBHeader));
|
||||
|
||||
this->hidden->realfb_info = realfb_info;
|
||||
@@ -849,13 +851,13 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
/* INIT Share Memory ShadowFBHeader */
|
||||
_shadowfbheader->info_size = size;
|
||||
_shadowfbheader->dirty = FALSE;
|
||||
SetRect (&(_shadowfbheader->dirty_rect), 0, 0, 0, 0);
|
||||
SetRect (&(_shadowfbheader->dirty_rect), 0, 0, 0, 0);
|
||||
_shadowfbheader->palette_changed = FALSE;
|
||||
_shadowfbheader->palette_offset = sizeof(ShadowFBHeader);
|
||||
|
||||
if(shadowfbheader.depth <= 8)
|
||||
_shadowfbheader->fb_offset = _shadowfbheader->palette_offset + PALETTE_SIZE;
|
||||
else
|
||||
else
|
||||
_shadowfbheader->fb_offset = _shadowfbheader->palette_offset;
|
||||
|
||||
_shadowfbheader->Rmask = real_device->screen->format->Rmask;
|
||||
@@ -864,7 +866,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
_shadowfbheader->Amask = real_device->screen->format->Amask;
|
||||
|
||||
if ((realfb_info->real_device))
|
||||
GAL_SetClipRect (real_device->screen, NULL);
|
||||
GAL_SetClipRect (real_device->screen, NULL);
|
||||
}
|
||||
else {
|
||||
shmid = shmget(SHADOW_SHM_KEY, 0, 0);
|
||||
@@ -872,8 +874,8 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
}
|
||||
|
||||
/* Allocate the new pixel format for the screen */
|
||||
if (!GAL_ReallocFormat (current, _shadowfbheader->depth,
|
||||
_shadowfbheader->Rmask, _shadowfbheader->Gmask,
|
||||
if (!GAL_ReallocFormat (current, _shadowfbheader->depth,
|
||||
_shadowfbheader->Rmask, _shadowfbheader->Gmask,
|
||||
_shadowfbheader->Bmask, _shadowfbheader->Amask)){
|
||||
if (__mg_shadow_fb_ops->release)
|
||||
__mg_shadow_fb_ops->release (realfb_info);
|
||||
@@ -902,7 +904,7 @@ static GAL_Surface *SHADOW_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
pthread_attr_setstacksize (&new_attr, 512);
|
||||
#endif
|
||||
pthread_attr_setdetachstate (&new_attr, PTHREAD_CREATE_DETACHED);
|
||||
ret = pthread_create (&this->hidden->update_th, &new_attr,
|
||||
ret = pthread_create (&this->hidden->update_th, &new_attr,
|
||||
task_do_update, this);
|
||||
pthread_attr_destroy (&new_attr);
|
||||
|
||||
@@ -944,7 +946,7 @@ static void SHADOW_VideoQuit (_THIS)
|
||||
|
||||
#endif
|
||||
|
||||
static GAL_Rect **SHADOW_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
static GAL_Rect **SHADOW_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
Uint32 flags)
|
||||
{
|
||||
return (GAL_Rect **) -1;
|
||||
@@ -961,15 +963,15 @@ static void SHADOW_FreeHWSurface (_THIS, GAL_Surface *surface)
|
||||
surface->pixels = NULL;
|
||||
}
|
||||
|
||||
static int SHADOW_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
static int SHADOW_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
GAL_Color *colors)
|
||||
{
|
||||
_shadowfbheader->firstcolor = firstcolor;
|
||||
_shadowfbheader->ncolors = ncolors;
|
||||
#ifdef _MGRM_PROCESSES
|
||||
if(mgIsServer) {
|
||||
#endif
|
||||
if ((__mg_shadow_fb_ops->set_palette != NULL)
|
||||
#endif
|
||||
if ((__mg_shadow_fb_ops->set_palette != NULL)
|
||||
&& (_shadowfbheader->depth <= 8)){
|
||||
__mg_shadow_fb_ops->set_palette(this->hidden->realfb_info,
|
||||
firstcolor, ncolors, colors);
|
||||
|
||||
+19
-17
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -70,7 +70,7 @@
|
||||
via the UNIX socket.
|
||||
|
||||
5. Note that the resolution of the virtual frame buffer should be sent by the server as
|
||||
the first message.
|
||||
the first message.
|
||||
|
||||
6. The server accepts the connection request from the MiniGUI client, gets the
|
||||
identifier of the shared memory sent by the client via the UNIX socket,
|
||||
@@ -313,7 +313,7 @@ static void USVFB_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
SetRect (&bound, 0, 0, 0, 0);
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -333,7 +333,7 @@ static void USVFB_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
bound = this->hidden->rc_dirty;
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -342,7 +342,9 @@ static void USVFB_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->rc_dirty = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
@@ -437,7 +439,7 @@ static GAL_Surface *USVFB_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
{
|
||||
Uint32 Rmask = 0, Gmask = 0, Bmask = 0, Amask = 0;
|
||||
int retval;
|
||||
struct _vfb_info li;
|
||||
struct _vfb_info li;
|
||||
memset (&li, 0, sizeof (struct _vfb_info));
|
||||
|
||||
if ((retval = a_getinfo (&li, width, height, bpp))) {
|
||||
@@ -510,7 +512,7 @@ static GAL_Surface *USVFB_SetVideoMode(_THIS, GAL_Surface *current,
|
||||
|
||||
pthread_attr_init (&new_attr);
|
||||
pthread_attr_setdetachstate (&new_attr, PTHREAD_CREATE_DETACHED);
|
||||
pthread_create (&this->hidden->update_th, &new_attr,
|
||||
pthread_create (&this->hidden->update_th, &new_attr,
|
||||
task_do_update, this);
|
||||
pthread_attr_destroy (&new_attr);
|
||||
pthread_mutex_init(&this->hidden->update_lock, NULL);
|
||||
@@ -537,7 +539,7 @@ static void USVFB_VideoQuit (_THIS)
|
||||
return;
|
||||
}
|
||||
|
||||
static GAL_Rect **USVFB_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
static GAL_Rect **USVFB_ListModes (_THIS, GAL_PixelFormat *format,
|
||||
Uint32 flags)
|
||||
{
|
||||
return (GAL_Rect **) -1;
|
||||
@@ -554,7 +556,7 @@ static void USVFB_FreeHWSurface (_THIS, GAL_Surface *surface)
|
||||
surface->pixels = NULL;
|
||||
}
|
||||
|
||||
static int USVFB_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
static int USVFB_SetColors (_THIS, int firstcolor, int ncolors,
|
||||
GAL_Color *colors)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** $Id: utpmcvideo-lite.c 8944 2007-12-29 08:29:16Z xwyan $
|
||||
**
|
||||
** This is NEWGAL engine for UTStarcom PocketMedia Center based-on
|
||||
**
|
||||
** This is NEWGAL engine for UTStarcom PocketMedia Center based-on
|
||||
** ARM7TDMI/uClinux/uClibc for MiniGUI-Lite.
|
||||
**
|
||||
** Copyright (C) 2004 ~ 2007 Feynman Software.
|
||||
@@ -126,7 +126,7 @@ static YCRCB* init_rgb2ycrcb_map_16bit (void)
|
||||
|
||||
tmp = map;
|
||||
for (i = 0; i < 65536; i++) {
|
||||
RGB2YCrCb (((i & 0xF800) >> 8), ((i & 0x07E0) >> 3), ((i & 0x001F) << 3),
|
||||
RGB2YCrCb (((i & 0xF800) >> 8), ((i & 0x07E0) >> 3), ((i & 0x001F) << 3),
|
||||
&tmp->yy, &tmp->cb, &tmp->cr);
|
||||
tmp++;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ static int task_do_update_16bit (void* data)
|
||||
else {
|
||||
dst_line [1] = yy;
|
||||
}
|
||||
|
||||
|
||||
src_line++;
|
||||
dst_line += 2;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ static int task_do_update_8bit (void* data)
|
||||
else {
|
||||
dst_line [1] = yy;
|
||||
}
|
||||
|
||||
|
||||
src_line++;
|
||||
dst_line += 2;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ static int UTPMC_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
this->hidden->fb_size = finfo.smem_len;
|
||||
this->hidden->fb = mmap (NULL, finfo.smem_len,
|
||||
PROT_READ | PROT_WRITE, 0, this->hidden->fd, 0);
|
||||
|
||||
|
||||
fprintf (stderr, "UTPMC NEWGAL Engine: mapped address: %p, length: %d.\n",
|
||||
this->hidden->fb, this->hidden->fb_size);
|
||||
|
||||
@@ -417,7 +417,7 @@ static int UTPMC_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
fprintf (stderr, "UTPMC NEWGAL Engine: can not open lock file: %s!\n", LOCK_FILE);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
read (this->hidden->fd_lock, &this->hidden->shadow_info, sizeof (UTPMC_SHADOWINFO*));
|
||||
|
||||
_MY_PRINTF ("Shadow info read from the lock file: %p\n", this->hidden->shadow_info);
|
||||
@@ -550,8 +550,8 @@ static GAL_Surface *UTPMC_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = clone ((bpp == 8) ? task_do_update_8bit : task_do_update_16bit,
|
||||
this->hidden->stack + _MY_STACK_SIZE,
|
||||
ret = clone ((bpp == 8) ? task_do_update_8bit : task_do_update_16bit,
|
||||
this->hidden->stack + _MY_STACK_SIZE,
|
||||
CLONE_VM | CLONE_FS | CLONE_FILES, this);
|
||||
|
||||
if (ret < 0) {
|
||||
@@ -593,7 +593,7 @@ static int UTPMC_SetColors (_THIS, int firstcolor, int ncolors, GAL_Color *color
|
||||
ycrcb += firstcolor;
|
||||
|
||||
for (i = 0; i < ncolors; i++) {
|
||||
RGB2YCrCb (colors->r, colors->g, colors->b,
|
||||
RGB2YCrCb (colors->r, colors->g, colors->b,
|
||||
&ycrcb->yy, &ycrcb->cb, &ycrcb->cr);
|
||||
ycrcb++;
|
||||
colors++;
|
||||
@@ -613,7 +613,7 @@ static void UTPMC_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -622,7 +622,8 @@ static void UTPMC_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->shadow_info->update = bound;
|
||||
this->hidden->shadow_info->dirty = TRUE;
|
||||
}
|
||||
@@ -652,4 +653,4 @@ static void UTPMC_VideoQuit (_THIS)
|
||||
}
|
||||
|
||||
#endif /* _MGGAL_UTPMC */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -11,42 +11,42 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
/*
|
||||
** $Id: utpmcvideo.c 8944 2007-12-29 08:29:16Z xwyan $
|
||||
**
|
||||
** This is NEWGAL engine for UTStarcom PocketMedia
|
||||
**
|
||||
** This is NEWGAL engine for UTStarcom PocketMedia
|
||||
** based-on ARM7TDMI + uClinux + uClibc.
|
||||
**
|
||||
** Copyright (C) 2004 ~ 2007 Feynman Software.
|
||||
@@ -146,7 +146,7 @@ static void get_ycrcb_16bit (RGB_YCRCB_MAP* map, Uint16 pixel, Uint8* yy, Uint8*
|
||||
}
|
||||
|
||||
/* not found, calculate YCrCb. */
|
||||
RGB2YCrCb (((pixel & 0xF800) >> 8), ((pixel & 0x07E0) >> 3), ((pixel & 0x001F) << 3),
|
||||
RGB2YCrCb (((pixel & 0xF800) >> 8), ((pixel & 0x07E0) >> 3), ((pixel & 0x001F) << 3),
|
||||
yy, cb, cr);
|
||||
|
||||
/* try to find a free pair and insert it to the cache line. */
|
||||
@@ -301,7 +301,7 @@ static YCRCB* init_rgb2ycrcb_map_16bit (void)
|
||||
|
||||
tmp = map;
|
||||
for (i = 0; i < 65536; i++) {
|
||||
RGB2YCrCb (((i & 0xF800) >> 8), ((i & 0x07E0) >> 3), ((i & 0x001F) << 3),
|
||||
RGB2YCrCb (((i & 0xF800) >> 8), ((i & 0x07E0) >> 3), ((i & 0x001F) << 3),
|
||||
&tmp->yy, &tmp->cb, &tmp->cr);
|
||||
tmp++;
|
||||
}
|
||||
@@ -344,7 +344,7 @@ static void* task_do_update_16bit (void* data)
|
||||
w = RECTW (bound);
|
||||
h = RECTH (bound);
|
||||
|
||||
src_buff = this->hidden->shadow
|
||||
src_buff = this->hidden->shadow
|
||||
+ this->screen->pitch * bound.top
|
||||
+ this->screen->format->BytesPerPixel * bound.left;
|
||||
|
||||
@@ -372,7 +372,7 @@ static void* task_do_update_16bit (void* data)
|
||||
else {
|
||||
dst_line [1] = yy;
|
||||
}
|
||||
|
||||
|
||||
src_line++;
|
||||
dst_line += 2;
|
||||
}
|
||||
@@ -418,7 +418,7 @@ static void* task_do_update_8bit (void* data)
|
||||
w = RECTW (bound);
|
||||
h = RECTH (bound);
|
||||
|
||||
src_buff = this->hidden->shadow
|
||||
src_buff = this->hidden->shadow
|
||||
+ this->screen->pitch * bound.top
|
||||
+ this->screen->format->BytesPerPixel * bound.left;
|
||||
|
||||
@@ -442,7 +442,7 @@ static void* task_do_update_8bit (void* data)
|
||||
else {
|
||||
dst_line [1] = yy;
|
||||
}
|
||||
|
||||
|
||||
src_line++;
|
||||
dst_line += 2;
|
||||
}
|
||||
@@ -544,7 +544,7 @@ static int UTPMC_VideoInit (_THIS, GAL_PixelFormat *vformat)
|
||||
this->hidden->fb_size = finfo.smem_len;
|
||||
this->hidden->fb = mmap (NULL, finfo.smem_len,
|
||||
PROT_READ | PROT_WRITE, 0, this->hidden->fd, 0);
|
||||
|
||||
|
||||
fprintf (stderr, "UTPMC NEWGAL Engine: mapped address: %p, length: %d.\n",
|
||||
this->hidden->fb, this->hidden->fb_size);
|
||||
#else
|
||||
@@ -677,7 +677,7 @@ static GAL_Surface *UTPMC_SetVideoMode (_THIS, GAL_Surface *current,
|
||||
pthread_attr_destroy (&new_attr);
|
||||
#endif
|
||||
|
||||
ret = pthread_create (&this->hidden->th, NULL,
|
||||
ret = pthread_create (&this->hidden->th, NULL,
|
||||
(bpp == 8) ? task_do_update_8bit : task_do_update_16bit, this);
|
||||
|
||||
if (ret != 0) {
|
||||
@@ -718,7 +718,7 @@ static int UTPMC_SetColors (_THIS, int firstcolor, int ncolors, GAL_Color *color
|
||||
ycrcb += firstcolor;
|
||||
|
||||
for (i = 0; i < ncolors; i++) {
|
||||
RGB2YCrCb (colors->r, colors->g, colors->b,
|
||||
RGB2YCrCb (colors->r, colors->g, colors->b,
|
||||
&ycrcb->yy, &ycrcb->cb, &ycrcb->cr);
|
||||
ycrcb++;
|
||||
colors++;
|
||||
@@ -738,7 +738,7 @@ static void UTPMC_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
for (i = 0; i < numrects; i++) {
|
||||
RECT rc;
|
||||
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
SetRect (&rc, rects[i].x, rects[i].y,
|
||||
rects[i].x + rects[i].w, rects[i].y + rects[i].h);
|
||||
if (IsRectEmpty (&bound))
|
||||
bound = rc;
|
||||
@@ -747,7 +747,8 @@ static void UTPMC_UpdateRects (_THIS, int numrects, GAL_Rect *rects)
|
||||
}
|
||||
|
||||
if (!IsRectEmpty (&bound)) {
|
||||
if (IntersectRect (&bound, &bound, &g_rcScr)) {
|
||||
RECT rcScr = GetScreenRect();
|
||||
if (IntersectRect (&bound, &bound, &rcScr)) {
|
||||
this->hidden->update = bound;
|
||||
this->hidden->dirty = TRUE;
|
||||
}
|
||||
|
||||
+1
-1
@@ -503,7 +503,7 @@ static int GAL_GetVideoMode (int *w, int *h, int *BitsPerPixel, Uint32 flags)
|
||||
return(supported);
|
||||
}
|
||||
|
||||
/* This should probably go somewhere else -- like GAL_surface.c */
|
||||
/* This should probably go somewhere else -- like surface.c */
|
||||
static void GAL_ClearSurface(GAL_Surface *surface)
|
||||
{
|
||||
Uint32 black;
|
||||
|
||||
+6
-4
@@ -207,18 +207,20 @@ BOOL mg_InitScreenDC (void* surface)
|
||||
|
||||
void mg_TerminateScreenDC (void)
|
||||
{
|
||||
SelectClipRect (HDC_SCREEN, &g_rcScr);
|
||||
RECT rcScr = GetScreenRect ();
|
||||
|
||||
SelectClipRect (HDC_SCREEN, &rcScr);
|
||||
SetBrushColor (HDC_SCREEN, 0);
|
||||
#ifdef _MGRM_PROCESSES
|
||||
if (mgIsServer)
|
||||
#endif
|
||||
FillBox (HDC_SCREEN, g_rcScr.left, g_rcScr.top,
|
||||
g_rcScr.right, g_rcScr.bottom);
|
||||
FillBox (HDC_SCREEN, rcScr.left, rcScr.top,
|
||||
rcScr.right, rcScr.bottom);
|
||||
|
||||
if (__mg_screen_dc.alpha_pixel_format)
|
||||
free (__mg_screen_dc.alpha_pixel_format);
|
||||
|
||||
SelectClipRect (HDC_SCREEN_SYS, &g_rcScr);
|
||||
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
|
||||
if (__mg_screen_sys_dc.alpha_pixel_format)
|
||||
free (__mg_screen_sys_dc.alpha_pixel_format);
|
||||
|
||||
|
||||
+13
-13
@@ -11,35 +11,35 @@
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* This file is part of MiniGUI, a mature cross-platform windowing
|
||||
* and Graphics User Interface (GUI) support system for embedded systems
|
||||
* and smart IoT devices.
|
||||
*
|
||||
*
|
||||
* Copyright (C) 2002~2018, Beijing FMSoft Technologies Co., Ltd.
|
||||
* Copyright (C) 1998~2002, WEI Yongming
|
||||
*
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*
|
||||
* Or,
|
||||
*
|
||||
*
|
||||
* As this program is a library, any link to this program must follow
|
||||
* GNU General Public License version 3 (GPLv3). If you cannot accept
|
||||
* GPLv3, you need to be licensed from FMSoft.
|
||||
*
|
||||
*
|
||||
* If you have got a commercial license of this program, please use it
|
||||
* under the terms and conditions of the commercial license.
|
||||
*
|
||||
*
|
||||
* For more information about the commercial license, please refer to
|
||||
* <http://www.minigui.com/blog/minigui-licensing-policy/>.
|
||||
*/
|
||||
@@ -68,11 +68,11 @@
|
||||
#ifdef _MGMISC_SAVESCREEN
|
||||
BOOL GUIAPI SaveScreenRectContent (const RECT* rc, const char* filename)
|
||||
{
|
||||
RECT rcWin;
|
||||
RECT rcWin, rcScr = GetScreenRect();
|
||||
BITMAP bitmap;
|
||||
int save_ret;
|
||||
|
||||
if (!IntersectRect (&rcWin, rc, &g_rcScr))
|
||||
if (!IntersectRect (&rcWin, rc, &rcScr))
|
||||
return FALSE;
|
||||
|
||||
bitmap.bmWidth = RECTW (rcWin);
|
||||
@@ -84,7 +84,7 @@ BOOL GUIAPI SaveScreenRectContent (const RECT* rc, const char* filename)
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
bitmap.bmBits = NULL;
|
||||
GetBitmapFromDC (HDC_SCREEN, rcWin.left, rcWin.top,
|
||||
RECTW (rcWin), RECTH (rcWin), &bitmap);
|
||||
@@ -95,7 +95,7 @@ BOOL GUIAPI SaveScreenRectContent (const RECT* rc, const char* filename)
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
save_ret = SaveBitmap (HDC_SCREEN, &bitmap, filename);
|
||||
free (bitmap.bmBits);
|
||||
return (save_ret == 0);
|
||||
|
||||
+3
-1
@@ -579,7 +579,9 @@ void GUIAPI UpdateTopmostLayer (const RECT* dirty_rc)
|
||||
|
||||
if (dirty_rc) {
|
||||
RECT eff_rc;
|
||||
IntersectRect (&eff_rc, dirty_rc, &g_rcScr);
|
||||
RECT rcScr = GetScreenRect();
|
||||
|
||||
IntersectRect (&eff_rc, dirty_rc, &rcScr);
|
||||
msg.wParam = MAKELONG (eff_rc.left, eff_rc.top);
|
||||
msg.lParam = MAKELONG (eff_rc.right, eff_rc.bottom);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user