- In the menu header, switch the pixel format RGB to BGR when an icon of type BMP is defined in the KML script.

This commit is contained in:
dgis 2020-09-05 11:09:00 +02:00
parent 161b1207c9
commit 897c3d41c9
4 changed files with 21 additions and 10 deletions

View file

@ -70,6 +70,7 @@ Version 1.9 (2020-09-XX)
- Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte.
- Prevent to auto save before launching the "Open...", "Save As...", "Load Object...", "Save Object...", etc...
- Prevent app not responding (ANR) in NativeLib.buttonUp().
- In the menu header, switch the pixel format RGB to BGR when an icon of type BMP is defined in the KML script.
Version 1.8 (2020-05-24)

View file

@ -70,6 +70,7 @@ Version 1.9 (2020-09-XX)
- Move the KML folder in the JSON settings embedded in the state file because Windows cannot open the state file with KML url longer than 256 byte.
- Prevent to auto save before launching the "Open...", "Save As...", "Load Object...", "Save Object...", etc...
- Prevent app not responding (ANR) in NativeLib.buttonUp().
- In the menu header, switch the pixel format RGB to BGR when an icon of type BMP is defined in the KML script.
Version 1.8 (2020-05-24)

View file

@ -885,8 +885,16 @@ static HBITMAP DecodeBMPIcon(LPBYTE imageBuffer, size_t imageSize) {
// Inverse the height
BYTE *source = imageBuffer + dwFileSize - stride;
BYTE *destination = hBitmap->bitmapBits;
for (int i = 0; i < height; ++i) {
memcpy(destination, source, stride);
DWORD width = pBmi->bmiHeader.biWidth;
for (unsigned int y = 0; y < height; ++y) {
for (unsigned int x = 0; x < width; ++x) {
BYTE * sourcePixel = source + (x << 2);
BYTE * destinationPixel = destination + (x << 2);
destinationPixel[0] = sourcePixel[2];
destinationPixel[1] = sourcePixel[1];
destinationPixel[2] = sourcePixel[0];
destinationPixel[3] = sourcePixel[3];
}
source -= stride;
destination += stride;
}
@ -911,8 +919,8 @@ static HBITMAP DecodePNGIcon(LPBYTE imageBuffer, size_t imageSize) {
bmi.bmiHeader.biCompression = BI_RGB;
// bitmap dimensions
LONG lBytesPerLine = (((bmi.bmiHeader.biWidth * bmi.bmiHeader.biBitCount) + 31) / 32 * 4);
bmi.bmiHeader.biSizeImage = (DWORD) (lBytesPerLine * bmi.bmiHeader.biHeight);
LONG stride = (((bmi.bmiHeader.biWidth * bmi.bmiHeader.biBitCount) + 31) / 32 * 4);
bmi.bmiHeader.biSizeImage = (DWORD) (stride * bmi.bmiHeader.biHeight);
// allocate buffer for pixels
LPBYTE pbyPixels; // BMP buffer
@ -3116,4 +3124,3 @@ int win32_select(int __fd_count, fd_set* __read_fds, fd_set* __write_fds, fd_set
}
return select(__fd_count, __read_fds, __write_fds, __exception_fds, __timeout);
}

View file

@ -215,8 +215,10 @@ public class MainScreenView extends PanAndScaleView {
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_POINTER_UP:
float pointerX = event.getX(actionIndex);
float pointerY = event.getY(actionIndex);
post(() -> {
NativeLib.buttonUp((int) ((event.getX(actionIndex) - viewPanOffsetX) / viewScaleFactorX), (int) ((event.getY(actionIndex) - viewPanOffsetY) / viewScaleFactorY));
NativeLib.buttonUp((int) ((pointerX - viewPanOffsetX) / viewScaleFactorX), (int) ((pointerY - viewPanOffsetY) / viewScaleFactorY));
});
currentButtonTouched.remove(actionIndex);
preventToScroll = currentButtonTouched.size() > 0;