Jelajahi Sumber

removed extra impl of scaling

Christopher Dumas 6 tahun lalu
induk
melakukan
3e26faa226

+ 1 - 1
Base/home/anon/WindowManager.ini

@@ -36,4 +36,4 @@ MenuSelectionColor=132,53,26
 DoubleClickSpeed=250
 
 [Background]
-Mode=center
+Mode=scaled

TEMPAT SAMPAH
Demos/PaintTest/PaintTest


+ 0 - 165
Demos/PaintTest/main.d

@@ -1,165 +0,0 @@
-main.o: main.cpp /home/christopherdumas/serenity/LibGUI/GApplication.h \
- /home/christopherdumas/serenity/AK/Badge.h \
- /home/christopherdumas/serenity/AK/OwnPtr.h \
- /home/christopherdumas/serenity/AK/StdLibExtras.h \
- /home/christopherdumas/serenity/LibC/stdlib.h \
- /home/christopherdumas/serenity/LibC/sys/cdefs.h \
- /home/christopherdumas/serenity/LibC/sys/types.h \
- /home/christopherdumas/serenity/LibC/stdint.h \
- /home/christopherdumas/serenity/LibC/stddef.h \
- /home/christopherdumas/serenity/LibC/string.h \
- /home/christopherdumas/serenity/AK/Types.h \
- /home/christopherdumas/serenity/AK/Traits.h \
- /home/christopherdumas/serenity/AK/kstdio.h \
- /home/christopherdumas/serenity/Kernel/kstdio.h \
- /home/christopherdumas/serenity/AK/HashFunctions.h \
- /home/christopherdumas/serenity/AK/HashMap.h \
- /home/christopherdumas/serenity/AK/HashTable.h \
- /home/christopherdumas/serenity/AK/Assertions.h \
- /home/christopherdumas/serenity/LibC/assert.h \
- /home/christopherdumas/serenity/AK/DoublyLinkedList.h \
- /home/christopherdumas/serenity/AK/Vector.h \
- /home/christopherdumas/serenity/AK/kmalloc.h \
- /home/christopherdumas/serenity/LibGUI/GShortcut.h \
- /home/christopherdumas/serenity/Kernel/KeyCode.h \
- /home/christopherdumas/serenity/AK/AKString.h \
- /home/christopherdumas/serenity/AK/ByteBuffer.h \
- /home/christopherdumas/serenity/AK/Retainable.h \
- /home/christopherdumas/serenity/AK/RetainPtr.h \
- /home/christopherdumas/serenity/AK/Retained.h \
- /home/christopherdumas/serenity/AK/StringImpl.h \
- /home/christopherdumas/serenity/AK/StringView.h \
- /home/christopherdumas/serenity/LibGUI/GWindow.h \
- /home/christopherdumas/serenity/LibCore/CObject.h \
- /home/christopherdumas/serenity/AK/Function.h \
- /home/christopherdumas/serenity/AK/Weakable.h \
- /home/christopherdumas/serenity/LibGUI/GWindowType.h \
- /home/christopherdumas/serenity/SharedGraphics/Rect.h \
- /home/christopherdumas/serenity/SharedGraphics/Point.h \
- /home/christopherdumas/serenity/SharedGraphics/Size.h \
- /home/christopherdumas/serenity/SharedGraphics/TextAlignment.h \
- /home/christopherdumas/serenity/SharedGraphics/GraphicsBitmap.h \
- /home/christopherdumas/serenity/SharedGraphics/Color.h \
- /home/christopherdumas/serenity/AK/MappedFile.h \
- /home/christopherdumas/serenity/LibC/SharedBuffer.h \
- /home/christopherdumas/serenity/AK/WeakPtr.h \
- /home/christopherdumas/serenity/LibGUI/GWidget.h \
- /home/christopherdumas/serenity/LibCore/CElapsedTimer.h \
- /home/christopherdumas/serenity/LibC/time.h \
- /home/christopherdumas/serenity/LibGUI/GEvent.h \
- /home/christopherdumas/serenity/LibCore/CEvent.h \
- /home/christopherdumas/serenity/SharedGraphics/Font.h \
- /home/christopherdumas/serenity/LibGUI/GPainter.h \
- /home/christopherdumas/serenity/SharedGraphics/Painter.h \
- /home/christopherdumas/serenity/SharedGraphics/TextElision.h \
- /home/christopherdumas/serenity/SharedGraphics/PNGLoader.h
-
-/home/christopherdumas/serenity/LibGUI/GApplication.h:
-
-/home/christopherdumas/serenity/AK/Badge.h:
-
-/home/christopherdumas/serenity/AK/OwnPtr.h:
-
-/home/christopherdumas/serenity/AK/StdLibExtras.h:
-
-/home/christopherdumas/serenity/LibC/stdlib.h:
-
-/home/christopherdumas/serenity/LibC/sys/cdefs.h:
-
-/home/christopherdumas/serenity/LibC/sys/types.h:
-
-/home/christopherdumas/serenity/LibC/stdint.h:
-
-/home/christopherdumas/serenity/LibC/stddef.h:
-
-/home/christopherdumas/serenity/LibC/string.h:
-
-/home/christopherdumas/serenity/AK/Types.h:
-
-/home/christopherdumas/serenity/AK/Traits.h:
-
-/home/christopherdumas/serenity/AK/kstdio.h:
-
-/home/christopherdumas/serenity/Kernel/kstdio.h:
-
-/home/christopherdumas/serenity/AK/HashFunctions.h:
-
-/home/christopherdumas/serenity/AK/HashMap.h:
-
-/home/christopherdumas/serenity/AK/HashTable.h:
-
-/home/christopherdumas/serenity/AK/Assertions.h:
-
-/home/christopherdumas/serenity/LibC/assert.h:
-
-/home/christopherdumas/serenity/AK/DoublyLinkedList.h:
-
-/home/christopherdumas/serenity/AK/Vector.h:
-
-/home/christopherdumas/serenity/AK/kmalloc.h:
-
-/home/christopherdumas/serenity/LibGUI/GShortcut.h:
-
-/home/christopherdumas/serenity/Kernel/KeyCode.h:
-
-/home/christopherdumas/serenity/AK/AKString.h:
-
-/home/christopherdumas/serenity/AK/ByteBuffer.h:
-
-/home/christopherdumas/serenity/AK/Retainable.h:
-
-/home/christopherdumas/serenity/AK/RetainPtr.h:
-
-/home/christopherdumas/serenity/AK/Retained.h:
-
-/home/christopherdumas/serenity/AK/StringImpl.h:
-
-/home/christopherdumas/serenity/AK/StringView.h:
-
-/home/christopherdumas/serenity/LibGUI/GWindow.h:
-
-/home/christopherdumas/serenity/LibCore/CObject.h:
-
-/home/christopherdumas/serenity/AK/Function.h:
-
-/home/christopherdumas/serenity/AK/Weakable.h:
-
-/home/christopherdumas/serenity/LibGUI/GWindowType.h:
-
-/home/christopherdumas/serenity/SharedGraphics/Rect.h:
-
-/home/christopherdumas/serenity/SharedGraphics/Point.h:
-
-/home/christopherdumas/serenity/SharedGraphics/Size.h:
-
-/home/christopherdumas/serenity/SharedGraphics/TextAlignment.h:
-
-/home/christopherdumas/serenity/SharedGraphics/GraphicsBitmap.h:
-
-/home/christopherdumas/serenity/SharedGraphics/Color.h:
-
-/home/christopherdumas/serenity/AK/MappedFile.h:
-
-/home/christopherdumas/serenity/LibC/SharedBuffer.h:
-
-/home/christopherdumas/serenity/AK/WeakPtr.h:
-
-/home/christopherdumas/serenity/LibGUI/GWidget.h:
-
-/home/christopherdumas/serenity/LibCore/CElapsedTimer.h:
-
-/home/christopherdumas/serenity/LibC/time.h:
-
-/home/christopherdumas/serenity/LibGUI/GEvent.h:
-
-/home/christopherdumas/serenity/LibCore/CEvent.h:
-
-/home/christopherdumas/serenity/SharedGraphics/Font.h:
-
-/home/christopherdumas/serenity/LibGUI/GPainter.h:
-
-/home/christopherdumas/serenity/SharedGraphics/Painter.h:
-
-/home/christopherdumas/serenity/SharedGraphics/TextElision.h:
-
-/home/christopherdumas/serenity/SharedGraphics/PNGLoader.h:

TEMPAT SAMPAH
Demos/PaintTest/main.o


+ 8 - 2
Servers/WindowServer/WSCompositor.cpp

@@ -24,6 +24,8 @@ WallpaperMode mode_to_enum(const String& name)
         return WallpaperMode::Tile;
     if (name == "center")
         return WallpaperMode::Center;
+    if (name == "scaled")
+        return WallpaperMode::Scaled;
 }
 
 WSCompositor::WSCompositor()
@@ -91,8 +93,7 @@ void WSCompositor::compose()
             continue;
         m_back_painter->fill_rect(dirty_rect, wm.m_background_color);
         if (m_wallpaper) {
-            if (m_wallpaper_mode == WallpaperMode::Simple ||
-                m_wallpaper_mode == WallpaperMode::Unchecked) {
+            if (m_wallpaper_mode == WallpaperMode::Simple) {
                 m_back_painter->blit(dirty_rect.location(), *m_wallpaper, dirty_rect);
             } else if (m_wallpaper_mode == WallpaperMode::Center) {
                 Point offset{ ws.size().width() / 2 - m_wallpaper->size().width() / 2,
@@ -101,6 +102,11 @@ void WSCompositor::compose()
                                             dirty_rect, offset);
             } else if (m_wallpaper_mode == WallpaperMode::Tile) {
                 m_back_painter->blit_tiled(dirty_rect.location(), *m_wallpaper, dirty_rect);
+            } else {
+                // FIXME: Does not work: offset rect creates trails.
+                m_back_painter->draw_scaled_bitmap(dirty_rect, *m_wallpaper,
+                                                   { dirty_rect.location(),
+                                                     m_wallpaper->size() });
             }
         }
     }

+ 1 - 1
Servers/WindowServer/WSCompositor.h

@@ -10,7 +10,7 @@
 class Painter;
 class WSCursor;
 
-enum class WallpaperMode { Simple, Tile, Center, Unchecked };
+enum class WallpaperMode { Simple, Tile, Center, Scaled, Unchecked };
 
 class WSCompositor final : public CObject {
 public:

+ 1 - 0
SharedGraphics/Painter.h

@@ -29,6 +29,7 @@ public:
     void blit_dimmed(const Point&, const GraphicsBitmap&, const Rect& src_rect);
     void blit_tiled(const Point&, const GraphicsBitmap&, const Rect& src_rect);
     void blit_offset(const Point&, const GraphicsBitmap&, const Rect& src_rect, const Point&);
+    void blit_scaled(const Point&, const GraphicsBitmap&, const Rect& src_rect, const Size&);
     void draw_text(const Rect&, const char* text, int length, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
     void draw_text(const Rect&, const char* text, int length, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);
     void draw_text(const Rect&, const String&, const Font&, TextAlignment = TextAlignment::TopLeft, Color = Color::Black, TextElision = TextElision::None);