Commit graph

185 commits

Author SHA1 Message Date
Andreas Kling
41ebb3eba3 WindowServer: Tweak window titlebar look somewhat.
Add a subtle shadow to the titlebar text. Also make the titlebar one pixel
taller to fully accomodate the 90s "3D frame" effect. :^)
2019-05-25 21:55:53 +02:00
Andreas Kling
cca510162e GButton: Align the button text according to text_alignment().
Added a Rect::align_within(other_rect, alignment) helper that seemed useful.
2019-05-25 20:15:52 +02:00
Andreas Kling
be62b42352 StylePainter: Remove some unused code. 2019-05-25 03:29:37 +02:00
Andreas Kling
189b342e6f LibC: Add mmap_with_name() that names the allocation immediately.
This allows us to skip the separate call to set_mmap_name() in code that
we control, e.g malloc() and GraphicsBitmap.
2019-05-19 15:54:56 +02:00
Robin Burchell
5babcac289 Build: Install most headers to Root (and libcore.a/libgui.a)
This makes out-of-tree linking possible. And at the same time, add a
CMakeToolchain.txt file that can be used to build arbitrary cmake-using
applications on Serenity by pointing to the CMAKE_TOOLCHAIN_FILE when
running cmake:

    -DCMAKE_TOOLCHAIN_FILE=~/code/serenity/Toolchain/CMakeToolchain.txt
2019-05-17 21:59:48 +02:00
Andreas Kling
641d55c7ef Painter: Always optimize with -O3.
Use a GCC #pragma to always optimize the Painter code with -O3.
This code is performance critical and hotter than anything else in the
system, and this helps quite a bit.

The 2x, 3x and 4x upscaling fast paths benefit greatly from this.
2019-05-11 17:00:46 +02:00
Andreas Kling
788fb7699b Painter: Simplify the draw_scaled_bitmap() fast path for integer scale.
Iterate over the source image instead of the destination image, and blow it
up pixel by pixel. This code will only run for upscaling so we don't need
to worry about anything else.
2019-05-11 16:55:30 +02:00
Andreas Kling
1652cb7db9 Painter: Fix typo in 4x scaling fast path. 2019-05-11 16:00:25 +02:00
Andreas Kling
e2c2a4c6d7 Painter: Add a fast path for draw_scaled_bitmap() with integer scale.
When both the x and y scale factors are integers, we can avoid a whole bunch
of the pixel lookups in the source image.

This makes 2x scaling a 320x200 bitmap another ~25% faster. :^)
2019-05-11 05:34:20 +02:00
Andreas Kling
91a4b60d66 Painter: Templatize the inner loop of draw_scaled_bitmap().
Use templates to specialize draw_scaled_bitmap() so we don't have to blend()
for source without alpha, and also inline the GraphicsBitmap::get_pixel()
logic so we don't have to branch on the bitmap format on every iteration.

This is another ~30% speedup on top of the previous changes. :^)
2019-05-11 03:53:28 +02:00
Andreas Kling
01a1194e6f StylePainter: Remove some unused variables. 2019-05-11 03:53:20 +02:00
Andreas Kling
e491dd2125 Painter: Improve draw_scaled_bitmap() performance.
- Removed extra bounds checking.
- Converted it to use integer math for the scale factors.
- Using blend() for everything.

Patch contributed by "pd"
2019-05-11 02:55:42 +02:00
Andreas Kling
c9951bbe60 WindowServer: Improve window frames by giving them a raised frame look. :^) 2019-05-11 01:31:10 +02:00
Andreas Kling
aff2fa4383 GraphicsBitmap: size_in_bytes() was overshooting by 4x, oops! 2019-05-08 03:28:40 +02:00
Andreas Kling
e8d395b14d Painter: Support diagonal lines with dy>dx, and apply clipping as well. 2019-05-07 17:01:55 +02:00
Andreas Kling
1af9b6f102 Painter: Remove unused draw_focus_rect(). 2019-05-07 16:17:28 +02:00
Andreas Kling
5c4b421d56 GTabWidget: Highlight tab buttons when hovered.
The active tab's button doesn't get highlighted, since the highlight is
supposed to indicate that the widget can be interacted with.
2019-05-07 14:01:20 +02:00
Andreas Kling
cb3e150983 GraphicsBitmap: Add non-const overload of bits().
This is clearly useful, I don't know why I thought it wasn't.
2019-05-06 20:29:52 +02:00
Andreas Kling
61e3ecec79 GraphicsBitmap: Add a new "Indexed8" format that uses a 256-entry palette.
These bitmaps should only be used as a source bitmap, we won't support
painting into them using Painter. You can however manipulate the raw
pixel data. :^)
2019-05-06 19:32:56 +02:00
Andreas Kling
cec16105cc Make sure all GraphicsBitmap scanlines are 16-byte aligned.
This is a prerequisite for some optimizations.
2019-05-06 14:04:54 +02:00
Andreas Kling
6df3df62be Color: Add named color "Cyan" 2019-05-06 00:59:33 +02:00
Andreas Kling
3bdb95e128 ProcessManager+LibGUI: Tweak things to improve ProcessManager look. 2019-05-05 20:53:04 +02:00
Andreas Kling
9e5ad25188 GTabWidget: Paint a frame around the container part of the widget.
Then make the active tab stand out by punching a hole in the frame below
its button.
2019-05-05 15:03:34 +02:00
Andreas Kling
4e1b36ddf2 GTabWidget: Make a custom look for tab buttons. 2019-05-05 14:39:37 +02:00
Andreas Kling
f3aec1a0d9 Painter: Re-enable diagonal draw_line().
This code still needs clipping, but the basic concept works. It was disabled
since before the kernel had floating point support.
2019-05-04 23:40:52 +02:00
Andreas Kling
a8c856ed3d GTableView: Improve look of column headers, and add sort order indicators. 2019-05-04 21:16:41 +02:00
Andreas Kling
4508287cb2 GButton: Draw disabled buttons with grayed-out text.
Based on a patch from "pd" (thanks!)
2019-05-02 13:57:35 +02:00
Andreas Kling
f4b190c58b PNGLoader: Tag the decoded bitmap with the source PNG path. 2019-04-30 13:46:03 +02:00
Andreas Kling
8f81a3f9dd LibGUI+WindowServer: Make it possible to have checkable GActions.
They show up as checkable GButtons in GToolBar, and with (or without) check
marks in menus.

There are a bunch of places to make use of this. This patch only takes
advantage of it in the FileManager for the view type actions.
2019-04-26 21:09:56 +02:00
Andreas Kling
e90b501b31 GraphicsBitmap: munmap() pixels on destruction of self-allocating bitmaps. 2019-04-26 18:25:05 +02:00
Andreas Kling
7dc4078a73 SharedGraphics: Add is_right_text_alignment(TextAlignment) helper.
This seems a tad bit more future-proof than manually checking all the valid
right-side TextAlignment values in clients.
2019-04-24 23:46:19 +02:00
Andreas Kling
58240fdb33 Do a pass of compiler warning fixes.
This is really making me question not using 64-bit integers more.
2019-04-23 13:00:53 +02:00
Andreas Kling
7efd61fcf5 WindowSerer+LibGUI: Send multiple rects in invalidation/flush messages.
This patch moves to sending up to 32 rects at a time when coordinating the
painting between WindowServer and its clients. Rects are also merged into
a minimal DisjointRectSet on the server side before painting.

Interactive resize looks a lot better after this change, since we can
usually do all the repainting needed in one go.
2019-04-20 17:23:35 +02:00
Andreas Kling
5eedb22834 Sprinkle use of AK::Vector in various places.
Some of these are less helpful than others. Avoiding a bunch of mallocs
in the event loop wakeup code is definitely nice.
2019-04-20 14:02:19 +02:00
Andreas Kling
86361d3d45 WindowServer: Improve the look of menus.
This patch makes menus stand out a bit more from their background by using
the same kind of shading that Windows 2000 had.
2019-04-16 17:02:26 +02:00
Andreas Kling
f61549ca5f Make better use of geometry class helpers in some places. 2019-04-16 13:58:02 +02:00
Andreas Kling
a082738f04 SharedGraphics: Move PainterStateSaver out of line. 2019-04-16 01:01:03 +02:00
Andreas Kling
9eab8734fe PNGLoader: Disable debug spam. 2019-04-15 23:47:42 +02:00
Andreas Kling
0f4050903d GVariant: Add to_bool(), to_int() and to_color(). 2019-04-13 12:39:20 +02:00
Andreas Kling
3674bb9429 GVariant: Tweak stringification of Color, Boolean and Invalid variants. 2019-04-12 14:49:45 +02:00
Andreas Kling
09339fa912 StylePainter: Don't paint hover frame around disabled CoolBar buttons. 2019-04-12 02:51:59 +02:00
Andreas Kling
a1015840ff Color: Add a simple lightened() helper. 2019-04-12 02:50:43 +02:00
Andreas Kling
476c43ab22 Painter: Add alpha-blending support to blit_dimmed(). 2019-04-12 02:50:28 +02:00
Andreas Kling
93b76628a5 GGroupBox: Improve appearance with new FrameShape::Box style. 2019-04-11 14:27:31 +02:00
Andreas Kling
5e0577a042 Introduce LibCore and move GElapsedTimer => CElapsedTimer.
I need a layer somewhere between AK (usable both by userspace and kernel)
and LibGUI (usable by userspace except WindowServer.) So here's LibCore.
2019-04-10 16:14:44 +02:00
Andreas Kling
a74f3615ac Color: Add to_grayscale() and darkened() helpers. 2019-04-10 16:00:29 +02:00
Andreas Kling
30e2d62c38 WindowServer: Factor out some parts of compose().
The main compositing loop was getting pretty unwieldy. Break out some parts
into functions so it's more understandable.
2019-04-10 13:51:47 +02:00
Andreas Kling
4ab0cd5d4c LibGUI: Move frame painting from GFrame to StylePainter.
This way it can be used by others who might not have a GFrame object.
2019-04-10 03:43:46 +02:00
Andreas Kling
4abffa4dbe GSpinBox: Put nice little arrow glyphs on the buttons. 2019-04-10 01:37:08 +02:00
Andreas Kling
f12573cb63 Add a slight hover highlight to GButton and WSButton. :^) 2019-04-06 04:08:09 +02:00