Skip to content

Commit

Permalink
Merge pull request #554 from go-vgo/bitmap-pr
Browse files Browse the repository at this point in the history
Fix: fixed mac multi screen capture
  • Loading branch information
vcaesar authored Jan 12, 2023
2 parents c9e1c3d + bdae1a7 commit 4bc64eb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions screen/screengrab_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
size_t bufferSize = 0;

CGDirectDisplayID displayID = (CGDirectDisplayID) display_id;
if (displayID == -1) {
if (displayID == -1 || displayID == 0) {
displayID = CGMainDisplayID();
}

Expand Down Expand Up @@ -94,11 +94,13 @@ MMBitmapRef copyMMBitmapFromDisplayInRect(MMRectInt32 rect, int32_t display_id)
}
if (screen == NULL) { return NULL; }

// Todo:
screenMem = CreateCompatibleDC(screen);
/* Get screen data in display device context. */
dib = CreateDIBSection(screen, &bi, DIB_RGB_COLORS, &data, NULL, 0);

/* Copy the data into a bitmap struct. */
BOOL b = (screenMem = CreateCompatibleDC(screen)) == NULL ||
BOOL b = (screenMem == 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);
Expand Down

0 comments on commit 4bc64eb

Please sign in to comment.