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

LibDraw: Put all classes in the Gfx namespace

I started adding things to a Draw namespace, but it somehow felt really
wrong seeing Draw::Rect and Draw::Bitmap, etc. So instead, let's rename
the library to LibGfx. :^)
This commit is contained in:
Andreas Kling 2020-02-06 11:56:38 +01:00
parent 939a605334
commit 11580babbf
269 changed files with 1513 additions and 1315 deletions

View file

@ -344,7 +344,7 @@ void LayoutBlock::render(RenderingContext& context)
}
}
HitTestResult LayoutBlock::hit_test(const Point& position) const
HitTestResult LayoutBlock::hit_test(const Gfx::Point& position) const
{
if (!children_are_inline())
return LayoutBox::hit_test(position);

View file

@ -49,7 +49,7 @@ public:
LineBox& ensure_last_line_box();
LineBox& add_line_box();
virtual HitTestResult hit_test(const Point&) const override;
virtual HitTestResult hit_test(const Gfx::Point&) const override;
LayoutBlock* previous_sibling() { return to<LayoutBlock>(LayoutNode::previous_sibling()); }
const LayoutBlock* previous_sibling() const { return to<LayoutBlock>(LayoutNode::previous_sibling()); }

View file

@ -207,7 +207,7 @@ void LayoutBox::render(RenderingContext& context)
LayoutNodeWithStyleAndBoxModelMetrics::render(context);
}
HitTestResult LayoutBox::hit_test(const Point& position) const
HitTestResult LayoutBox::hit_test(const Gfx::Point& position) const
{
// FIXME: It would be nice if we could confidently skip over hit testing
// parts of the layout tree, but currently we can't just check

View file

@ -42,7 +42,7 @@ public:
FloatSize size() const { return rect().size(); }
FloatPoint position() const { return rect().location(); }
virtual HitTestResult hit_test(const Point& position) const override;
virtual HitTestResult hit_test(const Gfx::Point& position) const override;
virtual void set_needs_display() override;
bool is_body() const;

View file

@ -57,7 +57,7 @@ void LayoutDocument::layout()
rect().set_bottom(lowest_bottom);
}
void LayoutDocument::did_set_viewport_rect(Badge<Frame>, const Rect& a_viewport_rect)
void LayoutDocument::did_set_viewport_rect(Badge<Frame>, const Gfx::Rect& a_viewport_rect)
{
FloatRect viewport_rect(a_viewport_rect.x(), a_viewport_rect.y(), a_viewport_rect.width(), a_viewport_rect.height());
for_each_in_subtree_of_type<LayoutImage>([&](auto& layout_image) {

View file

@ -41,7 +41,7 @@ public:
const LayoutRange& selection() const { return m_selection; }
LayoutRange& selection() { return m_selection; }
void did_set_viewport_rect(Badge<Frame>, const Rect&);
void did_set_viewport_rect(Badge<Frame>, const Gfx::Rect&);
private:
LayoutRange m_selection;

View file

@ -44,7 +44,7 @@ void LayoutImage::layout()
rect().set_width(node().preferred_width());
rect().set_height(node().preferred_height());
} else if (renders_as_alt_text()) {
auto& font = Font::default_font();
auto& font = Gfx::Font::default_font();
auto alt = node().alt();
if (alt.is_empty())
alt = node().src();
@ -68,12 +68,12 @@ void LayoutImage::render(RenderingContext& context)
return;
if (renders_as_alt_text()) {
context.painter().set_font(Font::default_font());
StylePainter::paint_frame(context.painter(), enclosing_int_rect(rect()), context.palette(), FrameShape::Container, FrameShadow::Sunken, 2);
context.painter().set_font(Gfx::Font::default_font());
Gfx::StylePainter::paint_frame(context.painter(), enclosing_int_rect(rect()), context.palette(), Gfx::FrameShape::Container, Gfx::FrameShadow::Sunken, 2);
auto alt = node().alt();
if (alt.is_empty())
alt = node().src();
context.painter().draw_text(enclosing_int_rect(rect()), alt, TextAlignment::Center, style().color_or_fallback(CSS::PropertyID::Color, document(), Color::Black), TextElision::Right);
context.painter().draw_text(enclosing_int_rect(rect()), alt, Gfx::TextAlignment::Center, style().color_or_fallback(CSS::PropertyID::Color, document(), Color::Black), Gfx::TextElision::Right);
} else if (node().bitmap())
context.painter().draw_scaled_bitmap(enclosing_int_rect(rect()), *node().bitmap(), node().bitmap()->rect());
LayoutReplaced::render(context);

View file

@ -71,7 +71,7 @@ void LayoutNode::render(RenderingContext& context)
});
}
HitTestResult LayoutNode::hit_test(const Point& position) const
HitTestResult LayoutNode::hit_test(const Gfx::Point& position) const
{
HitTestResult result;
for_each_child([&](auto& child) {

View file

@ -54,7 +54,7 @@ class LayoutNode : public TreeNode<LayoutNode> {
public:
virtual ~LayoutNode();
virtual HitTestResult hit_test(const Point&) const;
virtual HitTestResult hit_test(const Gfx::Point&) const;
bool is_anonymous() const { return !m_node; }
const Node* node() const { return m_node; }

View file

@ -82,7 +82,7 @@ void LayoutText::render_fragment(RenderingContext& context, const LineBoxFragmen
if (is_underline)
painter.draw_line(enclosing_int_rect(fragment.rect()).bottom_left().translated(0, 1), enclosing_int_rect(fragment.rect()).bottom_right().translated(0, 1), color);
painter.draw_text(enclosing_int_rect(fragment.rect()), m_text_for_rendering.substring_view(fragment.start(), fragment.length()), TextAlignment::TopLeft, color);
painter.draw_text(enclosing_int_rect(fragment.rect()), m_text_for_rendering.substring_view(fragment.start(), fragment.length()), Gfx::TextAlignment::TopLeft, color);
}
template<typename Callback>