Commit graph

2861 commits

Author SHA1 Message Date
Andreas Kling
04a8fc9bd7 AK: Add some classes for JSON encoding.
This patch adds JsonValue, JsonObject and JsonArray. You can use them to
build up a JsonObject and then serialize it to a string via to_string().

This patch only implements encoding, no decoding yet.
2019-06-17 19:47:35 +02:00
Sergey Bugaev
7ccb84e58e PaintBrush: Make spray circular. 2019-06-17 16:11:01 +02:00
Sergey Bugaev
9fa4e779ff LibM: Rewrite trigonometric functions.
This way they seem to actually work as expected ;)
2019-06-17 16:11:01 +02:00
Robin Burchell
502c54e39a Add a simple spray fill tool
Could do with some more tweaking no doubt, and it'd be nice to have a
circular spray, but this is better than nothing.
2019-06-17 05:54:32 +02:00
Andreas Kling
940eb1bbeb
Merge pull request #173 from faissaloo/serenity-keys
SerenityKeys
2019-06-16 22:37:33 +02:00
faissaloo
b7d1eee047 LibM: Add trigonometric approximations and misc mathematical functions 2019-06-16 22:14:49 +02:00
faissaloo
54005e6942 GWindow: Get rid of superflous variable 2019-06-16 21:07:55 +01:00
faissaloo
55e115b0cd LibGUI: clang-format 2019-06-16 21:01:51 +01:00
Andreas Kling
0db2f3cbe6 LibHTML: Add a Frame class, start fleshing out recursive layout.
Layout is initiated from Frame::layout(). It makes the document's layout
node as wide as the frame, and then we'll take it from there.
2019-06-16 21:35:03 +02:00
faissaloo
770907f90c GWindow: Cleanup 2019-06-16 16:55:39 +01:00
Andreas Kling
f49e5c6732 PaintBrush: Reduce debug spam in the color editor dialog. 2019-06-16 16:33:16 +02:00
Andreas Kling
cf17e385b5 PaintBrush: Allow editing palette colors by ctrl-clicking them.
Maybe the ColorDialog class could be fashioned into something generally
usable in LibGUI, but for now it lives in the PaintBrush app. :^)
2019-06-16 15:09:36 +02:00
Andreas Kling
017c0f87b4 Color: Add setters for the red, green and blue components. 2019-06-16 15:09:11 +02:00
Andreas Kling
1db169244a GSpinBox: The initial text should be "0". 2019-06-16 15:08:52 +02:00
Robin Burchell
862682b1bb SystemServer: Shut down after 5 seconds if testmode=1 is set on the kernel command line 2019-06-16 14:33:59 +02:00
Robin Burchell
0a3abcc0a8 Kernel: Expose kernel command line to userspace through /proc/cmdline 2019-06-16 14:33:59 +02:00
Callum Attryde
267672efee Userland: Add wc program (#228)
Fixes #159.
2019-06-16 14:13:57 +02:00
Andreas Kling
e3d3e431dc LibHTML: Add a LayoutStyle object (computed style for a LayoutNode.) 2019-06-16 13:44:09 +02:00
Andreas Kling
fec098b5cd LibHTML: Give LayoutNodes a rect.
Also improve the layout tree dump format somewhat.
2019-06-16 12:26:24 +02:00
Robin Burchell
c52d553249 WindowServer: Add a shutdown option to the menu, rather than forcing terminal use 2019-06-16 12:25:30 +02:00
Robin Burchell
952382b413 Kernel/Userland: Add a halt syscall, and a shutdown binary to invoke it 2019-06-16 12:25:30 +02:00
Andreas Kling
9e0f7acfe5 Kernel+Userland: Expose list of network adapters through /proc/netadapters.
Added a simple /bin/ifconfig program that just pretty-prints that file. :^)
2019-06-16 07:06:49 +02:00
Andreas Kling
264890bfc3 PaintBrush: Flood filling with the same color is a no-op. 2019-06-16 06:34:29 +02:00
Andreas Kling
1f51c2b7da LibHTML: Create some subdirectories. 2019-06-15 23:41:15 +02:00
Andreas Kling
0522a8f71c LibHTML: Collapse all-whitespace LayoutText into a single ' ' char. 2019-06-15 23:18:00 +02:00
faissaloo
b635c3db54 Merge remote-tracking branch 'origin/master' into serenity-keys 2019-06-15 21:55:17 +01:00
faissaloo
50fd9ed383 GWindow: Hide SerenityKeys when window is deselected 2019-06-15 21:53:25 +01:00
Andreas Kling
8a0e21b22b LibHTML: Start fleshing out a basic layout tree. 2019-06-15 22:49:44 +02:00
Andreas Kling
f8a86b5164 LibHTML: Basic element attribute parsing. 2019-06-15 21:08:36 +02:00
Andreas Kling
581d6b00c8 LibHTML: Start working on a very simplified HTML parser. 2019-06-15 20:21:57 +02:00
Andreas Kling
a67e823838 LibHTML: Start working on a simple HTML library.
I'd like to have rich text, and we might as well use HTML for that. :^)
2019-06-15 18:55:47 +02:00
Andreas Kling
01d1aee922 AK: Make RetainPtr and Retained more friendly towards const pointers.
Also add operator T&'s to Retained since it's nice to be able to pass them
to a function that takes a T&.
2019-06-15 18:45:44 +02:00
Andreas Kling
694b4a64bd PaintBrush: Make little icons for the pen and bucket tools. 2019-06-15 17:52:53 +02:00
Andreas Kling
dcbddb4f8c GraphicsBitmap: Provide templated versions of get_pixel() and set_pixel().
If we already know the bitmap format used, we can use these functions to
bypass the format checks and go straight to pixel manipulation.
2019-06-15 11:06:02 +02:00
Andreas Kling
150b3cf378 PaintBrush: Fix some silly logic typos in flood fill. 2019-06-15 10:48:20 +02:00
Andreas Kling
a8b2b96f38 PaintBrush: Use a Queue<Point> for the flood fill. 2019-06-15 10:39:45 +02:00
Andreas Kling
bfaa74f076 AK/Tests: Test Queue<String> with large number of elements. 2019-06-15 10:39:19 +02:00
Andreas Kling
c699d9d79d AK: Add a simple Queue<T> class.
The underlying data structure is a singly-linked list of Vector<T>.
We never shift any of the vector contents around, but we batch the memory
allocations into 1000-element segments.
2019-06-15 10:35:35 +02:00
Andreas Kling
9443957c14 PaintBrush: Speed up the bucket tool with smarter use of Vector.
Put together a pretty well-performing queue using a Vector and an offset.
By using the new Vector::shift_left(int) instead of Vector::take_first()
we can avoid shifting the vector contents every time and instead only
do it every so often.

