mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 03:37:35 +00:00
LibGfx: Templatize Point, Size, and Rect
This commit is contained in:
parent
7a1c328417
commit
335916d8db
33 changed files with 404 additions and 835 deletions
|
@ -94,8 +94,8 @@ void EllipseTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
|
|||
|
||||
GUI::Painter painter(*m_editor);
|
||||
painter.add_clip_rect(event.rect());
|
||||
auto preview_start = m_editor->layer_position_to_editor_position(layer, m_ellipse_start_position).to_int_point();
|
||||
auto preview_end = m_editor->layer_position_to_editor_position(layer, m_ellipse_end_position).to_int_point();
|
||||
auto preview_start = m_editor->layer_position_to_editor_position(layer, m_ellipse_start_position).to_type<int>();
|
||||
auto preview_end = m_editor->layer_position_to_editor_position(layer, m_ellipse_end_position).to_type<int>();
|
||||
draw_using(painter, Gfx::IntRect::from_two_points(preview_start, preview_end));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "Layer.h"
|
||||
#include "Tool.h"
|
||||
#include <LibGUI/Painter.h>
|
||||
#include <LibGfx/FloatRect.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
#include "Image.h"
|
||||
#include <LibGUI/Frame.h>
|
||||
#include <LibGfx/FloatPoint.h>
|
||||
#include <LibGfx/Point.h>
|
||||
|
||||
namespace PixelPaint {
|
||||
|
||||
|
|
|
@ -102,8 +102,8 @@ void LineTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
|
|||
|
||||
GUI::Painter painter(*m_editor);
|
||||
painter.add_clip_rect(event.rect());
|
||||
auto preview_start = m_editor->layer_position_to_editor_position(layer, m_line_start_position).to_int_point();
|
||||
auto preview_end = m_editor->layer_position_to_editor_position(layer, m_line_end_position).to_int_point();
|
||||
auto preview_start = m_editor->layer_position_to_editor_position(layer, m_line_start_position).to_type<int>();
|
||||
auto preview_end = m_editor->layer_position_to_editor_position(layer, m_line_end_position).to_type<int>();
|
||||
painter.draw_line(preview_start, preview_end, m_editor->color_for(m_drawing_button), m_thickness);
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,9 @@ void RectangleTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
|
|||
|
||||
GUI::Painter painter(*m_editor);
|
||||
painter.add_clip_rect(event.rect());
|
||||
auto rect = Gfx::IntRect::from_two_points(m_editor->layer_position_to_editor_position(layer, m_rectangle_start_position).to_int_point(), m_editor->layer_position_to_editor_position(layer, m_rectangle_end_position).to_int_point());
|
||||
auto rect = Gfx::IntRect::from_two_points(
|
||||
m_editor->layer_position_to_editor_position(layer, m_rectangle_start_position).to_type<int>(),
|
||||
m_editor->layer_position_to_editor_position(layer, m_rectangle_end_position).to_type<int>());
|
||||
draw_using(painter, rect);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue