mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:17:35 +00:00
LibWeb: Get rid of DevicePixels usage in RecordingPainter
This change removes inconsistency in coordinate representation of painter commands by changing everything to use int.
This commit is contained in:
parent
b91d03c2b8
commit
94f322867a
6 changed files with 48 additions and 48 deletions
|
@ -103,7 +103,7 @@ void apply_backdrop_filter(PaintContext& context, CSSPixelRect const& backdrop_r
|
||||||
auto backdrop_region = context.rounded_device_rect(backdrop_rect);
|
auto backdrop_region = context.rounded_device_rect(backdrop_rect);
|
||||||
|
|
||||||
ScopedCornerRadiusClip corner_clipper { context, backdrop_region, border_radii_data };
|
ScopedCornerRadiusClip corner_clipper { context, backdrop_region, border_radii_data };
|
||||||
context.painter().apply_backdrop_filter(backdrop_region, border_radii_data, backdrop_filter);
|
context.painter().apply_backdrop_filter(backdrop_region.to_type<int>(), border_radii_data, backdrop_filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ void paint_conic_gradient(PaintContext& context, DevicePixelRect const& gradient
|
||||||
|
|
||||||
void paint_radial_gradient(PaintContext& context, DevicePixelRect const& gradient_rect, RadialGradientData const& data, DevicePixelPoint center, DevicePixelSize size)
|
void paint_radial_gradient(PaintContext& context, DevicePixelRect const& gradient_rect, RadialGradientData const& data, DevicePixelPoint center, DevicePixelSize size)
|
||||||
{
|
{
|
||||||
context.painter().fill_rect_with_radial_gradient(gradient_rect.to_type<int>(), data, center, size);
|
context.painter().fill_rect_with_radial_gradient(gradient_rect.to_type<int>(), data, center.to_type<int>(), size.to_type<int>());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ CommandResult PushStackingContext::execute(CommandExecutionState& state) const
|
||||||
|
|
||||||
Gfx::Painter stacking_context_painter(bitmap);
|
Gfx::Painter stacking_context_painter(bitmap);
|
||||||
|
|
||||||
stacking_context_painter.translate(painter_location.to_type<int>() + destination_clipped_fixup.to_type<int>());
|
stacking_context_painter.translate(painter_location + destination_clipped_fixup.to_type<int>());
|
||||||
|
|
||||||
state.stacking_contexts.append(CommandExecutionState::StackingContext {
|
state.stacking_contexts.append(CommandExecutionState::StackingContext {
|
||||||
.painter = stacking_context_painter,
|
.painter = stacking_context_painter,
|
||||||
|
@ -260,14 +260,14 @@ CommandResult PopStackingContext::execute(CommandExecutionState& state) const
|
||||||
|
|
||||||
CommandResult PushStackingContextWithMask::execute(CommandExecutionState& state) const
|
CommandResult PushStackingContextWithMask::execute(CommandExecutionState& state) const
|
||||||
{
|
{
|
||||||
auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, paint_rect.size().to_type<int>());
|
auto bitmap_or_error = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, paint_rect.size());
|
||||||
if (bitmap_or_error.is_error())
|
if (bitmap_or_error.is_error())
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
auto bitmap = bitmap_or_error.release_value();
|
auto bitmap = bitmap_or_error.release_value();
|
||||||
|
|
||||||
Gfx::Painter stacking_context_painter(bitmap);
|
Gfx::Painter stacking_context_painter(bitmap);
|
||||||
|
|
||||||
stacking_context_painter.translate(-paint_rect.location().to_type<int>());
|
stacking_context_painter.translate(-paint_rect.location());
|
||||||
|
|
||||||
state.stacking_contexts.append(CommandExecutionState::StackingContext {
|
state.stacking_contexts.append(CommandExecutionState::StackingContext {
|
||||||
.painter = stacking_context_painter,
|
.painter = stacking_context_painter,
|
||||||
|
@ -284,7 +284,7 @@ CommandResult PopStackingContextWithMask::execute(CommandExecutionState& state)
|
||||||
auto bitmap = stacking_context.painter.target();
|
auto bitmap = stacking_context.painter.target();
|
||||||
if (mask_bitmap)
|
if (mask_bitmap)
|
||||||
bitmap->apply_mask(*mask_bitmap, mask_kind);
|
bitmap->apply_mask(*mask_bitmap, mask_kind);
|
||||||
state.painter().blit(paint_rect.location().to_type<int>(), *bitmap, bitmap->rect(), opacity);
|
state.painter().blit(paint_rect.location(), *bitmap, bitmap->rect(), opacity);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,11 +336,11 @@ CommandResult PaintInnerBoxShadow::execute(CommandExecutionState& state) const
|
||||||
|
|
||||||
CommandResult PaintTextShadow::execute(CommandExecutionState& state) const
|
CommandResult PaintTextShadow::execute(CommandExecutionState& state) const
|
||||||
{
|
{
|
||||||
if (state.would_be_fully_clipped_by_painter(text_rect.to_type<int>()))
|
if (state.would_be_fully_clipped_by_painter(text_rect))
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
|
|
||||||
// FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it?
|
// FIXME: Figure out the maximum bitmap size for all shadows and then allocate it once and reuse it?
|
||||||
auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, bounding_rect.size().to_type<int>());
|
auto maybe_shadow_bitmap = Gfx::Bitmap::create(Gfx::BitmapFormat::BGRA8888, bounding_rect.size());
|
||||||
if (maybe_shadow_bitmap.is_error()) {
|
if (maybe_shadow_bitmap.is_error()) {
|
||||||
dbgln("Unable to allocate temporary bitmap {} for text-shadow rendering: {}", bounding_rect.size(), maybe_shadow_bitmap.error());
|
dbgln("Unable to allocate temporary bitmap {} for text-shadow rendering: {}", bounding_rect.size(), maybe_shadow_bitmap.error());
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
|
@ -349,15 +349,15 @@ CommandResult PaintTextShadow::execute(CommandExecutionState& state) const
|
||||||
|
|
||||||
Gfx::Painter shadow_painter { *shadow_bitmap };
|
Gfx::Painter shadow_painter { *shadow_bitmap };
|
||||||
// FIXME: "Spread" the shadow somehow.
|
// FIXME: "Spread" the shadow somehow.
|
||||||
DevicePixelPoint baseline_start(text_rect.x(), text_rect.y() + fragment_baseline);
|
Gfx::IntPoint baseline_start(text_rect.x(), text_rect.y() + fragment_baseline);
|
||||||
shadow_painter.draw_text_run(baseline_start.to_type<int>(), Utf8View(text), font, color);
|
shadow_painter.draw_text_run(baseline_start, Utf8View(text), font, color);
|
||||||
|
|
||||||
// Blur
|
// Blur
|
||||||
Gfx::StackBlurFilter filter(*shadow_bitmap);
|
Gfx::StackBlurFilter filter(*shadow_bitmap);
|
||||||
filter.process_rgba(blur_radius.value(), color);
|
filter.process_rgba(blur_radius, color);
|
||||||
|
|
||||||
auto& painter = state.painter();
|
auto& painter = state.painter();
|
||||||
painter.blit(draw_location.to_type<int>(), *shadow_bitmap, bounding_rect.to_type<int>());
|
painter.blit(draw_location, *shadow_bitmap, bounding_rect);
|
||||||
return CommandResult::Continue;
|
return CommandResult::Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -588,13 +588,13 @@ void RecordingPainter::fill_rect_with_conic_gradient(Gfx::IntRect const& rect, C
|
||||||
.position = position });
|
.position = position });
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPainter::fill_rect_with_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const& data, DevicePixelPoint center, DevicePixelSize size)
|
void RecordingPainter::fill_rect_with_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const& data, Gfx::IntPoint center, Gfx::IntSize size)
|
||||||
{
|
{
|
||||||
push_command(PaintRadialGradient {
|
push_command(PaintRadialGradient {
|
||||||
.rect = rect,
|
.rect = rect,
|
||||||
.radial_gradient_data = data,
|
.radial_gradient_data = data,
|
||||||
.center = center.to_type<int>(),
|
.center = center,
|
||||||
.size = size.to_type<int>() });
|
.size = size });
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPainter::draw_rect(Gfx::IntRect const& rect, Color color, bool rough)
|
void RecordingPainter::draw_rect(Gfx::IntRect const& rect, Color color, bool rough)
|
||||||
|
@ -753,10 +753,10 @@ void RecordingPainter::paint_frame(Gfx::IntRect rect, Palette palette, Gfx::Fram
|
||||||
push_command(PaintFrame { rect, palette, style });
|
push_command(PaintFrame { rect, palette, style });
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPainter::apply_backdrop_filter(DevicePixelRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter)
|
void RecordingPainter::apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter)
|
||||||
{
|
{
|
||||||
push_command(ApplyBackdropFilter {
|
push_command(ApplyBackdropFilter {
|
||||||
.backdrop_region = backdrop_region.to_type<int>(),
|
.backdrop_region = backdrop_region,
|
||||||
.border_radii_data = border_radii_data,
|
.border_radii_data = border_radii_data,
|
||||||
.backdrop_filter = backdrop_filter,
|
.backdrop_filter = backdrop_filter,
|
||||||
});
|
});
|
||||||
|
@ -776,7 +776,7 @@ void RecordingPainter::paint_inner_box_shadow_params(PaintOuterBoxShadowParams p
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPainter::paint_text_shadow(DevicePixels blur_radius, DevicePixelRect bounding_rect, DevicePixelRect text_rect, Utf8View text, Gfx::Font const& font, Color color, DevicePixels fragment_baseline, DevicePixelPoint draw_location)
|
void RecordingPainter::paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Utf8View text, Gfx::Font const& font, Color color, int fragment_baseline, Gfx::IntPoint draw_location)
|
||||||
{
|
{
|
||||||
push_command(PaintTextShadow {
|
push_command(PaintTextShadow {
|
||||||
.blur_radius = blur_radius,
|
.blur_radius = blur_radius,
|
||||||
|
@ -815,12 +815,12 @@ void RecordingPainter::fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect
|
||||||
{ bottom_left_radius, bottom_left_radius });
|
{ bottom_left_radius, bottom_left_radius });
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPainter::push_stacking_context_with_mask(DevicePixelRect paint_rect)
|
void RecordingPainter::push_stacking_context_with_mask(Gfx::IntRect paint_rect)
|
||||||
{
|
{
|
||||||
push_command(PushStackingContextWithMask { .paint_rect = paint_rect });
|
push_command(PushStackingContextWithMask { .paint_rect = paint_rect });
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordingPainter::pop_stacking_context_with_mask(RefPtr<Gfx::Bitmap> mask_bitmap, Gfx::Bitmap::MaskKind mask_kind, DevicePixelRect paint_rect, float opacity)
|
void RecordingPainter::pop_stacking_context_with_mask(RefPtr<Gfx::Bitmap> mask_bitmap, Gfx::Bitmap::MaskKind mask_kind, Gfx::IntRect paint_rect, float opacity)
|
||||||
{
|
{
|
||||||
push_command(PopStackingContextWithMask {
|
push_command(PopStackingContextWithMask {
|
||||||
.paint_rect = paint_rect,
|
.paint_rect = paint_rect,
|
||||||
|
|
|
@ -115,7 +115,7 @@ struct PushStackingContext {
|
||||||
float opacity;
|
float opacity;
|
||||||
Gfx::FloatRect source_rect;
|
Gfx::FloatRect source_rect;
|
||||||
Gfx::FloatRect transformed_destination_rect;
|
Gfx::FloatRect transformed_destination_rect;
|
||||||
DevicePixelPoint painter_location;
|
Gfx::IntPoint painter_location;
|
||||||
|
|
||||||
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
|
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
|
||||||
};
|
};
|
||||||
|
@ -128,13 +128,13 @@ struct PopStackingContext {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PushStackingContextWithMask {
|
struct PushStackingContextWithMask {
|
||||||
DevicePixelRect paint_rect;
|
Gfx::IntRect paint_rect;
|
||||||
|
|
||||||
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
|
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PopStackingContextWithMask {
|
struct PopStackingContextWithMask {
|
||||||
DevicePixelRect paint_rect;
|
Gfx::IntRect paint_rect;
|
||||||
RefPtr<Gfx::Bitmap> mask_bitmap;
|
RefPtr<Gfx::Bitmap> mask_bitmap;
|
||||||
Gfx::Bitmap::MaskKind mask_kind;
|
Gfx::Bitmap::MaskKind mask_kind;
|
||||||
float opacity;
|
float opacity;
|
||||||
|
@ -162,14 +162,14 @@ struct PaintInnerBoxShadow {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PaintTextShadow {
|
struct PaintTextShadow {
|
||||||
DevicePixels blur_radius;
|
int blur_radius;
|
||||||
DevicePixelRect bounding_rect;
|
Gfx::IntRect bounding_rect;
|
||||||
DevicePixelRect text_rect;
|
Gfx::IntRect text_rect;
|
||||||
String text;
|
String text;
|
||||||
NonnullRefPtr<Gfx::Font> font;
|
NonnullRefPtr<Gfx::Font> font;
|
||||||
Color color;
|
Color color;
|
||||||
DevicePixels fragment_baseline;
|
int fragment_baseline;
|
||||||
DevicePixelPoint draw_location;
|
Gfx::IntPoint draw_location;
|
||||||
|
|
||||||
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
|
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
|
||||||
};
|
};
|
||||||
|
@ -421,7 +421,7 @@ public:
|
||||||
|
|
||||||
void fill_rect_with_linear_gradient(Gfx::IntRect const& gradient_rect, LinearGradientData const& data);
|
void fill_rect_with_linear_gradient(Gfx::IntRect const& gradient_rect, LinearGradientData const& data);
|
||||||
void fill_rect_with_conic_gradient(Gfx::IntRect const& rect, ConicGradientData const& data, Gfx::IntPoint const& position);
|
void fill_rect_with_conic_gradient(Gfx::IntRect const& rect, ConicGradientData const& data, Gfx::IntPoint const& position);
|
||||||
void fill_rect_with_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const& data, DevicePixelPoint center, DevicePixelSize size);
|
void fill_rect_with_radial_gradient(Gfx::IntRect const& rect, RadialGradientData const& data, Gfx::IntPoint center, Gfx::IntSize size);
|
||||||
|
|
||||||
void draw_rect(Gfx::IntRect const& rect, Color color, bool rough = false);
|
void draw_rect(Gfx::IntRect const& rect, Color color, bool rough = false);
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ public:
|
||||||
float opacity;
|
float opacity;
|
||||||
Gfx::FloatRect source_rect;
|
Gfx::FloatRect source_rect;
|
||||||
Gfx::FloatRect transformed_destination_rect;
|
Gfx::FloatRect transformed_destination_rect;
|
||||||
DevicePixelPoint painter_location;
|
Gfx::IntPoint painter_location;
|
||||||
};
|
};
|
||||||
void push_stacking_context(PushStackingContextParams params);
|
void push_stacking_context(PushStackingContextParams params);
|
||||||
|
|
||||||
|
@ -464,8 +464,8 @@ public:
|
||||||
};
|
};
|
||||||
void pop_stacking_context(PopStackingContextParams params);
|
void pop_stacking_context(PopStackingContextParams params);
|
||||||
|
|
||||||
void push_stacking_context_with_mask(DevicePixelRect paint_rect);
|
void push_stacking_context_with_mask(Gfx::IntRect paint_rect);
|
||||||
void pop_stacking_context_with_mask(RefPtr<Gfx::Bitmap> mask_bitmap, Gfx::Bitmap::MaskKind mask_kind, DevicePixelRect paint_rect, float opacity);
|
void pop_stacking_context_with_mask(RefPtr<Gfx::Bitmap> mask_bitmap, Gfx::Bitmap::MaskKind mask_kind, Gfx::IntRect paint_rect, float opacity);
|
||||||
|
|
||||||
void sample_under_corners(NonnullRefPtr<BorderRadiusCornerClipper> corner_clipper);
|
void sample_under_corners(NonnullRefPtr<BorderRadiusCornerClipper> corner_clipper);
|
||||||
void blit_corner_clipping(NonnullRefPtr<BorderRadiusCornerClipper> corner_clipper);
|
void blit_corner_clipping(NonnullRefPtr<BorderRadiusCornerClipper> corner_clipper);
|
||||||
|
@ -473,11 +473,11 @@ public:
|
||||||
void paint_progressbar(Gfx::IntRect frame_rect, Gfx::IntRect progress_rect, Palette palette, int min, int max, int value, StringView text);
|
void paint_progressbar(Gfx::IntRect frame_rect, Gfx::IntRect progress_rect, Palette palette, int min, int max, int value, StringView text);
|
||||||
void paint_frame(Gfx::IntRect rect, Palette palette, Gfx::FrameStyle style);
|
void paint_frame(Gfx::IntRect rect, Palette palette, Gfx::FrameStyle style);
|
||||||
|
|
||||||
void apply_backdrop_filter(DevicePixelRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter);
|
void apply_backdrop_filter(Gfx::IntRect const& backdrop_region, BorderRadiiData const& border_radii_data, CSS::ResolvedBackdropFilter const& backdrop_filter);
|
||||||
|
|
||||||
void paint_outer_box_shadow_params(PaintOuterBoxShadowParams params);
|
void paint_outer_box_shadow_params(PaintOuterBoxShadowParams params);
|
||||||
void paint_inner_box_shadow_params(PaintOuterBoxShadowParams params);
|
void paint_inner_box_shadow_params(PaintOuterBoxShadowParams params);
|
||||||
void paint_text_shadow(DevicePixels blur_radius, DevicePixelRect bounding_rect, DevicePixelRect text_rect, Utf8View text, Gfx::Font const& font, Color color, DevicePixels fragment_baseline, DevicePixelPoint draw_location);
|
void paint_text_shadow(int blur_radius, Gfx::IntRect bounding_rect, Gfx::IntRect text_rect, Utf8View text, Gfx::Font const& font, Color color, int fragment_baseline, Gfx::IntPoint draw_location);
|
||||||
|
|
||||||
void fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color color, Gfx::AntiAliasingPainter::CornerRadius top_left_radius, Gfx::AntiAliasingPainter::CornerRadius top_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_left_radius);
|
void fill_rect_with_rounded_corners(Gfx::IntRect const& rect, Color color, Gfx::AntiAliasingPainter::CornerRadius top_left_radius, Gfx::AntiAliasingPainter::CornerRadius top_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_right_radius, Gfx::AntiAliasingPainter::CornerRadius bottom_left_radius);
|
||||||
void fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int radius);
|
void fill_rect_with_rounded_corners(Gfx::IntRect const& a_rect, Color color, int radius);
|
||||||
|
|
|
@ -583,32 +583,32 @@ void paint_text_shadow(PaintContext& context, Layout::LineBoxFragment const& fra
|
||||||
if (shadow_layers.is_empty() || fragment.text().is_empty())
|
if (shadow_layers.is_empty() || fragment.text().is_empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto fragment_width = context.enclosing_device_pixels(fragment.width());
|
auto fragment_width = context.enclosing_device_pixels(fragment.width()).value();
|
||||||
auto fragment_height = context.enclosing_device_pixels(fragment.height());
|
auto fragment_height = context.enclosing_device_pixels(fragment.height()).value();
|
||||||
auto draw_rect = context.enclosing_device_rect(fragment.absolute_rect());
|
auto draw_rect = context.enclosing_device_rect(fragment.absolute_rect()).to_type<int>();
|
||||||
auto text = Utf8View(fragment.text());
|
auto text = Utf8View(fragment.text());
|
||||||
auto& font = fragment.layout_node().scaled_font(context);
|
auto& font = fragment.layout_node().scaled_font(context);
|
||||||
auto fragment_baseline = context.rounded_device_pixels(fragment.baseline());
|
auto fragment_baseline = context.rounded_device_pixels(fragment.baseline()).value();
|
||||||
|
|
||||||
// Note: Box-shadow layers are ordered front-to-back, so we paint them in reverse
|
// Note: Box-shadow layers are ordered front-to-back, so we paint them in reverse
|
||||||
for (auto& layer : shadow_layers.in_reverse()) {
|
for (auto& layer : shadow_layers.in_reverse()) {
|
||||||
DevicePixels offset_x = context.rounded_device_pixels(layer.offset_x);
|
int offset_x = context.rounded_device_pixels(layer.offset_x).value();
|
||||||
DevicePixels offset_y = context.rounded_device_pixels(layer.offset_y);
|
int offset_y = context.rounded_device_pixels(layer.offset_y).value();
|
||||||
DevicePixels blur_radius = context.rounded_device_pixels(layer.blur_radius);
|
int blur_radius = context.rounded_device_pixels(layer.blur_radius).value();
|
||||||
|
|
||||||
// Space around the painted text to allow it to blur.
|
// Space around the painted text to allow it to blur.
|
||||||
// FIXME: Include spread in this once we use that.
|
// FIXME: Include spread in this once we use that.
|
||||||
DevicePixels margin = blur_radius * 2;
|
int margin = blur_radius * 2;
|
||||||
DevicePixelRect text_rect {
|
Gfx::IntRect text_rect {
|
||||||
margin, margin,
|
margin, margin,
|
||||||
fragment_width, fragment_height
|
fragment_width, fragment_height
|
||||||
};
|
};
|
||||||
DevicePixelRect bounding_rect {
|
Gfx::IntRect bounding_rect {
|
||||||
0, 0,
|
0, 0,
|
||||||
text_rect.width() + margin + margin,
|
text_rect.width() + margin + margin,
|
||||||
text_rect.height() + margin + margin
|
text_rect.height() + margin + margin
|
||||||
};
|
};
|
||||||
DevicePixelPoint draw_location {
|
Gfx::IntPoint draw_location {
|
||||||
draw_rect.x() + offset_x - margin,
|
draw_rect.x() + offset_x - margin,
|
||||||
draw_rect.y() + offset_y - margin
|
draw_rect.y() + offset_y - margin
|
||||||
};
|
};
|
||||||
|
|
|
@ -300,12 +300,12 @@ void StackingContext::paint(PaintContext& context) const
|
||||||
if (masking_area->is_empty())
|
if (masking_area->is_empty())
|
||||||
return;
|
return;
|
||||||
auto paint_rect = context.enclosing_device_rect(*masking_area);
|
auto paint_rect = context.enclosing_device_rect(*masking_area);
|
||||||
context.painter().push_stacking_context_with_mask(paint_rect);
|
context.painter().push_stacking_context_with_mask(paint_rect.to_type<int>());
|
||||||
paint_internal(context);
|
paint_internal(context);
|
||||||
|
|
||||||
auto mask_bitmap = paintable_box().calculate_mask(context, *masking_area);
|
auto mask_bitmap = paintable_box().calculate_mask(context, *masking_area);
|
||||||
auto mask_type = paintable_box().get_mask_type();
|
auto mask_type = paintable_box().get_mask_type();
|
||||||
context.painter().pop_stacking_context_with_mask(mask_bitmap, *mask_type, paint_rect, opacity);
|
context.painter().pop_stacking_context_with_mask(mask_bitmap, *mask_type, paint_rect.to_type<int>(), opacity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ void StackingContext::paint(PaintContext& context) const
|
||||||
.opacity = opacity,
|
.opacity = opacity,
|
||||||
.source_rect = source_rect,
|
.source_rect = source_rect,
|
||||||
.transformed_destination_rect = transformed_destination_rect,
|
.transformed_destination_rect = transformed_destination_rect,
|
||||||
.painter_location = context.rounded_device_point(-paintable_box().absolute_paint_rect().location())
|
.painter_location = context.rounded_device_point(-paintable_box().absolute_paint_rect().location()).to_type<int>()
|
||||||
};
|
};
|
||||||
|
|
||||||
RecordingPainter::PopStackingContextParams pop_stacking_context_params {
|
RecordingPainter::PopStackingContextParams pop_stacking_context_params {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue