Commit b8901c3e authored by Jake Petroules's avatar Jake Petroules Committed by The Qt Project
Browse files

Add fromHRGN function.


Change-Id: Iae007306c4d75f650dcd0e319c4d553816e866f3
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
Showing with 30 additions and 0 deletions
...@@ -207,6 +207,34 @@ HRGN QWinExtras::toHRGN(const QRegion &region) ...@@ -207,6 +207,34 @@ HRGN QWinExtras::toHRGN(const QRegion &region)
return resultRgn; return resultRgn;
} }
/*!
\since 5.2
Returns a QRegion that is equivalent to the given \a hrgn.
*/
QRegion QWinExtras::fromHRGN(HRGN hrgn)
{
DWORD regionDataSize = GetRegionData(hrgn, 0, NULL);
if (regionDataSize == 0)
return QRegion();
LPRGNDATA regionData = (LPRGNDATA)malloc(regionDataSize);
if (!regionData)
return QRegion();
QRegion region;
if (GetRegionData(hrgn, regionDataSize, regionData) == regionDataSize) {
LPRECT pRect = (LPRECT)regionData->Buffer;
for (DWORD i = 0; i < regionData->rdh.nCount; ++i)
region += QRect(pRect[i].left, pRect[i].top,
pRect[i].right - pRect[i].left,
pRect[i].bottom - pRect[i].top);
}
free(regionData);
return region;
}
/*! /*!
\since 5.2 \since 5.2
......
...@@ -77,6 +77,7 @@ HICON Q_WINEXTRAS_EXPORT toHICON(const QPixmap &p); ...@@ -77,6 +77,7 @@ HICON Q_WINEXTRAS_EXPORT toHICON(const QPixmap &p);
QImage Q_WINEXTRAS_EXPORT imageFromHBITMAP(HDC hdc, HBITMAP bitmap, int width, int height); QImage Q_WINEXTRAS_EXPORT imageFromHBITMAP(HDC hdc, HBITMAP bitmap, int width, int height);
QPixmap Q_WINEXTRAS_EXPORT fromHICON(HICON icon); QPixmap Q_WINEXTRAS_EXPORT fromHICON(HICON icon);
HRGN Q_WINEXTRAS_EXPORT toHRGN(const QRegion &region); HRGN Q_WINEXTRAS_EXPORT toHRGN(const QRegion &region);
QRegion Q_WINEXTRAS_EXPORT fromHRGN(HRGN hrgn);
QString Q_WINEXTRAS_EXPORT stringFromHresult(HRESULT hresult); QString Q_WINEXTRAS_EXPORT stringFromHresult(HRESULT hresult);
QString Q_WINEXTRAS_EXPORT errorStringFromHresult(HRESULT hresult); QString Q_WINEXTRAS_EXPORT errorStringFromHresult(HRESULT hresult);
...@@ -252,6 +253,7 @@ HICON toHICON(const QPixmap &p); ...@@ -252,6 +253,7 @@ HICON toHICON(const QPixmap &p);
QImage imageFromHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h); QImage imageFromHBITMAP(HDC hdc, HBITMAP bitmap, int w, int h);
QPixmap fromHICON(HICON icon); QPixmap fromHICON(HICON icon);
HRGN toHRGN(const QRegion &region); HRGN toHRGN(const QRegion &region);
QRegion fromHRGN(HRGN hrgn);
QString stringFromHresult(HRESULT hresult); QString stringFromHresult(HRESULT hresult);
QString errorStringFromHresult(HRESULT hresult); QString errorStringFromHresult(HRESULT hresult);
QColor colorizationColor(bool *opaqueBlend = 0); QColor colorizationColor(bool *opaqueBlend = 0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment