1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +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

@ -34,8 +34,8 @@
QSWidget::QSWidget(GUI::Widget* parent)
: GUI::Frame(parent)
{
set_frame_shape(FrameShape::Container);
set_frame_shadow(FrameShadow::Sunken);
set_frame_shape(Gfx::FrameShape::Container);
set_frame_shadow(Gfx::FrameShadow::Sunken);
set_frame_thickness(2);
set_fill_with_background_color(true);
@ -46,7 +46,7 @@ QSWidget::~QSWidget()
{
}
void QSWidget::set_bitmap(NonnullRefPtr<GraphicsBitmap> bitmap)
void QSWidget::set_bitmap(NonnullRefPtr<Gfx::Bitmap> bitmap)
{
m_bitmap = move(bitmap);
}
@ -139,7 +139,7 @@ void QSWidget::drop_event(GUI::DropEvent& event)
return;
}
URL url(lines[0]);
auto bitmap = GraphicsBitmap::load_from_file(url.path());
auto bitmap = Gfx::Bitmap::load_from_file(url.path());
if (!bitmap) {
GUI::MessageBox::show(String::format("Failed to open %s", url.to_string().characters()), "Cannot open image", GUI::MessageBox::Type::Error, GUI::MessageBox::InputType::OK, window());
return;

View file

@ -35,8 +35,8 @@ class QSWidget final : public GUI::Frame {
public:
virtual ~QSWidget() override;
void set_bitmap(NonnullRefPtr<GraphicsBitmap>);
const GraphicsBitmap* bitmap() const { return m_bitmap.ptr(); }
void set_bitmap(NonnullRefPtr<Gfx::Bitmap>);
const Gfx::Bitmap* bitmap() const { return m_bitmap.ptr(); }
void set_path(const String&);
const String& path() const { return m_path; }
@ -55,10 +55,10 @@ private:
void relayout();
RefPtr<GraphicsBitmap> m_bitmap;
Rect m_bitmap_rect;
RefPtr<Gfx::Bitmap> m_bitmap;
Gfx::Rect m_bitmap_rect;
int m_scale { 100 };
Point m_pan_origin;
Point m_pan_bitmap_origin;
Gfx::Point m_pan_origin;
Gfx::Point m_pan_bitmap_origin;
String m_path;
};

View file

@ -80,7 +80,7 @@ int main(int argc, char** argv)
if (argc > 1)
path = argv[1];
auto bitmap = GraphicsBitmap::load_from_file(path);
auto bitmap = Gfx::Bitmap::load_from_file(path);
if (!bitmap) {
fprintf(stderr, "Failed to load %s\n", path);
return 1;