mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
Merge pull request #554 from go-vgo/bitmap-pr
Fix: fixed mac multi screen capture
This commit is contained in:
commit
4bc64ebf67
@ -20,7 +20,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
|
|||||||
size_t bufferSize = 0;
|
size_t bufferSize = 0;
|
||||||
|
|
||||||
CGDirectDisplayID displayID = (CGDirectDisplayID) display_id;
|
CGDirectDisplayID displayID = (CGDirectDisplayID) display_id;
|
||||||
if (displayID == -1) {
|
if (displayID == -1 || displayID == 0) {
|
||||||
displayID = CGMainDisplayID();
|
displayID = CGMainDisplayID();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,11 +94,13 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
|
|||||||
}
|
}
|
||||||
if (screen == NULL) { return NULL; }
|
if (screen == NULL) { return NULL; }
|
||||||
|
|
||||||
|
// Todo:
|
||||||
|
screenMem = CreateCompatibleDC(screen);
|
||||||
/* Get screen data in display device context. */
|
/* Get screen data in display device context. */
|
||||||
dib = CreateDIBSection(screen, &bi, DIB_RGB_COLORS, &data, NULL, 0);
|
dib = CreateDIBSection(screen, &bi, DIB_RGB_COLORS, &data, NULL, 0);
|
||||||
|
|
||||||
/* Copy the data into a bitmap struct. */
|
/* Copy the data into a bitmap struct. */
|
||||||
BOOL b = (screenMem = CreateCompatibleDC(screen)) == NULL ||
|
BOOL b = (screenMem == NULL) ||
|
||||||
SelectObject(screenMem, dib) == NULL ||
|
SelectObject(screenMem, dib) == NULL ||
|
||||||
!BitBlt(screenMem, (int)0, (int)0, (int)rect.size.w, (int)rect.size.h,
|
!BitBlt(screenMem, (int)0, (int)0, (int)rect.size.w, (int)rect.size.h,
|
||||||
screen, rect.origin.x, rect.origin.y, SRCCOPY);
|
screen, rect.origin.x, rect.origin.y, SRCCOPY);
|
||||||
|
Loading…
Reference in New Issue
Block a user