Browse Source

LibGfx: More work on header dependency reduction

Andreas Kling 5 năm trước cách đây
mục cha
commit
08cae2773d

+ 3 - 1
Libraries/LibGUI/Slider.cpp

@@ -24,9 +24,11 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
 
 
-#include <LibGfx/StylePainter.h>
+#include <AK/Assertions.h>
+#include <AK/StdLibExtras.h>
 #include <LibGUI/Painter.h>
 #include <LibGUI/Painter.h>
 #include <LibGUI/Slider.h>
 #include <LibGUI/Slider.h>
+#include <LibGfx/StylePainter.h>
 
 
 namespace GUI {
 namespace GUI {
 
 

+ 3 - 2
Libraries/LibGUI/TextDocument.h

@@ -30,12 +30,13 @@
 #include <AK/HashTable.h>
 #include <AK/HashTable.h>
 #include <AK/NonnullOwnPtrVector.h>
 #include <AK/NonnullOwnPtrVector.h>
 #include <AK/NonnullRefPtr.h>
 #include <AK/NonnullRefPtr.h>
+#include <AK/Optional.h>
 #include <AK/RefCounted.h>
 #include <AK/RefCounted.h>
 #include <LibCore/Timer.h>
 #include <LibCore/Timer.h>
-#include <LibGfx/Color.h>
-#include <LibGfx/Font.h>
 #include <LibGUI/TextRange.h>
 #include <LibGUI/TextRange.h>
 #include <LibGUI/UndoStack.h>
 #include <LibGUI/UndoStack.h>
+#include <LibGfx/Color.h>
+#include <LibGfx/Font.h>
 
 
 namespace GUI {
 namespace GUI {
 
 

+ 10 - 0
Libraries/LibGfx/Color.cpp

@@ -25,11 +25,15 @@
  */
  */
 
 
 #include <AK/Assertions.h>
 #include <AK/Assertions.h>
+#include <AK/Optional.h>
+#include <AK/String.h>
 #include <LibGfx/Color.h>
 #include <LibGfx/Color.h>
 #include <LibGfx/SystemTheme.h>
 #include <LibGfx/SystemTheme.h>
 #include <ctype.h>
 #include <ctype.h>
 #include <stdio.h>
 #include <stdio.h>
 
 
+namespace Gfx {
+
 Color::Color(NamedColor named)
 Color::Color(NamedColor named)
 {
 {
     struct {
     struct {
@@ -338,3 +342,9 @@ Optional<Color> Color::from_string(const StringView& string)
 
 
     return Color(r.value(), g.value(), b.value(), a.value());
     return Color(r.value(), g.value(), b.value(), a.value());
 }
 }
+}
+
+inline const LogStream& operator<<(const LogStream& stream, Color value)
+{
+    return stream << value.to_string();
+}

+ 3 - 7
Libraries/LibGfx/Color.h

@@ -26,9 +26,8 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <AK/Optional.h>
-#include <AK/String.h>
-#include <AK/Types.h>
+#include <AK/Forward.h>
+#include <AK/StdLibExtras.h>
 
 
 namespace Gfx {
 namespace Gfx {
 
 
@@ -274,10 +273,7 @@ private:
     RGBA32 m_value { 0 };
     RGBA32 m_value { 0 };
 };
 };
 
 
-inline const LogStream& operator<<(const LogStream& stream, Color value)
-{
-    return stream << value.to_string();
-}
+const LogStream& operator<<(const LogStream&, Color);
 
 
 }
 }
 
 

+ 3 - 0
Libraries/LibGfx/Forward.h

@@ -32,10 +32,13 @@ class Bitmap;
 class CharacterBitmap;
 class CharacterBitmap;
 class Color;
 class Color;
 class DisjointRectSet;
 class DisjointRectSet;
+class Emoji;
 class FloatPoint;
 class FloatPoint;
 class FloatRect;
 class FloatRect;
 class FloatSize;
 class FloatSize;
 class Font;
 class Font;
+class GlyphBitmap;
+class ImageDecoder;
 class Painter;
 class Painter;
 class Palette;
 class Palette;
 class Point;
 class Point;

+ 2 - 8
Libraries/LibGfx/Painter.h

@@ -26,10 +26,10 @@
 
 
 #pragma once
 #pragma once
 
 
-#include <AK/String.h>
-#include <AK/Utf8View.h>
+#include <AK/Forward.h>
 #include <AK/Vector.h>
 #include <AK/Vector.h>
 #include <LibGfx/Color.h>
 #include <LibGfx/Color.h>
+#include <LibGfx/Forward.h>
 #include <LibGfx/Point.h>
 #include <LibGfx/Point.h>
 #include <LibGfx/Rect.h>
 #include <LibGfx/Rect.h>
 #include <LibGfx/Size.h>
 #include <LibGfx/Size.h>
@@ -38,12 +38,6 @@
 
 
 namespace Gfx {
 namespace Gfx {
 
 
-class CharacterBitmap;
-class GlyphBitmap;
-class Bitmap;
-class Font;
-class Emoji;
-
 class Painter {
 class Painter {
 public:
 public:
     explicit Painter(Gfx::Bitmap&);
     explicit Painter(Gfx::Bitmap&);

+ 2 - 0
Libraries/LibGfx/Palette.h

@@ -28,6 +28,8 @@
 
 
 #include <AK/Forward.h>
 #include <AK/Forward.h>
 #include <AK/Noncopyable.h>
 #include <AK/Noncopyable.h>
+#include <AK/RefCounted.h>
+#include <AK/RefPtr.h>
 #include <LibGfx/SystemTheme.h>
 #include <LibGfx/SystemTheme.h>
 
 
 namespace GUI {
 namespace GUI {

+ 1 - 1
Libraries/LibGfx/StylePainter.h

@@ -59,7 +59,7 @@ public:
     static void paint_surface(Painter&, const Rect&, const Palette&, bool paint_vertical_lines = true, bool paint_top_line = true);
     static void paint_surface(Painter&, const Rect&, const Palette&, bool paint_vertical_lines = true, bool paint_top_line = true);
     static void paint_frame(Painter&, const Rect&, const Palette&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false);
     static void paint_frame(Painter&, const Rect&, const Palette&, FrameShape, FrameShadow, int thickness, bool skip_vertical_lines = false);
     static void paint_window_frame(Painter&, const Rect&, const Palette&);
     static void paint_window_frame(Painter&, const Rect&, const Palette&);
-    static void paint_progress_bar(Painter&, const Rect&, const Palette&, int min, int max, int value, const StringView& text = {});
+    static void paint_progress_bar(Painter&, const Rect&, const Palette&, int min, int max, int value, const StringView& text);
     static void paint_radio_button(Painter&, const Rect&, const Palette&, bool is_checked, bool is_being_pressed);
     static void paint_radio_button(Painter&, const Rect&, const Palette&, bool is_checked, bool is_being_pressed);
 };
 };
 
 

+ 2 - 0
Libraries/LibHTML/DOM/HTMLImageElement.cpp

@@ -24,6 +24,8 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
  */
 
 
+#include <LibGfx/Bitmap.h>
+#include <LibGfx/ImageDecoder.h>
 #include <LibHTML/CSS/StyleResolver.h>
 #include <LibHTML/CSS/StyleResolver.h>
 #include <LibHTML/DOM/Document.h>
 #include <LibHTML/DOM/Document.h>
 #include <LibHTML/DOM/HTMLImageElement.h>
 #include <LibHTML/DOM/HTMLImageElement.h>

+ 1 - 2
Libraries/LibHTML/DOM/HTMLImageElement.h

@@ -27,8 +27,7 @@
 #pragma once
 #pragma once
 
 
 #include <AK/ByteBuffer.h>
 #include <AK/ByteBuffer.h>
-#include <LibGfx/Bitmap.h>
-#include <LibGfx/ImageDecoder.h>
+#include <LibGfx/Forward.h>
 #include <LibHTML/DOM/HTMLElement.h>
 #include <LibHTML/DOM/HTMLElement.h>
 
 
 class LayoutDocument;
 class LayoutDocument;