mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-29 21:43:55 +00:00
Fixed Windows bitmap copy #501
This commit is contained in:
parent
e08e05307e
commit
1934220f50
@ -11,6 +11,7 @@ struct _MMBitmap {
|
||||
uint8_t *imageBuffer; /* Pixels stored in Quad I format; */
|
||||
int32_t width; /* Never 0, unless image is NULL. */
|
||||
int32_t height; /* Never 0, unless image is NULL. */
|
||||
|
||||
int32_t bytewidth; /* The aligned width (width + padding). */
|
||||
uint8_t bitsPerPixel; /* Should be either 24 or 32. */
|
||||
uint8_t bytesPerPixel; /* For convenience; should be bitsPerPixel / 8. */
|
||||
|
@ -98,10 +98,11 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
|
||||
dib = CreateDIBSection(screen, &bi, DIB_RGB_COLORS, &data, NULL, 0);
|
||||
|
||||
/* Copy the data into a bitmap struct. */
|
||||
BOOL smem = (screenMem = CreateCompatibleDC(screen)) == NULL;
|
||||
BOOL bitb = BitBlt(screenMem, (int)0, (int)0, (int)rect.size.w, (int)rect.size.h,
|
||||
BOOL b = (screenMem = CreateCompatibleDC(screen)) == NULL ||
|
||||
SelectObject(screenMem, dib) == NULL ||
|
||||
!BitBlt(screenMem, (int)0, (int)0, (int)rect.size.w, (int)rect.size.h,
|
||||
screen, rect.origin.x, rect.origin.y, SRCCOPY);
|
||||
if (smem || SelectObject(screenMem, dib) == NULL || !bitb) {
|
||||
if (b) {
|
||||
/* Error copying data. */
|
||||
ReleaseDC(hwnd, screen);
|
||||
DeleteObject(dib);
|
||||
|
Loading…
Reference in New Issue
Block a user