Implement ShmCreatePixmap
This commit is contained in:
parent
572a0b6bd5
commit
406ea61be0
|
|
@ -1208,7 +1208,7 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
|
|||
{
|
||||
auto& pixmap = object.object.get<Object::Pixmap>();
|
||||
|
||||
info.data = pixmap.data.span();
|
||||
info.data = pixmap.data;
|
||||
info.w = pixmap.width;
|
||||
info.h = pixmap.height;
|
||||
info.depth = pixmap.depth;
|
||||
|
|
@ -2439,7 +2439,8 @@ BAN::ErrorOr<void> handle_packet(Client& client_info, BAN::ConstByteSpan packet)
|
|||
.depth = request.depth,
|
||||
.width = request.width,
|
||||
.height = request.height,
|
||||
.data = BAN::move(data),
|
||||
.data = data.span(),
|
||||
.owned_data = BAN::move(data),
|
||||
}
|
||||
}))
|
||||
));
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ struct Object
|
|||
CARD8 depth;
|
||||
CARD32 width;
|
||||
CARD32 height;
|
||||
BAN::Vector<uint8_t> data;
|
||||
BAN::ByteSpan data;
|
||||
BAN::Vector<uint8_t> owned_data;
|
||||
};
|
||||
|
||||
struct GraphicsContext
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ static BAN::ErrorOr<void> extension_shm(Client& client_info, BAN::ConstByteSpan
|
|||
{
|
||||
auto& pixmap = object.object.get<Object::Pixmap>();
|
||||
|
||||
info.data = pixmap.data.span();
|
||||
info.data = pixmap.data;
|
||||
info.w = pixmap.width;
|
||||
info.h = pixmap.height;
|
||||
info.depth = pixmap.depth;
|
||||
|
|
@ -305,6 +305,40 @@ static BAN::ErrorOr<void> extension_shm(Client& client_info, BAN::ConstByteSpan
|
|||
|
||||
break;
|
||||
}
|
||||
case X_ShmCreatePixmap:
|
||||
{
|
||||
auto request = decode<xShmCreatePixmapReq>(packet).value();
|
||||
|
||||
dprintln("ShmCreatePixmap");
|
||||
dprintln(" depth: {}", request.depth);
|
||||
dprintln(" pid: {}", request.pid);
|
||||
dprintln(" drawable: {}", request.drawable);
|
||||
dprintln(" width: {}", request.width);
|
||||
dprintln(" height: {}", request.height);
|
||||
dprintln(" shmseg: {}", request.shmseg);
|
||||
dprintln(" offset: {}", request.offset);
|
||||
|
||||
ASSERT(request.depth == 24 || request.depth == 32);
|
||||
|
||||
void* shm_segment = TRY(get_shmseg(request.shmseg));
|
||||
|
||||
TRY(client_info.objects.insert(request.pid));
|
||||
TRY(g_objects.insert(
|
||||
request.pid,
|
||||
TRY(BAN::UniqPtr<Object>::create(Object {
|
||||
.type = Object::Type::Pixmap,
|
||||
.object = Object::Pixmap {
|
||||
.depth = request.depth,
|
||||
.width = request.width,
|
||||
.height = request.height,
|
||||
.data = BAN::ByteSpan(static_cast<uint8_t*>(shm_segment) + request.offset, request.width * request.height * 4),
|
||||
.owned_data = {},
|
||||
}
|
||||
}))
|
||||
));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
dwarnln("unsupported shm minor opcode {}", packet[1]);
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in New Issue