Fixed bit depth stuff (is it always BGRA??)
This commit is contained in:
parent
f921c61b23
commit
acbf1bce14
|
@ -47,20 +47,11 @@ Image get_screenshot(xcb_connection_t *conn, xcb_window_t wid) {
|
||||||
|
|
||||||
Image img = GenImageColor(win_w, win_h, BLANK);
|
Image img = GenImageColor(win_w, win_h, BLANK);
|
||||||
|
|
||||||
if (win_d == 24) {
|
for (int i = 0; i < data_len; i += 4) {
|
||||||
for (int i = 0; i < data_len / 3; i++) {
|
((uint8_t *)img.data)[i + 0] = data[i + 2];
|
||||||
((uint8_t *)img.data)[i * 4 + 0] = data[i * 3 + 2];
|
((uint8_t *)img.data)[i + 1] = data[i + 1];
|
||||||
((uint8_t *)img.data)[i * 4 + 1] = data[i * 3 + 1];
|
((uint8_t *)img.data)[i + 2] = data[i + 0];
|
||||||
((uint8_t *)img.data)[i * 4 + 2] = data[i * 3 + 0];
|
((uint8_t *)img.data)[i + 3] = win_d == 24 ? 0xff : data[i + 3];
|
||||||
((uint8_t *)img.data)[i * 4 + 3] = 0xff;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for (int i = 0; i < data_len / 4; i++) {
|
|
||||||
((uint8_t *)img.data)[i * 4 + 0] = data[i * 4 + 2];
|
|
||||||
((uint8_t *)img.data)[i * 4 + 1] = data[i * 4 + 1];
|
|
||||||
((uint8_t *)img.data)[i * 4 + 2] = data[i * 4 + 0];
|
|
||||||
((uint8_t *)img.data)[i * 4 + 3] = data[i * 4 + 3];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
free(gi_reply);
|
free(gi_reply);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue