Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion AK/LsanSuppressions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@

#include <AK/Platform.h>

#ifndef AK_OS_WINDOWS
# define EXPORT __attribute__((visibility("default")))
#else
# define EXPORT __declspec(dllexport)
#endif

#ifdef HAS_ADDRESS_SANITIZER
extern "C" {
char const* __lsan_default_suppressions();
EXPORT char const* __lsan_default_suppressions();
char const* __lsan_default_suppressions()
{
// Both Skia and Chromium suppress false positive FontConfig leaks
Expand Down
7 changes: 4 additions & 3 deletions Libraries/LibGfx/AffineTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <AK/Math.h>
#include <AK/Optional.h>
#include <LibGfx/AffineTransform.h>
#include <LibGfx/Export.h>
#include <LibGfx/Quad.h>
#include <LibGfx/Rect.h>

Expand Down Expand Up @@ -158,7 +159,7 @@ void AffineTransform::map(float unmapped_x, float unmapped_y, float& mapped_x, f
}

template<>
IntPoint AffineTransform::map(IntPoint point) const
GFX_API IntPoint AffineTransform::map(IntPoint point) const
{
float mapped_x;
float mapped_y;
Expand All @@ -167,7 +168,7 @@ IntPoint AffineTransform::map(IntPoint point) const
}

template<>
FloatPoint AffineTransform::map(FloatPoint point) const
GFX_API FloatPoint AffineTransform::map(FloatPoint point) const
{
float mapped_x;
float mapped_y;
Expand Down Expand Up @@ -203,7 +204,7 @@ static T largest_of(T p1, T p2, T p3, T p4)
}

template<>
FloatRect AffineTransform::map(FloatRect const& rect) const
GFX_API FloatRect AffineTransform::map(FloatRect const& rect) const
{
if (is_identity()) {
return rect;
Expand Down
3 changes: 2 additions & 1 deletion Libraries/LibGfx/AffineTransform.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#include <AK/Concepts.h>
#include <AK/Format.h>
#include <AK/Forward.h>
#include <LibGfx/Export.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Matrix.h>

namespace Gfx {

class AffineTransform {
class GFX_API AffineTransform {
public:
AffineTransform()
: m_values { 1, 0, 0, 1, 0, 0 }
Expand Down
5 changes: 3 additions & 2 deletions Libraries/LibGfx/Bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <AK/Function.h>
#include <LibCore/AnonymousBuffer.h>
#include <LibGfx/Color.h>
#include <LibGfx/Export.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
#include <LibGfx/ScalingMode.h>
Expand All @@ -33,7 +34,7 @@ enum class BitmapFormat {
#undef ENUMERATE_BITMAP_FORMAT
};

[[nodiscard]] StringView bitmap_format_name(BitmapFormat);
[[nodiscard]] GFX_API StringView bitmap_format_name(BitmapFormat);

inline bool is_valid_bitmap_format(u32 const format)
{
Expand All @@ -56,7 +57,7 @@ enum class MaskKind {

struct BackingStore;

class Bitmap : public AtomicRefCounted<Bitmap> {
class GFX_API Bitmap : public AtomicRefCounted<Bitmap> {
public:
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create(BitmapFormat, IntSize);
[[nodiscard]] static ErrorOr<NonnullRefPtr<Bitmap>> create(BitmapFormat, AlphaType, IntSize);
Expand Down
5 changes: 3 additions & 2 deletions Libraries/LibGfx/BitmapSequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <AK/RefPtr.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/Export.h>
#include <LibGfx/Size.h>
#include <LibIPC/Forward.h>

Expand Down Expand Up @@ -36,9 +37,9 @@ template<>
ErrorOr<Gfx::BitmapMetadata> decode(Decoder&);

template<>
ErrorOr<void> encode(Encoder&, Gfx::BitmapSequence const&);
GFX_API ErrorOr<void> encode(Encoder&, Gfx::BitmapSequence const&);

template<>
ErrorOr<Gfx::BitmapSequence> decode(Decoder&);
GFX_API ErrorOr<Gfx::BitmapSequence> decode(Decoder&);

}
2 changes: 1 addition & 1 deletion Libraries/LibGfx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if (HAS_FONTCONFIG)
list(APPEND SOURCES Font/GlobalFontConfig.cpp)
endif()

ladybird_lib(LibGfx gfx)
ladybird_lib(LibGfx gfx EXPLICIT_SYMBOL_EXPORT)

target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibTextCodec LibIPC LibUnicode)

Expand Down
9 changes: 5 additions & 4 deletions Libraries/LibGfx/Color.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <AK/Forward.h>
#include <AK/Math.h>
#include <AK/StdLibExtras.h>
#include <LibGfx/Export.h>
#include <LibIPC/Forward.h>

namespace Gfx {
Expand Down Expand Up @@ -54,7 +55,7 @@ struct Oklab {
float b { 0 };
};

class Color {
class GFX_API Color {
public:
enum class NamedColor {
Transparent,
Expand Down Expand Up @@ -754,7 +755,7 @@ class Traits<Color> : public DefaultTraits<Color> {
};

template<>
struct Formatter<Gfx::Color> : public Formatter<StringView> {
struct GFX_API Formatter<Gfx::Color> : public Formatter<StringView> {
ErrorOr<void> format(FormatBuilder&, Gfx::Color);
};

Expand All @@ -778,9 +779,9 @@ struct Formatter<Gfx::Oklab> : public Formatter<FormatString> {
namespace IPC {

template<>
ErrorOr<void> encode(Encoder&, Gfx::Color const&);
GFX_API ErrorOr<void> encode(Encoder&, Gfx::Color const&);

template<>
ErrorOr<Gfx::Color> decode(Decoder&);
GFX_API ErrorOr<Gfx::Color> decode(Decoder&);

}
7 changes: 4 additions & 3 deletions Libraries/LibGfx/ColorSpace.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <AK/Error.h>
#include <AK/Noncopyable.h>
#include <AK/NonnullOwnPtr.h>
#include <LibGfx/Export.h>
#include <LibIPC/Forward.h>
#include <LibMedia/Color/CodingIndependentCodePoints.h>

Expand All @@ -20,7 +21,7 @@ struct ColorSpaceImpl;

}

class ColorSpace {
class GFX_API ColorSpace {
public:
ColorSpace();
ColorSpace(ColorSpace const&);
Expand Down Expand Up @@ -54,9 +55,9 @@ class ColorSpace {
namespace IPC {

template<>
ErrorOr<void> encode(Encoder&, Gfx::ColorSpace const&);
GFX_API ErrorOr<void> encode(Encoder&, Gfx::ColorSpace const&);

template<>
ErrorOr<Gfx::ColorSpace> decode(Decoder&);
GFX_API ErrorOr<Gfx::ColorSpace> decode(Decoder&);

}
7 changes: 4 additions & 3 deletions Libraries/LibGfx/Cursor.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once

#include <AK/Variant.h>
#include <LibGfx/Export.h>
#include <LibGfx/Point.h>
#include <LibGfx/ShareableBitmap.h>
#include <LibIPC/Forward.h>
Expand Down Expand Up @@ -38,7 +39,7 @@ enum class StandardCursor {
Zoom,
};

struct ImageCursor {
struct GFX_API ImageCursor {
ShareableBitmap bitmap;
IntPoint hotspot;

Expand Down Expand Up @@ -101,9 +102,9 @@ constexpr StringView standard_cursor_to_string(StandardCursor cursor)
namespace IPC {

template<>
ErrorOr<void> encode(Encoder&, Gfx::ImageCursor const&);
GFX_API ErrorOr<void> encode(Encoder&, Gfx::ImageCursor const&);

template<>
ErrorOr<Gfx::ImageCursor> decode(Decoder&);
GFX_API ErrorOr<Gfx::ImageCursor> decode(Decoder&);

}
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <AK/NonnullOwnPtr.h>
#include <LibGfx/Color.h>
#include <LibGfx/CompositingAndBlendingOperator.h>
#include <LibGfx/Export.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Rect.h>
#include <LibGfx/ScalingMode.h>
Expand All @@ -27,7 +28,7 @@ enum class ColorFilterType {

struct FilterImpl;

class Filter {
class GFX_API Filter {
public:
Filter(Filter const&);
Filter& operator=(Filter const&);
Expand Down
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Font/Font.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

#include <AK/FlyString.h>
#include <AK/Utf16String.h>
#include <LibGfx/Export.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/Typeface.h>
#include <LibGfx/ShapeFeature.h>
Expand Down Expand Up @@ -53,7 +54,7 @@ enum FontWidth {

constexpr float text_shaping_resolution = 64;

class Font : public RefCounted<Font> {
class GFX_API Font : public RefCounted<Font> {
public:
Font(NonnullRefPtr<Typeface const>, float point_width, float point_height, unsigned dpi_x = DEFAULT_DPI, unsigned dpi_y = DEFAULT_DPI, FontVariationSettings const variations = {});
ScaledFontMetrics metrics() const;
Expand Down
5 changes: 3 additions & 2 deletions Libraries/LibGfx/Font/FontDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/OwnPtr.h>
#include <LibGfx/Export.h>
#include <LibGfx/Font/Typeface.h>
#include <LibGfx/Forward.h>

namespace Gfx {

class SystemFontProvider {
class GFX_API SystemFontProvider {
public:
virtual ~SystemFontProvider();

Expand All @@ -23,7 +24,7 @@ class SystemFontProvider {
virtual void for_each_typeface_with_family_name(FlyString const& family_name, Function<void(Typeface const&)>) = 0;
};

class FontDatabase {
class GFX_API FontDatabase {
public:
static FontDatabase& the();
SystemFontProvider& install_system_font_provider(NonnullOwnPtr<SystemFontProvider>);
Expand Down
5 changes: 3 additions & 2 deletions Libraries/LibGfx/Font/FontSupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#pragma once

#include <AK/Types.h>
#include <LibGfx/Export.h>

namespace Gfx {

Expand Down Expand Up @@ -35,7 +36,7 @@ enum class FontTech : u8 {
Variations,
};

bool font_format_is_supported(FontFormat);
bool font_tech_is_supported(FontTech);
GFX_API bool font_format_is_supported(FontFormat);
GFX_API bool font_tech_is_supported(FontTech);

}
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Font/GlobalFontConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

#pragma once

#include <LibGfx/Export.h>
#include <fontconfig/fontconfig.h>

namespace Gfx {

class GlobalFontConfig {
class GFX_API GlobalFontConfig {
public:
static GlobalFontConfig& the();
FcConfig* get();
Expand Down
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Font/PathFontProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <LibGfx/Export.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/Typeface.h>

namespace Gfx {

class PathFontProvider final : public SystemFontProvider {
class GFX_API PathFontProvider final : public SystemFontProvider {
AK_MAKE_NONCOPYABLE(PathFontProvider);
AK_MAKE_NONMOVABLE(PathFontProvider);

Expand Down
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Font/Typeface.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <AK/HashMap.h>
#include <AK/QuickSort.h>
#include <AK/RefCounted.h>
#include <LibGfx/Export.h>
#include <LibGfx/Font/FontData.h>
#include <LibGfx/Font/FontVariationSettings.h>
#include <LibGfx/Forward.h>
Expand Down Expand Up @@ -54,7 +55,7 @@ struct FontCacheKey {
}
};

class Typeface : public RefCounted<Typeface> {
class GFX_API Typeface : public RefCounted<Typeface> {
public:
static ErrorOr<NonnullRefPtr<Typeface>> try_load_from_resource(Core::Resource const&, int ttc_index = 0);
static ErrorOr<NonnullRefPtr<Typeface>> try_load_from_font_data(NonnullOwnPtr<Gfx::FontData>, int ttc_index = 0);
Expand Down
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Font/WOFF/Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

#include <AK/OwnPtr.h>
#include <AK/RefCounted.h>
#include <LibGfx/Export.h>
#include <LibGfx/Font/Typeface.h>

namespace WOFF {

ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_resource(Core::Resource const&, unsigned index = 0);
ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes bytes, unsigned index = 0);
GFX_API ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes bytes, unsigned index = 0);

}
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Font/WOFF2/Loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

#include <AK/OwnPtr.h>
#include <AK/RefCounted.h>
#include <LibGfx/Export.h>
#include <LibGfx/Font/Typeface.h>

namespace WOFF2 {

ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes);
GFX_API ErrorOr<NonnullRefPtr<Gfx::Typeface>> try_load_from_bytes(ReadonlyBytes);

}
3 changes: 2 additions & 1 deletion Libraries/LibGfx/FontCascadeList.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

#pragma once

#include <LibGfx/Export.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/UnicodeRange.h>

namespace Gfx {

class FontCascadeList : public RefCounted<FontCascadeList> {
class GFX_API FontCascadeList : public RefCounted<FontCascadeList> {
public:
static NonnullRefPtr<FontCascadeList> create()
{
Expand Down
3 changes: 2 additions & 1 deletion Libraries/LibGfx/Gradients.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <AK/Math.h>
#include <LibGfx/Color.h>
#include <LibGfx/Export.h>
#include <LibGfx/Size.h>

namespace Gfx {
Expand All @@ -20,7 +21,7 @@ struct ColorStop {
bool operator==(ColorStop const&) const = default;
};

float color_stop_step(ColorStop const& previous_stop, ColorStop const& next_stop, float position);
GFX_API float color_stop_step(ColorStop const& previous_stop, ColorStop const& next_stop, float position);

inline float normalized_gradient_angle_radians(float gradient_angle)
{
Expand Down
Loading
Loading