Maybe this could be generalized into a separate class, I'm not sure if it's
the best algorithm though, it's just what I came up with right now. :^)
2019-06-14 21:50:28 +02:00
Andreas Kling
e9c021de92 PaintBrush: Implement a naive but working bucket fill tool.
I've used a SinglyLinkedList<Point> for the flood fill queue, since Vector
was death slow. This could definitely be made faster with a better algorithm
and/or data structure. :^)
2019-06-14 19:11:22 +02:00
Andreas Kling
1ec5172ce1 GraphicsBitmap: Add set_pixel(x, y, Color)
This only works for RGB32 and RGBA32 formats.
2019-06-14 19:10:59 +02:00
Andreas Kling
ae598116f4 Color: Add equality operators. 2019-06-14 19:10:43 +02:00
Andreas Kling
56cbe15033 PaintBrush: Factor out the pen tool into an actual PenTool class.
Also add a Tool base class, and an empty BucketTool subclass which is the
next thing to implement.
2019-06-14 18:51:57 +02:00
Andreas Kling
a12751695e AK/Tests: Add a simple EXPECT_EQ macro and use it for the String test. 2019-06-14 17:52:51 +02:00
Andreas Kling
3557f277f6 AK/Tests: Add some macros for testing. 2019-06-14 17:38:17 +02:00
Sergey Bugaev
d900fe98e2 VM: Remove PhysicalPage::create_eternal().
Now that it is possible to create non-eternal non-freeable
pages, PageDirectory can do just that.
2019-06-14 16:14:49 +02:00
Sergey Bugaev
010314ee66 VM: Make VMObject::create_for_physical_range() create non-freeable pages.
This method is used in BXVGADevice to create pages for the framebuffer;
we should neither make the PhysicalPage instances eternal, nor hand over
actual physical pages to the memory allocator.
2019-06-14 16:14:49 +02:00
Sergey Bugaev
a8e86841ce VM: Support non-freeable, non-eternal PhysicalPages. 2019-06-14 16:14:49 +02:00
Sergey Bugaev
6bb7c80365 VM: Fix leaking PhysicalPage instances.
After PhysicalPage::return_to_freelist(), an actual physical page
is returned back to the memory manager; which will create a new
PhysicalPage instance if it decides to reuse the physical page. This
means this PhysicalPage instance should be freed; otherwise it would
get leaked.
2019-06-14 16:14:49 +02:00
Sergey Bugaev
118cb391dd VM: Pass a PhysicalPage by rvalue reference when returning it to the freelist.
This makes no functional difference, but it makes it clear that
MemoryManager and PhysicalRegion take over the actual physical
page represented by this PhysicalPage instance.
2019-06-14 16:14:49 +02:00