mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-31 15:32:51 +00:00
LibWeb/WebGL: Enforce minimum size when resizing existing context
Previously the enforcement was only done on creation. Not enforcing it on change would cause a crash if the canvas width/height was set to zero or less.
This commit is contained in:
parent
8e453d5069
commit
216d5b33be
Notes:
github-actions[bot]
2025-01-08 14:59:35 +00:00
Author: https://github.com/Lubrsi
Commit: 216d5b33be
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2943
Reviewed-by: https://github.com/kalenikaliaksandr
2 changed files with 8 additions and 2 deletions
|
@ -129,7 +129,10 @@ Optional<WebGLContextAttributes> WebGL2RenderingContext::get_context_attributes(
|
|||
|
||||
void WebGL2RenderingContext::set_size(Gfx::IntSize const& size)
|
||||
{
|
||||
context().set_size(size);
|
||||
Gfx::IntSize final_size;
|
||||
final_size.set_width(max(size.width(), 1));
|
||||
final_size.set_height(max(size.height(), 1));
|
||||
context().set_size(final_size);
|
||||
}
|
||||
|
||||
void WebGL2RenderingContext::reset_to_default_state()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue