mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-06 02:01:50 +08:00
New APIs: GetWindowSurfaceBufferFD() and CreateMemDCFromSurfaceBufferFD() for compositing schema.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
# Release Notes
|
||||
|
||||
- [Version 5.2.0](#version-520)
|
||||
+ [What's new in version 5.2.0](#whats-new-in-version-520)
|
||||
- [Version 5.0.13](#version-5013)
|
||||
+ [What's new in version 5.0.13](#whats-new-in-version-5013)
|
||||
- [Version 5.0.12](#version-5012)
|
||||
@@ -32,6 +34,17 @@
|
||||
+ [Changes leading to incompatibility](#changes-leading-to-incompatibility)
|
||||
+ [Deprecated APIs](#deprecated-apis)
|
||||
|
||||
## Version 5.2.0
|
||||
|
||||
On Nov. 30, 2023, FMSoft announces the availability of MiniGUI 5.2.0,
|
||||
which is an mainline release with some major enhancements:
|
||||
|
||||
* ENHANCEMENTS:
|
||||
- Optimize NEWGAL engines: `shadow`, `drm`, and `fbcon` for large resolution.
|
||||
- New APIs: `GetWindowSurfaceBufferFD()` and `CreateMemDCFromSurfaceBufferFD()` for compositing schema.
|
||||
* CHANGES:
|
||||
- The operations for DRM userland driver changed.
|
||||
|
||||
## Version 5.0.13
|
||||
|
||||
On Aug. 31, 2023, FMSoft announces the availability of MiniGUI 5.0.13,
|
||||
|
||||
@@ -1704,6 +1704,27 @@ MG_EXPORT BOOL GUIAPI IsScreenDC (HDC hdc);
|
||||
*/
|
||||
MG_EXPORT BOOL GUIAPI IsWindowDC (HDC hdc);
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
/**
|
||||
* \fn HDC GUIAPI CreateMemDCFromSurfaceBufferFD (int fd);
|
||||
* \brief Creates a memory DC from a file descriptor of a surface buffer.
|
||||
*
|
||||
* This function creates a memory DC from the specified file descriptor \a fd,
|
||||
* which represents a surface buffer.
|
||||
*
|
||||
* \param fd The file descriptor which represents a surface buffer.
|
||||
*
|
||||
* \return The handle to a new memory DC, HDC_INVALID indicates an error.
|
||||
*
|
||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||
*
|
||||
* \sa GetWindowSurfaceBufferFD
|
||||
*
|
||||
* Since 5.0.13
|
||||
*/
|
||||
MG_EXPORT HDC GUIAPI CreateMemDCFromSurfaceBufferFD (int fd);
|
||||
#endif /* _MGSCHEMA_COMPOSITING */
|
||||
|
||||
/**
|
||||
* \fn HDC GUIAPI CreateMemDCEx (int width, int height, int depth, DWORD flags, \
|
||||
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask,
|
||||
|
||||
@@ -7237,6 +7237,29 @@ MG_EXPORT BOOL GUIAPI SetMainWindowGestureFlags (HWND hWnd, DWORD dwFlags);
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
|
||||
/**
|
||||
* \fn int GUIAPI GetWindowSurfaceBufferFD (HWND hwnd)
|
||||
* \brief Gets the file descriptor of the surface buffer for a window or
|
||||
* the main window it locates.
|
||||
*
|
||||
* This function gets the file descriptor of the surface buffer for
|
||||
* the specified window if it is a main window or the main window it locates.
|
||||
* Note that if the window is a control that has the style `WS_EX_CTRLASMAINWIN`,
|
||||
* the window will have a separate surface buffer.
|
||||
*
|
||||
* \param hwnd The handle to the window.
|
||||
*
|
||||
* \return An integer larger than or equal to 0 for a valid file descriptor,
|
||||
* otherwise a negative value.
|
||||
*
|
||||
* \note This function only available when _MGSCHEMA_COMPOSITING is defined.
|
||||
*
|
||||
* \sa CreateMemDCFromSurfaceBufferFD
|
||||
*
|
||||
* Since 5.0.13
|
||||
*/
|
||||
MG_EXPORT int GUIAPI GetWindowSurfaceBufferFD (HWND hWnd);
|
||||
|
||||
/**
|
||||
* \fn BOOL GUIAPI SetMainWindowCompositing (HWND hWnd,
|
||||
int type, DWORD arg)
|
||||
|
||||
@@ -6066,6 +6066,19 @@ error:
|
||||
return HWND_INVALID;
|
||||
}
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
int GUIAPI GetWindowSurfaceBufferFD (HWND hWnd)
|
||||
{
|
||||
MG_CHECK_RET (MG_IS_APP_WINDOW (hWnd), -1);
|
||||
|
||||
PMAINWIN pWin = (PMAINWIN)hWnd;
|
||||
if (pWin->surf->shared_header)
|
||||
return pWin->surf->shared_header->fd;
|
||||
|
||||
return -1;
|
||||
}
|
||||
#endif /* _MGSCHEMA_COMPOSITING */
|
||||
|
||||
BOOL GUIAPI DestroyWindow (HWND hWnd)
|
||||
{
|
||||
PCONTROL pCtrl;
|
||||
|
||||
@@ -3391,6 +3391,29 @@ struct GAL_Surface* GetSurfaceFromDC (HDC hdc)
|
||||
return pdc->surface;
|
||||
}
|
||||
|
||||
#ifdef _MGSCHEMA_COMPOSITING
|
||||
HDC GUIAPI CreateMemDCFromSurfaceBufferFD (int fd)
|
||||
{
|
||||
HDC memdc = HDC_INVALID;
|
||||
GAL_Surface* surf;
|
||||
|
||||
surf = GAL_AttachSharedRGBSurface (fd, 0, GAL_HWSURFACE, TRUE);
|
||||
if (surf) {
|
||||
memdc = CreateMemDCFromSurface (surf);
|
||||
if (memdc == HDC_INVALID) {
|
||||
GAL_FreeSurface(surf);
|
||||
|
||||
_ERR_PRINTF("failed to create memory dc from surface: %p\n", surf);
|
||||
}
|
||||
}
|
||||
else {
|
||||
_ERR_PRINTF("failed to attach to surface buffer via fd: %d\n", fd);
|
||||
}
|
||||
|
||||
return memdc;
|
||||
}
|
||||
#endif /* _MGSCHEMA_COMPOSITING */
|
||||
|
||||
HDC GUIAPI CreateSubMemDC (HDC parent, int off_x, int off_y,
|
||||
int width, int height, BOOL comp_to_parent)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user