1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 11:07:46 +00:00

LibGfx: Unpublish Gfx::Point from global namespace

This commit is contained in:
Andreas Kling 2020-02-06 13:08:32 +01:00
parent 20cfd2a6bf
commit 9b87843af1
34 changed files with 51 additions and 53 deletions

View file

@ -47,7 +47,7 @@ static void flood_fill(Gfx::Bitmap& bitmap, const Gfx::Point& start_position, Co
if (target_color == fill_color)
return;
Queue<Point> queue;
Queue<Gfx::Point> queue;
queue.enqueue(start_position);
while (!queue.is_empty()) {
auto position = queue.dequeue();

View file

@ -31,7 +31,7 @@
#include <LibGUI/GPainter.h>
#include <LibM/math.h>
Point constrain_line_angle(const Gfx::Point& start_pos, const Gfx::Point& end_pos, float angle_increment)
static Gfx::Point constrain_line_angle(const Gfx::Point& start_pos, const Gfx::Point& end_pos, float angle_increment)
{
float current_angle = atan2(end_pos.y() - start_pos.y(), end_pos.x() - start_pos.x()) + M_PI * 2.;

View file

@ -63,7 +63,7 @@ void PenTool::on_mousemove(GUI::MouseEvent& event)
if (event.buttons() & GUI::MouseButton::Left || event.buttons() & GUI::MouseButton::Right) {
GUI::Painter painter(m_widget->bitmap());
if (m_last_drawing_event_position != Point(-1, -1))
if (m_last_drawing_event_position != Gfx::Point(-1, -1))
painter.draw_line(m_last_drawing_event_position, event.position(), m_widget->color_for(event), m_thickness);
else
painter.draw_line(event.position(), event.position(), m_widget->color_for(event), m_thickness);

View file

@ -102,8 +102,8 @@ void WaveWidget::paint_event(GUI::PaintEvent& event)
for (size_t x = 1; x < buffer.size(); ++x) {
int y = sample_to_y(buffer[x].left);
Point point1(prev_x * width_scale, prev_y);
Point point2(x * width_scale, y);
Gfx::Point point1(prev_x * width_scale, prev_y);
Gfx::Point point2(x * width_scale, y);
painter.draw_line(point1, point2, wave_color);
prev_x = x;

View file

@ -113,7 +113,7 @@ void QSWidget::mousewheel_event(GUI::MouseEvent& event)
relayout();
auto new_scale_factor = (float)m_scale / 100.0f;
auto scale_factor_change = new_scale_factor - old_scale_factor;
m_bitmap_rect.move_by(-Point((float)zoom_point.x() * scale_factor_change, (float)zoom_point.y() * scale_factor_change));
m_bitmap_rect.move_by(-Gfx::Point((float)zoom_point.x() * scale_factor_change, (float)zoom_point.y() * scale_factor_change));
if (old_scale != m_scale) {
if (on_scale_change)
on_scale_change(m_scale);

View file

@ -64,8 +64,8 @@ void SampleWidget::paint_event(GUI::PaintEvent& event)
++count;
if (count >= samples_per_pixel) {
Point min_point = { x, y_offset + static_cast<int>(-sample_max * frame_inner_rect().height() / 2) };
Point max_point = { x++, y_offset + static_cast<int>(sample_max * frame_inner_rect().height() / 2) };
Gfx::Point min_point = { x, y_offset + static_cast<int>(-sample_max * frame_inner_rect().height() / 2) };
Gfx::Point max_point = { x++, y_offset + static_cast<int>(sample_max * frame_inner_rect().height() / 2) };
painter.draw_line(min_point, max_point, Color::Green);
count = 0;

View file

@ -56,13 +56,13 @@ void GraphWidget::paint_event(GUI::PaintEvent& event)
auto inner_rect = frame_inner_rect();
float scale = (float)inner_rect.height() / (float)m_max;
Point prev_point;
Gfx::Point prev_point;
for (int i = 0; i < m_values.size(); ++i) {
int x = inner_rect.right() - (i * 2) + 1;
if (x < 0)
break;
float scaled_value = (float)m_values.at(m_values.size() - i - 1) * scale;
Point point = { x, inner_rect.bottom() - (int)scaled_value };
Gfx::Point point = { x, inner_rect.bottom() - (int)scaled_value };
if (i != 0)
painter.draw_line(prev_point, point, m_graph_color);
prev_point = point;