mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +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:
parent
939a605334
commit
11580babbf
269 changed files with 1513 additions and 1315 deletions
|
@ -136,9 +136,9 @@ void StyleProperties::load_font() const
|
|||
dbg() << "Failed to find a font for family " << font_family << " weight " << font_weight;
|
||||
|
||||
if (font_weight == "bold")
|
||||
m_font = Font::default_bold_font();
|
||||
m_font = Gfx::Font::default_bold_font();
|
||||
else
|
||||
m_font = Font::default_font();
|
||||
m_font = Gfx::Font::default_font();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ void StyleProperties::load_font() const
|
|||
dbg() << "Found font " << file_name << " for family " << font_family << " weight " << font_weight;
|
||||
#endif
|
||||
|
||||
m_font = Font::load_from_file(String::format("/res/fonts/%s", file_name.characters()));
|
||||
m_font = Gfx::Font::load_from_file(String::format("/res/fonts/%s", file_name.characters()));
|
||||
FontCache::the().set({ font_family, font_weight }, *m_font);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
#include <LibDraw/Font.h>
|
||||
#include <LibHTML/CSS/StyleValue.h>
|
||||
|
||||
namespace Gfx {
|
||||
class Color;
|
||||
}
|
||||
|
||||
class StyleProperties : public RefCounted<StyleProperties> {
|
||||
public:
|
||||
|
@ -57,7 +59,7 @@ public:
|
|||
String string_or_fallback(CSS::PropertyID, const StringView& fallback) const;
|
||||
Color color_or_fallback(CSS::PropertyID, const Document&, Color fallback) const;
|
||||
|
||||
const Font& font() const
|
||||
const Gfx::Font& font() const
|
||||
{
|
||||
if (!m_font)
|
||||
load_font();
|
||||
|
@ -74,5 +76,5 @@ private:
|
|||
|
||||
void load_font() const;
|
||||
|
||||
mutable RefPtr<Font> m_font;
|
||||
mutable RefPtr<Gfx::Font> m_font;
|
||||
};
|
||||
|
|
|
@ -68,7 +68,7 @@ ImageStyleValue::ImageStyleValue(const URL& url, Document& document)
|
|||
ResourceLoader::the().load(url, [this, protector](auto& data) {
|
||||
if (!m_document)
|
||||
return;
|
||||
m_bitmap = load_png_from_memory(data.data(), data.size());
|
||||
m_bitmap = Gfx::load_png_from_memory(data.data(), data.size());
|
||||
if (!m_bitmap)
|
||||
return;
|
||||
// FIXME: Do less than a full repaint if possible?
|
||||
|
|
|
@ -213,12 +213,12 @@ public:
|
|||
|
||||
String to_string() const override { return String::format("Image{%s}", m_url.to_string().characters()); }
|
||||
|
||||
const GraphicsBitmap* bitmap() const { return m_bitmap; }
|
||||
const Gfx::Bitmap* bitmap() const { return m_bitmap; }
|
||||
|
||||
private:
|
||||
ImageStyleValue(const URL&, Document&);
|
||||
|
||||
URL m_url;
|
||||
WeakPtr<Document> m_document;
|
||||
RefPtr<GraphicsBitmap> m_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_bitmap;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue