Cleanup win32 code.
This commit is contained in:
parent
2d5262c511
commit
009ecbccf5
5 changed files with 131 additions and 77 deletions
|
@ -80,17 +80,16 @@ android {
|
||||||
sourceCompatibility = '1.8'
|
sourceCompatibility = '1.8'
|
||||||
targetCompatibility = '1.8'
|
targetCompatibility = '1.8'
|
||||||
}
|
}
|
||||||
ndkVersion '22.1.7171670'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
|
||||||
implementation 'androidx.preference:preference:1.1.1'
|
implementation 'androidx.preference:preference:1.1.1'
|
||||||
implementation 'com.google.android.material:material:1.2.1'
|
implementation 'com.google.android.material:material:1.4.0'
|
||||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||||
testImplementation 'junit:junit:4.13.1'
|
testImplementation 'junit:junit:4.13.1'
|
||||||
androidTestImplementation 'androidx.test:runner:1.3.0'
|
androidTestImplementation 'androidx.test:runner:1.4.0'
|
||||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||||
}
|
}
|
||||||
|
|
|
@ -668,10 +668,6 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileNew(JNIEnv *
|
||||||
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
||||||
|
|
||||||
if(result) {
|
if(result) {
|
||||||
if(hLcdDC && hLcdDC->selectedBitmap) {
|
|
||||||
hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight = -abs(hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainViewResizeCallback(nBackgroundW, nBackgroundH);
|
mainViewResizeCallback(nBackgroundW, nBackgroundH);
|
||||||
draw();
|
draw();
|
||||||
|
|
||||||
|
@ -718,11 +714,6 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onFileOpen(JNIEnv
|
||||||
}
|
}
|
||||||
BOOL result = OpenDocument(szBufferFilename);
|
BOOL result = OpenDocument(szBufferFilename);
|
||||||
if(pbyRomBackup) pbyRomBackup = NULL;
|
if(pbyRomBackup) pbyRomBackup = NULL;
|
||||||
if (result) {
|
|
||||||
if(hLcdDC && hLcdDC->selectedBitmap) {
|
|
||||||
hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight = -abs(hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
||||||
mainViewResizeCallback(nBackgroundW, nBackgroundH);
|
mainViewResizeCallback(nBackgroundW, nBackgroundH);
|
||||||
if(result) {
|
if(result) {
|
||||||
|
@ -1069,10 +1060,6 @@ JNIEXPORT jint JNICALL Java_org_emulator_calculator_NativeLib_onViewScript(JNIEn
|
||||||
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
chooseCurrentKmlMode = ChooseKmlMode_UNKNOWN;
|
||||||
|
|
||||||
if(bSucc) {
|
if(bSucc) {
|
||||||
if(hLcdDC && hLcdDC->selectedBitmap) {
|
|
||||||
hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight = -abs(hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
mainViewResizeCallback(nBackgroundW, nBackgroundH);
|
mainViewResizeCallback(nBackgroundW, nBackgroundH);
|
||||||
draw();
|
draw();
|
||||||
if (Chipset.wRomCrc != wRomCrc) // ROM changed
|
if (Chipset.wRomCrc != wRomCrc) // ROM changed
|
||||||
|
@ -1102,9 +1089,6 @@ JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupSave(JNIEn
|
||||||
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupRestore(JNIEnv *env, jobject thisz) {
|
JNIEXPORT void JNICALL Java_org_emulator_calculator_NativeLib_onBackupRestore(JNIEnv *env, jobject thisz) {
|
||||||
SwitchToState(SM_INVALID);
|
SwitchToState(SM_INVALID);
|
||||||
RestoreBackup();
|
RestoreBackup();
|
||||||
if(hLcdDC && hLcdDC->selectedBitmap) {
|
|
||||||
hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight = -abs(hLcdDC->selectedBitmap->bitmapInfoHeader->biHeight);
|
|
||||||
}
|
|
||||||
if (pbyRom) SwitchToState(SM_RUN);
|
if (pbyRom) SwitchToState(SM_RUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
extern JavaVM *java_machine;
|
extern JavaVM *java_machine;
|
||||||
extern jobject bitmapMainScreen;
|
extern jobject bitmapMainScreen;
|
||||||
extern AndroidBitmapInfo androidBitmapInfo;
|
extern AndroidBitmapInfo androidBitmapInfo;
|
||||||
|
//extern RECT mainViewRectangleToUpdate;
|
||||||
|
|
||||||
extern HANDLE hWnd;
|
extern HANDLE hWnd;
|
||||||
extern LPTSTR szTitle;
|
extern LPTSTR szTitle;
|
||||||
|
@ -1737,7 +1738,7 @@ BOOL DeleteMenu(HMENU hMenu, UINT uPosition, UINT uFlags) { return FALSE; }
|
||||||
BOOL InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem) { return FALSE; }
|
BOOL InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNewItem, LPCTSTR lpNewItem) { return FALSE; }
|
||||||
|
|
||||||
BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) { return 0; }
|
BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags) { return 0; }
|
||||||
BOOL IsRectEmpty(CONST RECT *lprc) { return 0; }
|
|
||||||
BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt) {
|
BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt) {
|
||||||
if(lppt) {
|
if(lppt) {
|
||||||
lppt->x = hdc->windowOriginX;
|
lppt->x = hdc->windowOriginX;
|
||||||
|
@ -1757,21 +1758,21 @@ HGDIOBJ SelectObject(HDC hdc, HGDIOBJ h) {
|
||||||
case HGDIOBJ_TYPE_BRUSH: {
|
case HGDIOBJ_TYPE_BRUSH: {
|
||||||
HBRUSH oldSelectedBrushColor = hdc->selectedBrushColor;
|
HBRUSH oldSelectedBrushColor = hdc->selectedBrushColor;
|
||||||
hdc->selectedBrushColor = h;
|
hdc->selectedBrushColor = h;
|
||||||
return oldSelectedBrushColor; //h;
|
return oldSelectedBrushColor;
|
||||||
}
|
}
|
||||||
case HGDIOBJ_TYPE_FONT:
|
case HGDIOBJ_TYPE_FONT:
|
||||||
break;
|
break;
|
||||||
case HGDIOBJ_TYPE_BITMAP: {
|
case HGDIOBJ_TYPE_BITMAP: {
|
||||||
//HBITMAP oldSelectedBitmap = hdc->selectedBitmap;
|
HBITMAP oldSelectedBitmap = hdc->selectedBitmap;
|
||||||
hdc->selectedBitmap = h;
|
hdc->selectedBitmap = h;
|
||||||
return h; //oldSelectedBitmap;
|
return oldSelectedBitmap;
|
||||||
}
|
}
|
||||||
case HGDIOBJ_TYPE_REGION:
|
case HGDIOBJ_TYPE_REGION:
|
||||||
break;
|
break;
|
||||||
case HGDIOBJ_TYPE_PALETTE: {
|
case HGDIOBJ_TYPE_PALETTE: {
|
||||||
//HPALETTE oldSelectedPalette = hdc->selectedPalette;
|
HPALETTE oldSelectedPalette = hdc->selectedPalette;
|
||||||
hdc->selectedPalette = h;
|
hdc->selectedPalette = h;
|
||||||
return h; //oldSelectedPalette;
|
return oldSelectedPalette;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -1842,6 +1843,13 @@ BOOL DeleteObject(HGDIOBJ ho) {
|
||||||
free(ho);
|
free(ho);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
case HGDIOBJ_TYPE_BRUSH: {
|
||||||
|
PAINT_LOGD("PAINT DeleteObject() HGDIOBJ_TYPE_BRUSH");
|
||||||
|
ho->handleType = HGDIOBJ_TYPE_INVALID;
|
||||||
|
ho->brushColor = 0;
|
||||||
|
free(ho);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1962,6 +1970,13 @@ BOOL PatBlt(HDC hdcDest, int x, int y, int w, int h, DWORD rop) {
|
||||||
|
|
||||||
destinationStride = androidBitmapInfo.stride;
|
destinationStride = androidBitmapInfo.stride;
|
||||||
|
|
||||||
|
// RECT newRectangleToUpdate;
|
||||||
|
// newRectangleToUpdate.left = x;
|
||||||
|
// newRectangleToUpdate.top = y;
|
||||||
|
// newRectangleToUpdate.right = x + w;
|
||||||
|
// newRectangleToUpdate.bottom = y + h;
|
||||||
|
// UnionRect(&mainViewRectangleToUpdate, &mainViewRectangleToUpdate, &newRectangleToUpdate);
|
||||||
|
|
||||||
if ((ret = AndroidBitmap_lockPixels(jniEnv, bitmapMainScreen, &pixelsDestination)) < 0) {
|
if ((ret = AndroidBitmap_lockPixels(jniEnv, bitmapMainScreen, &pixelsDestination)) < 0) {
|
||||||
LOGD("AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
LOGD("AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1972,6 +1987,7 @@ BOOL PatBlt(HDC hdcDest, int x, int y, int w, int h, DWORD rop) {
|
||||||
|
|
||||||
destinationWidth = hBitmapDestination->bitmapInfoHeader->biWidth;
|
destinationWidth = hBitmapDestination->bitmapInfoHeader->biWidth;
|
||||||
destinationHeight = abs(hBitmapDestination->bitmapInfoHeader->biHeight);
|
destinationHeight = abs(hBitmapDestination->bitmapInfoHeader->biHeight);
|
||||||
|
//TODO destinationTopDown = hBitmapDestination->bitmapInfoHeader->biHeight < 0;
|
||||||
|
|
||||||
destinationStride = (float)(4 * ((destinationWidth * hBitmapDestination->bitmapInfoHeader->biBitCount + 31) / 32));
|
destinationStride = (float)(4 * ((destinationWidth * hBitmapDestination->bitmapInfoHeader->biBitCount + 31) / 32));
|
||||||
}
|
}
|
||||||
|
@ -2060,7 +2076,8 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
void * pixelsDestination = NULL;
|
void * pixelsDestination = NULL;
|
||||||
int destinationBitCount = 8;
|
int destinationBitCount = 8;
|
||||||
|
|
||||||
BOOL reverseHeight = hBitmapSource->bitmapInfoHeader->biHeight < 0;
|
BOOL sourceTopDown = hBitmapSource->bitmapInfoHeader->biHeight < 0;
|
||||||
|
BOOL destinationTopDown = FALSE;
|
||||||
|
|
||||||
int sourceWidth = hBitmapSource->bitmapInfoHeader->biWidth;
|
int sourceWidth = hBitmapSource->bitmapInfoHeader->biWidth;
|
||||||
int sourceHeight = abs(hBitmapSource->bitmapInfoHeader->biHeight); // Can be < 0
|
int sourceHeight = abs(hBitmapSource->bitmapInfoHeader->biHeight); // Can be < 0
|
||||||
|
@ -2092,7 +2109,16 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
destinationBitCount = 32;
|
destinationBitCount = 32;
|
||||||
destinationStride = androidBitmapInfo.stride;
|
destinationStride = androidBitmapInfo.stride;
|
||||||
|
|
||||||
if ((ret = AndroidBitmap_lockPixels(jniEnv, bitmapMainScreen, &pixelsDestination)) < 0) {
|
destinationTopDown = TRUE;
|
||||||
|
|
||||||
|
// RECT newRectangleToUpdate;
|
||||||
|
// newRectangleToUpdate.left = xDest;
|
||||||
|
// newRectangleToUpdate.top = yDest;
|
||||||
|
// newRectangleToUpdate.right = xDest + wDest;
|
||||||
|
// newRectangleToUpdate.bottom = yDest + hDest;
|
||||||
|
// UnionRect(&mainViewRectangleToUpdate, &mainViewRectangleToUpdate, &newRectangleToUpdate);
|
||||||
|
|
||||||
|
if ((ret = AndroidBitmap_lockPixels(jniEnv, bitmapMainScreen, &pixelsDestination)) < 0) {
|
||||||
LOGD("AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
LOGD("AndroidBitmap_lockPixels() failed ! error=%d", ret);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -2102,6 +2128,7 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
|
|
||||||
destinationWidth = hBitmapDestination->bitmapInfoHeader->biWidth;
|
destinationWidth = hBitmapDestination->bitmapInfoHeader->biWidth;
|
||||||
destinationHeight = abs(hBitmapDestination->bitmapInfoHeader->biHeight);
|
destinationHeight = abs(hBitmapDestination->bitmapInfoHeader->biHeight);
|
||||||
|
destinationTopDown = hBitmapDestination->bitmapInfoHeader->biHeight < 0;
|
||||||
destinationBitCount = hBitmapDestination->bitmapInfoHeader->biBitCount;
|
destinationBitCount = hBitmapDestination->bitmapInfoHeader->biBitCount;
|
||||||
destinationStride = 4 * ((destinationWidth * hBitmapDestination->bitmapInfoHeader->biBitCount + 31) / 32);
|
destinationStride = 4 * ((destinationWidth * hBitmapDestination->bitmapInfoHeader->biBitCount + 31) / 32);
|
||||||
}
|
}
|
||||||
|
@ -2133,11 +2160,11 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
|
||||||
backgroundColor = hdcDest->backgroundColor;
|
backgroundColor = hdcDest->backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
StretchBltInternal(xDest, yDest, wDest, hDest, pixelsDestination, destinationBitCount,
|
StretchBltInternal(xDest, yDest, wDest, hDest,
|
||||||
destinationStride, destinationWidth, destinationHeight,
|
pixelsDestination, destinationBitCount, destinationStride, destinationWidth, destinationHeight,
|
||||||
xSrc, ySrc, wSrc, hSrc, pixelsSource, sourceBitCount,
|
xSrc, ySrc, wSrc, hSrc,
|
||||||
sourceStride, sourceWidth, sourceHeight,
|
pixelsSource, sourceBitCount, sourceStride, sourceWidth, sourceHeight,
|
||||||
rop, reverseHeight, palPalEntry, brushColor, backgroundColor);
|
rop, sourceTopDown, destinationTopDown, palPalEntry, brushColor, backgroundColor);
|
||||||
|
|
||||||
if(jniEnv && hdcDest->hdcCompatible == NULL && (ret = AndroidBitmap_unlockPixels(jniEnv, bitmapMainScreen)) < 0) {
|
if(jniEnv && hdcDest->hdcCompatible == NULL && (ret = AndroidBitmap_unlockPixels(jniEnv, bitmapMainScreen)) < 0) {
|
||||||
LOGD("AndroidBitmap_unlockPixels() failed ! error=%d", ret);
|
LOGD("AndroidBitmap_unlockPixels() failed ! error=%d", ret);
|
||||||
|
@ -2153,7 +2180,7 @@ void StretchBltInternal(int xDest, int yDest, int wDest, int hDest,
|
||||||
const void *pixelsDestination, int destinationBitCount, int destinationStride, int destinationWidth, int destinationHeight,
|
const void *pixelsDestination, int destinationBitCount, int destinationStride, int destinationWidth, int destinationHeight,
|
||||||
int xSrc, int ySrc, int wSrc, int hSrc,
|
int xSrc, int ySrc, int wSrc, int hSrc,
|
||||||
const void *pixelsSource, UINT sourceBitCount, int sourceStride, int sourceWidth, int sourceHeight,
|
const void *pixelsSource, UINT sourceBitCount, int sourceStride, int sourceWidth, int sourceHeight,
|
||||||
DWORD rop, BOOL reverseHeight, const PALETTEENTRY *palPalEntry, COLORREF brushColor, COLORREF backgroundColor) {
|
DWORD rop, BOOL sourceTopDown, BOOL destinationTopDown, const PALETTEENTRY *palPalEntry, COLORREF brushColor, COLORREF backgroundColor) {
|
||||||
int dst_maxx = xDest + wDest;
|
int dst_maxx = xDest + wDest;
|
||||||
int dst_maxy = yDest + hDest;
|
int dst_maxy = yDest + hDest;
|
||||||
|
|
||||||
|
@ -2170,12 +2197,19 @@ void StretchBltInternal(int xDest, int yDest, int wDest, int hDest,
|
||||||
if(dst_maxy > destinationHeight)
|
if(dst_maxy > destinationHeight)
|
||||||
dst_maxy = destinationHeight;
|
dst_maxy = destinationHeight;
|
||||||
|
|
||||||
|
int src_cury, dst_cury;
|
||||||
for (int y = yDest; y < dst_maxy; y++) {
|
for (int y = yDest; y < dst_maxy; y++) {
|
||||||
int src_cury = ySrc + (y - yDest) * hSrc / hDest;
|
if(sourceTopDown)
|
||||||
if(!reverseHeight)
|
src_cury = ySrc + (y - yDest) * hSrc / hDest; // Source top-down
|
||||||
src_cury = sourceHeight - 1 - src_cury;
|
else
|
||||||
|
src_cury = sourceHeight - 1 - (ySrc + (y - yDest) * hSrc / hDest); // Source bottom-up
|
||||||
if (src_cury < 0 || src_cury >= sourceHeight)
|
if (src_cury < 0 || src_cury >= sourceHeight)
|
||||||
continue;
|
continue;
|
||||||
|
if(destinationTopDown)
|
||||||
|
dst_cury = y; // Destination top-down
|
||||||
|
else
|
||||||
|
dst_cury = destinationHeight - 1 - y; // Destination bottom-up
|
||||||
|
|
||||||
BYTE parity = (BYTE) xSrc;
|
BYTE parity = (BYTE) xSrc;
|
||||||
for (int x = xDest; x < dst_maxx; x++, parity++) {
|
for (int x = xDest; x < dst_maxx; x++, parity++) {
|
||||||
int src_curx = xSrc + (x - xDest) * wSrc / wDest;
|
int src_curx = xSrc + (x - xDest) * wSrc / wDest;
|
||||||
|
@ -2183,7 +2217,7 @@ void StretchBltInternal(int xDest, int yDest, int wDest, int hDest,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BYTE * sourcePixelBase = pixelsSource + sourceStride * src_cury;
|
BYTE * sourcePixelBase = pixelsSource + sourceStride * src_cury;
|
||||||
BYTE * destinationPixelBase = pixelsDestination + destinationStride * y;
|
BYTE * destinationPixelBase = pixelsDestination + destinationStride * dst_cury;
|
||||||
|
|
||||||
COLORREF sourceColor = 0xFF000000;
|
COLORREF sourceColor = 0xFF000000;
|
||||||
BYTE * sourceColorPointer = (BYTE *) &sourceColor;
|
BYTE * sourceColorPointer = (BYTE *) &sourceColor;
|
||||||
|
@ -2343,7 +2377,7 @@ HBITMAP CreateBitmap( int nWidth, int nHeight, UINT nPlanes, UINT nBitCount, CON
|
||||||
newBitmapInfo->bmiHeader.biBitCount = (WORD) nBitCount;
|
newBitmapInfo->bmiHeader.biBitCount = (WORD) nBitCount;
|
||||||
newBitmapInfo->bmiHeader.biClrUsed = 0;
|
newBitmapInfo->bmiHeader.biClrUsed = 0;
|
||||||
newBitmapInfo->bmiHeader.biWidth = nWidth;
|
newBitmapInfo->bmiHeader.biWidth = nWidth;
|
||||||
newBitmapInfo->bmiHeader.biHeight = -nHeight;
|
newBitmapInfo->bmiHeader.biHeight = nHeight;
|
||||||
newBitmapInfo->bmiHeader.biPlanes = (WORD) nPlanes;
|
newBitmapInfo->bmiHeader.biPlanes = (WORD) nPlanes;
|
||||||
newHBITMAP->bitmapInfo = newBitmapInfo;
|
newHBITMAP->bitmapInfo = newBitmapInfo;
|
||||||
newHBITMAP->bitmapInfoHeader = (BITMAPINFOHEADER *)newBitmapInfo;
|
newHBITMAP->bitmapInfoHeader = (BITMAPINFOHEADER *)newBitmapInfo;
|
||||||
|
@ -2519,8 +2553,12 @@ COLORREF GetPixel(HDC hdc, int x ,int y) {
|
||||||
return resultColor;
|
return resultColor;
|
||||||
}
|
}
|
||||||
BOOL SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom) {
|
BOOL SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom) {
|
||||||
//TODO
|
if (!lprc) return FALSE;
|
||||||
return 0;
|
lprc->left = xLeft;
|
||||||
|
lprc->right = xRight;
|
||||||
|
lprc->top = yTop;
|
||||||
|
lprc->bottom = yBottom;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
BOOL SetRectEmpty(LPRECT lprc) {
|
BOOL SetRectEmpty(LPRECT lprc) {
|
||||||
if(lprc) {
|
if(lprc) {
|
||||||
|
@ -2532,6 +2570,38 @@ BOOL SetRectEmpty(LPRECT lprc) {
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL IsRectEmpty(CONST RECT *lprc) {
|
||||||
|
if (!lprc)
|
||||||
|
return TRUE;
|
||||||
|
return lprc->left >= lprc->right || lprc->top >= lprc->bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This comes from Wine source code
|
||||||
|
BOOL UnionRect(LPRECT dest, CONST RECT *src1, CONST RECT *src2) {
|
||||||
|
if (!dest) return FALSE;
|
||||||
|
if (IsRectEmpty(src1))
|
||||||
|
{
|
||||||
|
if (IsRectEmpty(src2))
|
||||||
|
{
|
||||||
|
SetRectEmpty( dest );
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else *dest = *src2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsRectEmpty(src2)) *dest = *src1;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dest->left = min( src1->left, src2->left );
|
||||||
|
dest->right = max( src1->right, src2->right );
|
||||||
|
dest->top = min( src1->top, src2->top );
|
||||||
|
dest->bottom = max( src1->bottom, src2->bottom );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
int SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw) {
|
int SetWindowRgn(HWND hWnd, HRGN hRgn, BOOL bRedraw) {
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -554,46 +554,46 @@ struct _HANDLE {
|
||||||
enum HANDLE_TYPE handleType;
|
enum HANDLE_TYPE handleType;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
// HANDLE_TYPE_FILE*
|
// HANDLE_TYPE_FILE*
|
||||||
int fileDescriptor;
|
int fileDescriptor;
|
||||||
BOOL fileOpenFileFromContentResolver;
|
BOOL fileOpenFileFromContentResolver;
|
||||||
|
|
||||||
AAsset* fileAsset;
|
AAsset* fileAsset;
|
||||||
|
|
||||||
// HANDLE_TYPE_FILE_MAPPING*
|
// HANDLE_TYPE_FILE_MAPPING*
|
||||||
off_t fileMappingOffset;
|
off_t fileMappingOffset;
|
||||||
size_t fileMappingSize;
|
size_t fileMappingSize;
|
||||||
void* fileMappingAddress;
|
void* fileMappingAddress;
|
||||||
DWORD fileMappingProtect;
|
DWORD fileMappingProtect;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// HANDLE_TYPE_THREAD
|
// HANDLE_TYPE_THREAD
|
||||||
pthread_t threadId;
|
pthread_t threadId;
|
||||||
DWORD (*threadStartAddress)(LPVOID);
|
DWORD (*threadStartAddress)(LPVOID);
|
||||||
LPVOID threadParameter;
|
LPVOID threadParameter;
|
||||||
struct _HANDLE * threadEventMessage;
|
struct _HANDLE * threadEventMessage;
|
||||||
struct tagMSG threadMessage;
|
struct tagMSG threadMessage;
|
||||||
int threadIndex;
|
int threadIndex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// HANDLE_TYPE_EVENT
|
// HANDLE_TYPE_EVENT
|
||||||
pthread_cond_t eventCVariable;
|
pthread_cond_t eventCVariable;
|
||||||
pthread_mutex_t eventMutex;
|
pthread_mutex_t eventMutex;
|
||||||
BOOL eventAutoReset;
|
BOOL eventAutoReset;
|
||||||
BOOL eventState;
|
BOOL eventState;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// HANDLE_TYPE_WINDOW
|
// HANDLE_TYPE_WINDOW
|
||||||
HDC windowDC;
|
HDC windowDC;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// HANDLE_TYPE_ICON
|
// HANDLE_TYPE_ICON
|
||||||
HBITMAP icon;
|
HBITMAP icon;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
// HANDLE_TYPE_COM
|
// HANDLE_TYPE_COM
|
||||||
|
@ -783,12 +783,12 @@ extern BOOL BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, in
|
||||||
extern int SetStretchBltMode(HDC hdc, int mode);
|
extern int SetStretchBltMode(HDC hdc, int mode);
|
||||||
extern BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
extern BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdcSrc, int xSrc, int ySrc, int wSrc, int hSrc, DWORD rop);
|
||||||
extern void StretchBltInternal(int xDest, int yDest, int wDest, int hDest, const void *pixelsDestination,
|
extern void StretchBltInternal(int xDest, int yDest, int wDest, int hDest, const void *pixelsDestination,
|
||||||
int destinationBitCount, int destinationStride, int destinationWidth,
|
int destinationBitCount, int destinationStride, int destinationWidth,
|
||||||
int destinationHeight, int xSrc, int ySrc, int hSrc, int wSrc,
|
int destinationHeight, int xSrc, int ySrc, int hSrc, int wSrc,
|
||||||
const void *pixelsSource, UINT sourceBitCount, int sourceStride,
|
const void *pixelsSource, UINT sourceBitCount, int sourceStride,
|
||||||
int sourceWidth, int sourceHeight, DWORD rop, BOOL reverseHeight,
|
int sourceWidth, int sourceHeight, DWORD rop, BOOL sourceTopDown, BOOL destinationTopDown,
|
||||||
const PALETTEENTRY *palPalEntry, COLORREF brushColor,
|
const PALETTEENTRY *palPalEntry, COLORREF brushColor,
|
||||||
COLORREF backgroundColor);
|
COLORREF backgroundColor);
|
||||||
extern UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq);
|
extern UINT SetDIBColorTable(HDC hdc, UINT iStart, UINT cEntries, CONST RGBQUAD *prgbq);
|
||||||
/* constants for CreateDIBitmap */
|
/* constants for CreateDIBitmap */
|
||||||
#define CBM_INIT 0x04L /* initialize bitmap */
|
#define CBM_INIT 0x04L /* initialize bitmap */
|
||||||
|
@ -819,6 +819,8 @@ extern COLORREF SetBkColor(HDC hdc, COLORREF color);
|
||||||
#define RDH_RECTANGLES 1
|
#define RDH_RECTANGLES 1
|
||||||
extern BOOL SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom);
|
extern BOOL SetRect(LPRECT lprc, int xLeft, int yTop, int xRight, int yBottom);
|
||||||
extern BOOL SetRectEmpty(LPRECT lprc);
|
extern BOOL SetRectEmpty(LPRECT lprc);
|
||||||
|
extern BOOL IsRectEmpty(CONST RECT *lprc);
|
||||||
|
extern BOOL UnionRect(LPRECT dest, CONST RECT *src1, CONST RECT *src2);
|
||||||
|
|
||||||
struct HRGN__ { int unused; };
|
struct HRGN__ { int unused; };
|
||||||
typedef struct HRGN__ *HRGN;
|
typedef struct HRGN__ *HRGN;
|
||||||
|
@ -1003,7 +1005,6 @@ extern BOOL InsertMenu(HMENU hMenu, UINT uPosition, UINT uFlags, UINT_PTR uIDNew
|
||||||
#define SWP_NOMOVE 0x0002
|
#define SWP_NOMOVE 0x0002
|
||||||
#define SWP_NOZORDER 0x0004
|
#define SWP_NOZORDER 0x0004
|
||||||
extern BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
|
extern BOOL SetWindowPos(HWND hWnd, HWND hWndInsertAfter, int X, int Y, int cx, int cy, UINT uFlags);
|
||||||
extern BOOL IsRectEmpty(CONST RECT *lprc);
|
|
||||||
extern BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt);
|
extern BOOL WINAPI SetWindowOrgEx(HDC hdc, int x, int y, LPPOINT lppt);
|
||||||
|
|
||||||
#define _MAX_PATH 260 // max. length of full pathname
|
#define _MAX_PATH 260 // max. length of full pathname
|
||||||
|
|
|
@ -7,7 +7,7 @@ buildscript {
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:7.0.0'
|
classpath 'com.android.tools.build:gradle:7.0.2'
|
||||||
|
|
||||||
|
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
|
|
Loading…
Reference in a new issue