LibGfx+LibWeb: Remove unused code from Gfx::Point/Rect/Size
No functional changes.
This commit is contained in:
parent
847cf74ff8
commit
bff863d6d9
9 changed files with 6 additions and 105 deletions
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Stream.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/CMYKBitmap.h>
|
||||
#include <LibGfx/ImageFormats/JPEGWriter.h>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibGfx/Color.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Gradients.h>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <AK/Format.h>
|
||||
#include <AK/Math.h>
|
||||
#include <AK/StdLibExtras.h>
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Orientation.h>
|
||||
#include <LibIPC/Forward.h>
|
||||
|
|
@ -68,8 +67,6 @@ public:
|
|||
ALWAYS_INLINE void scale_by(T dboth) { scale_by(dboth, dboth); }
|
||||
ALWAYS_INLINE void scale_by(Point<T> const& delta) { scale_by(delta.x(), delta.y()); }
|
||||
|
||||
void transform_by(AffineTransform const& transform) { *this = transform.map(*this); }
|
||||
|
||||
[[nodiscard]] Point<T> translated(Point<T> const& delta) const
|
||||
{
|
||||
Point<T> point = *this;
|
||||
|
|
@ -112,13 +109,6 @@ public:
|
|||
return point;
|
||||
}
|
||||
|
||||
[[nodiscard]] Point<T> transformed(AffineTransform const& transform) const
|
||||
{
|
||||
Point<T> point = *this;
|
||||
point.transform_by(transform);
|
||||
return point;
|
||||
}
|
||||
|
||||
void constrain(Rect<T> const&);
|
||||
[[nodiscard]] Point<T> constrained(Rect<T> const& rect) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,12 +9,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Format.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibGfx/Orientation.h>
|
||||
#include <LibGfx/Point.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibGfx/TextAlignment.h>
|
||||
#include <math.h>
|
||||
|
||||
namespace Gfx {
|
||||
|
|
@ -84,8 +81,6 @@ public:
|
|||
ALWAYS_INLINE void scale_by(T dboth) { scale_by(dboth, dboth); }
|
||||
ALWAYS_INLINE void scale_by(Point<T> const& delta) { scale_by(delta.x(), delta.y()); }
|
||||
|
||||
void transform_by(AffineTransform const& transform) { *this = transform.map(*this); }
|
||||
|
||||
[[nodiscard]] Point<T> center() const
|
||||
{
|
||||
return { x() + width() / 2, y() + height() / 2 };
|
||||
|
|
@ -197,13 +192,6 @@ public:
|
|||
return rect;
|
||||
}
|
||||
|
||||
[[nodiscard]] Rect<T> transformed(AffineTransform const& transform) const
|
||||
{
|
||||
Rect<T> rect = *this;
|
||||
rect.transform_by(transform);
|
||||
return rect;
|
||||
}
|
||||
|
||||
[[nodiscard]] Rect<T> shrunken(T w, T h) const
|
||||
{
|
||||
Rect<T> rect = *this;
|
||||
|
|
@ -462,11 +450,6 @@ public:
|
|||
set_bottom(b);
|
||||
}
|
||||
|
||||
[[nodiscard]] static Rect<T> centered_on(Point<T> const& center, Size<T> const& size)
|
||||
{
|
||||
return { { center.x() - size.width() / 2, center.y() - size.height() / 2 }, size };
|
||||
}
|
||||
|
||||
[[nodiscard]] static Rect<T> from_two_points(Point<T> const& a, Point<T> const& b)
|
||||
{
|
||||
return { min(a.x(), b.x()), min(a.y(), b.y()), AK::abs(a.x() - b.x()), AK::abs(a.y() - b.y()) };
|
||||
|
|
@ -484,29 +467,6 @@ public:
|
|||
return intersection(*this, other);
|
||||
}
|
||||
|
||||
template<typename U = T>
|
||||
[[nodiscard]] Gfx::Rect<U> interpolated_to(Gfx::Rect<T> const& to, float factor) const
|
||||
{
|
||||
VERIFY(factor >= 0.f);
|
||||
VERIFY(factor <= 1.f);
|
||||
if (factor == 0.f)
|
||||
return *this;
|
||||
if (factor == 1.f)
|
||||
return to;
|
||||
if (this == &to)
|
||||
return *this;
|
||||
auto interpolated_left = round_to<U>(mix<float>(x(), to.x(), factor));
|
||||
auto interpolated_top = round_to<U>(mix<float>(y(), to.y(), factor));
|
||||
auto interpolated_right = round_to<U>(mix<float>(right(), to.right(), factor));
|
||||
auto interpolated_bottom = round_to<U>(mix<float>(bottom(), to.bottom(), factor));
|
||||
return { interpolated_left, interpolated_top, interpolated_right - interpolated_left, interpolated_bottom - interpolated_top };
|
||||
}
|
||||
|
||||
[[nodiscard]] static Rect<T> centered_at(Point<T> const& point, Size<T> const& size)
|
||||
{
|
||||
return { { point.x() - size.width() / 2, point.y() - size.height() / 2 }, size };
|
||||
}
|
||||
|
||||
void unite(Rect<T> const& other)
|
||||
{
|
||||
if (is_empty()) {
|
||||
|
|
@ -547,52 +507,6 @@ public:
|
|||
[[nodiscard]] Point<T> bottom_left() const { return { left(), bottom() }; }
|
||||
[[nodiscard]] Point<T> bottom_right() const { return { right(), bottom() }; }
|
||||
|
||||
void align_within(Rect<T> const& other, TextAlignment alignment)
|
||||
{
|
||||
switch (alignment) {
|
||||
case TextAlignment::Center:
|
||||
center_within(other);
|
||||
return;
|
||||
case TextAlignment::TopCenter:
|
||||
center_horizontally_within(other);
|
||||
set_y(other.y());
|
||||
return;
|
||||
case TextAlignment::TopLeft:
|
||||
set_location(other.location());
|
||||
return;
|
||||
case TextAlignment::TopRight:
|
||||
set_x(other.right() - width());
|
||||
set_y(other.y());
|
||||
return;
|
||||
case TextAlignment::CenterLeft:
|
||||
set_x(other.x());
|
||||
center_vertically_within(other);
|
||||
return;
|
||||
case TextAlignment::CenterRight:
|
||||
set_x(other.right() - width());
|
||||
center_vertically_within(other);
|
||||
return;
|
||||
case TextAlignment::BottomCenter:
|
||||
center_horizontally_within(other);
|
||||
set_y(other.bottom() - height());
|
||||
return;
|
||||
case TextAlignment::BottomLeft:
|
||||
set_x(other.x());
|
||||
set_y(other.bottom() - height());
|
||||
return;
|
||||
case TextAlignment::BottomRight:
|
||||
set_x(other.right() - width());
|
||||
set_y(other.bottom() - height());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void center_within(Rect<T> const& other)
|
||||
{
|
||||
center_horizontally_within(other);
|
||||
center_vertically_within(other);
|
||||
}
|
||||
|
||||
[[nodiscard]] Rect centered_within(Rect const& other) const
|
||||
{
|
||||
Rect rect { *this };
|
||||
|
|
|
|||
|
|
@ -53,8 +53,6 @@ public:
|
|||
m_height *= dy;
|
||||
}
|
||||
|
||||
constexpr void transform_by(AffineTransform const& transform) { *this = transform.map(*this); }
|
||||
|
||||
ALWAYS_INLINE constexpr void scale_by(T dboth) { scale_by(dboth, dboth); }
|
||||
ALWAYS_INLINE constexpr void scale_by(Point<T> const& s) { scale_by(s.x(), s.y()); }
|
||||
|
||||
|
|
@ -79,13 +77,6 @@ public:
|
|||
return size;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr Size transformed_by(AffineTransform const& transform) const
|
||||
{
|
||||
Size<T> size = *this;
|
||||
size.transform_by(transform);
|
||||
return size;
|
||||
}
|
||||
|
||||
[[nodiscard]] constexpr float aspect_ratio() const
|
||||
{
|
||||
VERIFY(height() != 0);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibWeb/DOM/EventTarget.h>
|
||||
#include <LibWeb/PixelUnits.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <LibGfx/AffineTransform.h>
|
||||
#include <LibGfx/Forward.h>
|
||||
#include <LibGfx/Palette.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/Vector.h>
|
||||
#include <LibWeb/Painting/ScrollState.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
|
|
|||
Loading…
Reference in a new issue