mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 04:27:45 +00:00
Meta+Userland: Pass Gfx::IntPoint by value
This is just two ints or 8 bytes or the size of the reference on x86_64 or AArch64.
This commit is contained in:
parent
bbc149ebb9
commit
7be0b27dd3
161 changed files with 442 additions and 441 deletions
|
@ -84,7 +84,7 @@ Color BrushTool::color_for(GUI::MouseEvent const& event)
|
|||
return m_editor->color_for(event);
|
||||
}
|
||||
|
||||
void BrushTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point)
|
||||
void BrushTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point)
|
||||
{
|
||||
constexpr auto flow_scale = 10;
|
||||
for (int y = point.y() - size(); y < point.y() + size(); y++) {
|
||||
|
@ -103,7 +103,7 @@ void BrushTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint
|
|||
}
|
||||
}
|
||||
|
||||
void BrushTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end)
|
||||
void BrushTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end)
|
||||
{
|
||||
int length_x = end.x() - start.x();
|
||||
int length_y = end.y() - start.y();
|
||||
|
|
|
@ -46,8 +46,8 @@ protected:
|
|||
virtual StringView tool_name() const override { return "Brush Tool"sv; }
|
||||
|
||||
virtual Color color_for(GUI::MouseEvent const& event);
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point);
|
||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end);
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point);
|
||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end);
|
||||
virtual NonnullRefPtr<Gfx::Bitmap> build_cursor();
|
||||
void refresh_editor_cursor();
|
||||
float m_scale_last_created_cursor = 0;
|
||||
|
|
|
@ -27,7 +27,7 @@ BucketTool::BucketTool()
|
|||
m_cursor = Gfx::Bitmap::try_load_from_file("/res/icons/pixelpaint/bucket.png"sv).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint const& start_position, Color fill_color, int threshold)
|
||||
static void flood_fill(Gfx::Bitmap& bitmap, Gfx::IntPoint start_position, Color fill_color, int threshold)
|
||||
{
|
||||
VERIFY(bitmap.bpp() == 32);
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
void CloneTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color, Gfx::IntPoint const& point)
|
||||
void CloneTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color, Gfx::IntPoint point)
|
||||
{
|
||||
if (!m_sample_location.has_value())
|
||||
return;
|
||||
|
@ -45,7 +45,7 @@ void CloneTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color, Gfx::IntPoint const&
|
|||
}
|
||||
}
|
||||
|
||||
void CloneTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end)
|
||||
void CloneTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end)
|
||||
{
|
||||
if (!m_sample_location.has_value())
|
||||
return;
|
||||
|
|
|
@ -21,8 +21,8 @@ public:
|
|||
virtual bool is_overriding_alt() override { return true; }
|
||||
|
||||
protected:
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point) override;
|
||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end) override;
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point) override;
|
||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end) override;
|
||||
|
||||
virtual void on_mousedown(Layer*, MouseEvent&) override;
|
||||
virtual void on_mousemove(Layer*, MouseEvent&) override;
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness)
|
||||
void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness)
|
||||
{
|
||||
Gfx::IntRect ellipse_intersecting_rect;
|
||||
if (m_draw_mode == DrawMode::FromCenter) {
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
FromCorner,
|
||||
};
|
||||
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness);
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness);
|
||||
|
||||
RefPtr<GUI::Widget> m_properties_widget;
|
||||
RefPtr<GUI::TextBox> m_aspect_w_textbox;
|
||||
|
|
|
@ -28,7 +28,7 @@ Color EraseTool::color_for(GUI::MouseEvent const&)
|
|||
return Color(255, 255, 255, 0);
|
||||
}
|
||||
|
||||
void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point)
|
||||
void EraseTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point)
|
||||
{
|
||||
if (m_draw_mode == DrawMode::Pencil) {
|
||||
int radius = size() / 2;
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
|
||||
protected:
|
||||
virtual Color color_for(GUI::MouseEvent const& event) override;
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point) override;
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point) override;
|
||||
virtual NonnullRefPtr<Gfx::Bitmap> build_cursor() override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
RefPtr<Guide> GuideTool::closest_guide(Gfx::IntPoint const& point)
|
||||
RefPtr<Guide> GuideTool::closest_guide(Gfx::IntPoint point)
|
||||
{
|
||||
auto guides = editor()->guides();
|
||||
Guide* closest_guide = nullptr;
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
private:
|
||||
virtual StringView tool_name() const override { return "Guide Tool"sv; }
|
||||
|
||||
RefPtr<Guide> closest_guide(Gfx::IntPoint const&);
|
||||
RefPtr<Guide> closest_guide(Gfx::IntPoint);
|
||||
|
||||
RefPtr<GUI::Widget> m_properties_widget;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
static Gfx::IntPoint constrain_line_angle(Gfx::IntPoint const& start_pos, Gfx::IntPoint const& end_pos, float angle_increment)
|
||||
static Gfx::IntPoint constrain_line_angle(Gfx::IntPoint start_pos, Gfx::IntPoint end_pos, float angle_increment)
|
||||
{
|
||||
float current_angle = AK::atan2<float>(end_pos.y() - start_pos.y(), end_pos.x() - start_pos.x()) + float { M_PI * 2 };
|
||||
|
||||
|
@ -56,7 +56,7 @@ void LineTool::on_mousedown(Layer* layer, MouseEvent& event)
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void LineTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, Color color, int thickness)
|
||||
void LineTool::draw_using(GUI::Painter& painter, Gfx::IntPoint start_position, Gfx::IntPoint end_position, Color color, int thickness)
|
||||
{
|
||||
if (m_antialias_enabled) {
|
||||
Gfx::AntiAliasingPainter aa_painter { painter };
|
||||
|
|
|
@ -26,7 +26,7 @@ public:
|
|||
virtual GUI::Widget* get_properties_widget() override;
|
||||
virtual Variant<Gfx::StandardCursor, NonnullRefPtr<Gfx::Bitmap>> cursor() override { return Gfx::StandardCursor::Crosshair; }
|
||||
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, Color color, int thickness);
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint start_position, Gfx::IntPoint end_position, Color color, int thickness);
|
||||
|
||||
virtual bool is_overriding_alt() override { return true; }
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ void MoveTool::on_mousemove(Layer* layer, MouseEvent& event)
|
|||
}
|
||||
|
||||
if (m_scaling) {
|
||||
auto& cursor_location = event.image_event().position();
|
||||
auto cursor_location = event.image_event().position();
|
||||
auto width = abs(m_layer_being_moved->location().x() - cursor_location.x());
|
||||
auto height = abs(m_layer_being_moved->location().y() - cursor_location.y());
|
||||
if (m_keep_ascept_ratio) {
|
||||
|
|
|
@ -23,13 +23,13 @@ PenTool::PenTool()
|
|||
set_size(1);
|
||||
}
|
||||
|
||||
void PenTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point)
|
||||
void PenTool::draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point)
|
||||
{
|
||||
GUI::Painter painter(bitmap);
|
||||
painter.draw_line(point, point, color, size());
|
||||
}
|
||||
|
||||
void PenTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end)
|
||||
void PenTool::draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end)
|
||||
{
|
||||
GUI::Painter painter(bitmap);
|
||||
painter.draw_line(start, end, color, size());
|
||||
|
|
|
@ -22,8 +22,8 @@ public:
|
|||
virtual GUI::Widget* get_properties_widget() override;
|
||||
|
||||
protected:
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& point) override;
|
||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint const& start, Gfx::IntPoint const& end) override;
|
||||
virtual void draw_point(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint point) override;
|
||||
virtual void draw_line(Gfx::Bitmap& bitmap, Gfx::Color color, Gfx::IntPoint start, Gfx::IntPoint end) override;
|
||||
|
||||
private:
|
||||
virtual StringView tool_name() const override { return "Pen Tool"sv; }
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness, int corner_radius)
|
||||
void RectangleTool::draw_using(GUI::Painter& painter, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness, int corner_radius)
|
||||
{
|
||||
Gfx::IntRect rect;
|
||||
if (m_draw_mode == DrawMode::FromCenter) {
|
||||
|
|
|
@ -42,7 +42,7 @@ private:
|
|||
FromCorner,
|
||||
};
|
||||
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint const& start_position, Gfx::IntPoint const& end_position, int thickness, int corner_radius);
|
||||
void draw_using(GUI::Painter&, Gfx::IntPoint start_position, Gfx::IntPoint end_position, int thickness, int corner_radius);
|
||||
|
||||
RefPtr<GUI::Widget> m_properties_widget;
|
||||
RefPtr<GUI::TextBox> m_aspect_w_textbox;
|
||||
|
|
|
@ -62,7 +62,7 @@ Gfx::IntPoint Tool::editor_layer_location(Layer const& layer) const
|
|||
return (Gfx::FloatPoint { layer.location() } * m_editor->scale()).to_rounded<int>();
|
||||
}
|
||||
|
||||
Gfx::IntPoint Tool::editor_stroke_position(Gfx::IntPoint const& pixel_coords, int stroke_thickness) const
|
||||
Gfx::IntPoint Tool::editor_stroke_position(Gfx::IntPoint pixel_coords, int stroke_thickness) const
|
||||
{
|
||||
auto position = m_editor->content_to_frame_position(pixel_coords);
|
||||
auto offset = (stroke_thickness % 2 == 0) ? 0 : m_editor->scale() / 2;
|
||||
|
|
|
@ -89,7 +89,7 @@ protected:
|
|||
|
||||
Gfx::IntPoint editor_layer_location(Layer const& layer) const;
|
||||
|
||||
virtual Gfx::IntPoint editor_stroke_position(Gfx::IntPoint const& pixel_coords, int stroke_thickness) const;
|
||||
virtual Gfx::IntPoint editor_stroke_position(Gfx::IntPoint pixel_coords, int stroke_thickness) const;
|
||||
|
||||
void set_primary_slider(GUI::ValueSlider* primary) { m_primary_slider = primary; }
|
||||
void set_secondary_slider(GUI::ValueSlider* secondary) { m_secondary_slider = secondary; }
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint const& start_position, Gfx::IntPoint const& selection_offset, int threshold, Selection::MergeMode merge_mode)
|
||||
static void set_flood_selection(Gfx::Bitmap& bitmap, Image& image, Gfx::IntPoint start_position, Gfx::IntPoint selection_offset, int threshold, Selection::MergeMode merge_mode)
|
||||
{
|
||||
VERIFY(bitmap.bpp() == 32);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue