1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:28:10 +00:00

LibWeb: Extract CanvasFillStrokeStyles class from CRC2D

This commit is contained in:
Sam Atkins 2022-08-12 15:46:31 +01:00 committed by Andreas Kling
parent aa87b9699e
commit afabd613bd
5 changed files with 70 additions and 36 deletions

View file

@ -46,17 +46,6 @@ NonnullRefPtr<HTMLCanvasElement> CanvasRenderingContext2D::canvas_for_binding()
return canvas_element();
}
void CanvasRenderingContext2D::set_fill_style(String style)
{
// FIXME: 2. If the given value is a CanvasPattern object that is marked as not origin-clean, then set this's origin-clean flag to false.
drawing_state().fill_style = Gfx::Color::from_string(style).value_or(Color::Black);
}
String CanvasRenderingContext2D::fill_style() const
{
return drawing_state().fill_style.to_string();
}
void CanvasRenderingContext2D::fill_rect(float x, float y, float width, float height)
{
auto painter = this->painter();
@ -81,17 +70,6 @@ void CanvasRenderingContext2D::clear_rect(float x, float y, float width, float h
did_draw(rect);
}
void CanvasRenderingContext2D::set_stroke_style(String style)
{
// FIXME: 2. If the given value is a CanvasPattern object that is marked as not origin-clean, then set this's origin-clean flag to false.
drawing_state().stroke_style = Gfx::Color::from_string(style).value_or(Color::Black);
}
String CanvasRenderingContext2D::stroke_style() const
{
return drawing_state().stroke_style.to_string();
}
void CanvasRenderingContext2D::stroke_rect(float x, float y, float width, float height)
{
auto painter = this->painter();