This commit is contained in:
dgis 2019-01-28 23:31:43 +00:00
parent c7350dbf81
commit 0f47b6cb90

View file

@ -1033,7 +1033,10 @@ BOOL GetWindowPlacement(HWND hWnd, WINDOWPLACEMENT *lpwndpl) {
return TRUE;
}
BOOL SetWindowPlacement(HWND hWnd, CONST WINDOWPLACEMENT *lpwndpl) { return 0; }
BOOL InvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase) { return 0; }
BOOL InvalidateRect(HWND hWnd, CONST RECT *lpRect, BOOL bErase) {
mainViewUpdateCallback();
return 0;
}
BOOL AdjustWindowRect(LPRECT lpRect, DWORD dwStyle, BOOL bMenu) { return 0; }
LONG GetWindowLong(HWND hWnd, int nIndex) { return 0; }
HMENU GetMenu(HWND hWnd) { return NULL; }
@ -1190,8 +1193,133 @@ BOOL LineTo(HDC hdc, int x, int y) {
//TODO
return 0;
}
BOOL PatBlt(HDC hdc, int x, int y, int w, int h, DWORD rop) {
BOOL PatBlt(HDC hdcDest, int x, int y, int w, int h, DWORD rop) {
//TODO
// if((hdcDest->selectedBitmap || hdcDest->hdcCompatible == NULL) && w && h) {
// HBITMAP hBitmapDestination = NULL;
// void * pixelsDestination = NULL;
// int destinationWidth = 0;
// int destinationHeight = 0;
// int destinationBytes = 0;
// float destinationStride = 0;
//
// JNIEnv * jniEnv = NULL;
//
// if(hdcDest->hdcCompatible == NULL) {
// // We update the main window
//
// jint ret;
// BOOL needDetach = FALSE;
// ret = (*java_machine)->GetEnv(java_machine, (void **) &jniEnv, JNI_VERSION_1_6);
// if (ret == JNI_EDETACHED) {
// // GetEnv: not attached
// ret = (*java_machine)->AttachCurrentThread(java_machine, &jniEnv, NULL);
// if (ret == JNI_OK) {
// needDetach = TRUE;
// }
// }
//
// destinationWidth = androidBitmapInfo.width;
// destinationHeight = androidBitmapInfo.height;
//
// destinationBytes = 4;
// destinationStride = androidBitmapInfo.stride;
//
// if ((ret = AndroidBitmap_lockPixels(jniEnv, bitmapMainScreen, &pixelsDestination)) < 0) {
// LOGE("AndroidBitmap_lockPixels() failed ! error=%d", ret);
// }
// } else {
// hBitmapDestination = hdcDest->selectedBitmap;
// pixelsDestination = (void *) hBitmapDestination->bitmapBits;
//
// destinationWidth = hBitmapDestination->bitmapInfoHeader->biWidth;
// destinationHeight = abs(hBitmapDestination->bitmapInfoHeader->biHeight);
//
// destinationBytes = (hBitmapDestination->bitmapInfoHeader->biBitCount >> 3);
// destinationStride = (float)(destinationBytes * ((destinationWidth * hBitmapDestination->bitmapInfoHeader->biBitCount + 31) / 32));
// }
//
//
//// HPALETTE palette = hdcSrc->realizedPalette;
//// if(!palette)
//// palette = hdcSrc->selectedPalette;
//// PALETTEENTRY * palPalEntry = palette && palette->paletteLog && palette->paletteLog->palPalEntry ?
//// palette->paletteLog->palPalEntry : NULL;
//
// for (float y = yDest; y < dst_maxy; y++) {
// float src_curx = xSrc;
// BYTE parity = xSrc;
// for (float x = xDest; x < dst_maxx; x++, parity++) {
// // Point sampling - you can also impl as bilinear or other
//
//
// float currentXBytes = sourceBytesWithDecimal * (int)src_curx;
// BYTE * sourcePixel = pixelsSource + (int)(sourceStride * (int)src_cury) + (int)currentXBytes;
// BYTE * destinationPixel = pixelsDestination + (int)(destinationStride * y + 4.0 * x);
//
// // -> ARGB_8888
// switch (sourceBitCount) {
// case 4: {
// BYTE colorIndex = (parity & 0x1 ? sourcePixel[0] & (BYTE)0x0F : sourcePixel[0] >> 4);
// //BYTE colorIndex = (parity & 0x1 ? sourcePixel[0] >> 4 : sourcePixel[0] & (BYTE)0x0F);
// if (palPalEntry) {
// destinationPixel[0] = palPalEntry[colorIndex].peRed; //TODO Exchange Blue and Red?
// destinationPixel[1] = palPalEntry[colorIndex].peGreen;
// destinationPixel[2] = palPalEntry[colorIndex].peBlue;
// destinationPixel[3] = 255;
// } else {
// destinationPixel[0] = colorIndex;
// destinationPixel[1] = colorIndex;
// destinationPixel[2] = colorIndex;
// destinationPixel[3] = 255;
// }
// break;
// }
// case 8: {
// BYTE colorIndex = sourcePixel[0];
// if (palPalEntry) {
// destinationPixel[0] = palPalEntry[colorIndex].peRed; //TODO Exchange Blue and Red?
// destinationPixel[1] = palPalEntry[colorIndex].peGreen;
// destinationPixel[2] = palPalEntry[colorIndex].peBlue;
// destinationPixel[3] = 255;
// } else {
// destinationPixel[0] = sourcePixel[0];
// destinationPixel[1] = sourcePixel[0];
// destinationPixel[2] = sourcePixel[0];
// destinationPixel[3] = 255;
// }
// break;
// }
// case 24:
// destinationPixel[0] = sourcePixel[2];
// destinationPixel[1] = sourcePixel[1];
// destinationPixel[2] = sourcePixel[0];
// destinationPixel[3] = 255;
// break;
// case 32:
// memcpy(destinationPixel, sourcePixel, (size_t) sourceBytes);
// break;
// default:
// break;
// }
//
// src_curx += src_dx;
// }
//
// src_cury += src_dy;
// }
//
//
//
//
//
//
//
//
//
// if(jniEnv)
// AndroidBitmap_unlockPixels(jniEnv, bitmapMainScreen);
// }
return 0;
}
BOOL BitBlt(HDC hdc, int x, int y, int cx, int cy, HDC hdcSrc, int x1, int y1, DWORD rop) {
@ -1277,9 +1405,6 @@ BOOL StretchBlt(HDC hdcDest, int xDest, int yDest, int wDest, int hDest, HDC hdc
float src_cury = ySrc;
//LOGD("StretchBlt(%08x, x:%d, y:%d, w:%d, h:%d, %08x, x:%d, y:%d, w:%d, h:%d) -> sourceBytes: %d", hdcDest->hdcCompatible, xDest, yDest, wDest, hDest, hdcSrc, xSrc, ySrc, wSrc, hSrc, sourceBytesWithDecimal);
// PALETTEENTRY * palPalEntry = hdcSrc->selectedPalette && hdcSrc->selectedPalette->paletteLog && hdcSrc->selectedPalette->paletteLog->palPalEntry ?
// hdcSrc->selectedPalette->paletteLog->palPalEntry : NULL;
HPALETTE palette = hdcSrc->realizedPalette;
if(!palette)
palette = hdcSrc->selectedPalette;