Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix screen capture on screens with 24 bit depth and 32 bpp #6

Merged
merged 2 commits into from
Aug 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions xgraphics/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,9 @@ func readDrawableData(X *xgbutil.XUtil, ximg *Image, did xproto.Drawable,
}
}
}
case 24, 32:
case 24:
switch format.BitsPerPixel {
case 24:
case 24, 32:
bytesPer := int(format.BitsPerPixel) / 8
var i int
ximg.For(func(x, y int) BGRA {
Expand All @@ -261,6 +261,13 @@ func readDrawableData(X *xgbutil.XUtil, ximg *Image, did xproto.Drawable,
A: 0xff,
}
})
default:
return fmt.Errorf("The image returned for pixmap id %d has "+
"an unsupported value for bits-per-pixel: %d",
did, format.BitsPerPixel)
}
case 32:
switch format.BitsPerPixel {
case 32:
bytesPer := int(format.BitsPerPixel) / 8
var i int
Expand Down