mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-22 09:59:48 +01:00
render: make wlr_renderer_begin return a bool
This commit is contained in:
parent
23540b5579
commit
a541c9510a
2 changed files with 12 additions and 4 deletions
|
@ -49,8 +49,10 @@ struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend);
|
|||
*
|
||||
* This should be called after wlr_output_attach_render(). Compositors must call
|
||||
* wlr_renderer_end() when they are done.
|
||||
*
|
||||
* Returns false on failure, in which case compositors shouldn't try rendering.
|
||||
*/
|
||||
void wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height);
|
||||
bool wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height);
|
||||
/**
|
||||
* Start a render pass on the provided struct wlr_buffer.
|
||||
*
|
||||
|
|
|
@ -70,12 +70,15 @@ bool renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer) {
|
|||
return r->impl->bind_buffer(r, buffer);
|
||||
}
|
||||
|
||||
void wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height) {
|
||||
bool wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height) {
|
||||
assert(!r->rendering);
|
||||
|
||||
r->impl->begin(r, width, height);
|
||||
if (!r->impl->begin(r, width, height)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
r->rendering = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wlr_renderer_begin_with_buffer(struct wlr_renderer *r,
|
||||
|
@ -83,7 +86,10 @@ bool wlr_renderer_begin_with_buffer(struct wlr_renderer *r,
|
|||
if (!renderer_bind_buffer(r, buffer)) {
|
||||
return false;
|
||||
}
|
||||
wlr_renderer_begin(r, buffer->width, buffer->height);
|
||||
if (!wlr_renderer_begin(r, buffer->width, buffer->height)) {
|
||||
renderer_bind_buffer(r, NULL);
|
||||
return false;
|
||||
}
|
||||
r->rendering_with_buffer = true;
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue