mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:27:35 +00:00
LibAccelGfx: Remove ability to change target canvas in painter
It is easier to build painter assuming target canvas won't change and we don't use this api anyway :)
This commit is contained in:
parent
161082e282
commit
4a2a37275e
3 changed files with 13 additions and 23 deletions
|
@ -13,9 +13,8 @@ PaintingCommandExecutorGPU::PaintingCommandExecutorGPU(AccelGfx::Context& contex
|
|||
: m_target_bitmap(bitmap)
|
||||
, m_context(context)
|
||||
{
|
||||
auto painter = AccelGfx::Painter::create(m_context);
|
||||
auto canvas = AccelGfx::Canvas::create(bitmap.size());
|
||||
painter->set_target_canvas(canvas);
|
||||
auto painter = AccelGfx::Painter::create(m_context, canvas);
|
||||
m_stacking_contexts.append({ .canvas = canvas,
|
||||
.painter = move(painter),
|
||||
.opacity = 1.0f,
|
||||
|
@ -115,9 +114,8 @@ CommandResult PaintingCommandExecutorGPU::push_stacking_context(float opacity, b
|
|||
final_transform.multiply(stacking_context_transform);
|
||||
final_transform.multiply(inverse_origin_translation);
|
||||
if (opacity < 1 || !stacking_context_transform.is_identity_or_translation()) {
|
||||
auto painter = AccelGfx::Painter::create(m_context);
|
||||
auto canvas = AccelGfx::Canvas::create(source_paintable_rect.size());
|
||||
painter->set_target_canvas(canvas);
|
||||
auto painter = AccelGfx::Painter::create(m_context, canvas);
|
||||
painter->translate(-source_paintable_rect.location().to_type<float>());
|
||||
painter->clear(Color::Transparent);
|
||||
m_stacking_contexts.append({ .canvas = canvas,
|
||||
|
@ -169,8 +167,7 @@ CommandResult PaintingCommandExecutorGPU::paint_inner_box_shadow(PaintOuterBoxSh
|
|||
CommandResult PaintingCommandExecutorGPU::paint_text_shadow(int blur_radius, Gfx::IntRect const& shadow_bounding_rect, Gfx::IntRect const& text_rect, Span<Gfx::DrawGlyphOrEmoji const> glyph_run, Color const& color, int fragment_baseline, Gfx::IntPoint const& draw_location)
|
||||
{
|
||||
auto text_shadow_canvas = AccelGfx::Canvas::create(shadow_bounding_rect.size());
|
||||
auto text_shadow_painter = AccelGfx::Painter::create(m_context);
|
||||
text_shadow_painter->set_target_canvas(text_shadow_canvas);
|
||||
auto text_shadow_painter = AccelGfx::Painter::create(m_context, text_shadow_canvas);
|
||||
text_shadow_painter->clear(color.with_alpha(0));
|
||||
|
||||
Gfx::FloatRect const shadow_location { draw_location, shadow_bounding_rect.size() };
|
||||
|
@ -183,8 +180,7 @@ CommandResult PaintingCommandExecutorGPU::paint_text_shadow(int blur_radius, Gfx
|
|||
}
|
||||
|
||||
auto horizontal_blur_canvas = AccelGfx::Canvas::create(shadow_bounding_rect.size());
|
||||
auto horizontal_blur_painter = AccelGfx::Painter::create(m_context);
|
||||
horizontal_blur_painter->set_target_canvas(horizontal_blur_canvas);
|
||||
auto horizontal_blur_painter = AccelGfx::Painter::create(m_context, horizontal_blur_canvas);
|
||||
horizontal_blur_painter->clear(color.with_alpha(0));
|
||||
horizontal_blur_painter->blit_blurred_canvas(shadow_bounding_rect.to_type<float>(), *text_shadow_canvas, blur_radius, AccelGfx::Painter::BlurDirection::Horizontal);
|
||||
painter().blit_blurred_canvas(shadow_location, *horizontal_blur_canvas, blur_radius, AccelGfx::Painter::BlurDirection::Vertical);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue