Commit graph

216 commits

Author SHA1 Message Date
Andreas Kling
07d11a9b6b SharedGraphics: Add LogStream operator<<'s for Rect, Point and Size. 2019-07-04 06:45:50 +02:00
Andreas Kling
27f699ef0c AK: Rename the common integer typedefs to make it obvious what they are.
These types can be picked up by including <AK/Types.h>:

* u8, u16, u32, u64 (unsigned)
* i8, i16, i32, i64 (signed)
2019-07-03 21:20:13 +02:00
VAN BOSSUYT Nicolas
802d4dcb6b Meta: Removed all gitignore in the source tree only keeping the root one 2019-06-30 10:41:26 +02:00
Andreas Kling
315716d193 GUI: Use Win2K-like "warm gray" color instead of the older colder gray.
Someone suggested this a long time ago and I never got around to it.
So here we go, here's the warm gray! I have to admit I like it better. :^)
2019-06-30 09:23:16 +02:00
Andreas Kling
5cb324ee02 GraphicsBitmap: Add bpp(), returns the number of bits per pixel. 2019-06-25 20:33:24 +02:00
Andreas Kling
5aefd7f828 PaintBrush: Implement a thickness setting for the pen tool.
Painter gains the ability to draw lines with arbitrary thickness.
It's basically implemented by drawing filled rects for thickness>1.

In PaintBrush, Tool classes can now override on_contextmenu() to
provide a context menu for the toolbox button. :^)
2019-06-23 10:00:02 +02:00
Andreas Kling
3f0f7caa45 LibGUI: Fix compiler warnings. 2019-06-22 14:41:11 +02:00
Andreas Kling
d343fb2429 AK: Rename Retainable.h => RefCounted.h. 2019-06-21 18:58:45 +02:00
Andreas Kling
550b0b062b AK: Rename RetainPtr.h => RefPtr.h, Retained.h => NonnullRefPtr.h. 2019-06-21 18:45:59 +02:00
Andreas Kling
90b1354688 AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr. 2019-06-21 18:37:47 +02:00
Andreas Kling
77b9fa89dd AK: Rename Retainable => RefCounted.
(And various related renames that go along with it.)
2019-06-21 15:30:03 +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
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
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
58a2b9336a Color: Add inverted().
Patch contributed by "pd"
2019-06-11 07:28:59 +02:00
Andreas Kling
6aa4cb6740 GraphicsBitmap: Add a fill(Color) helper.
This only works for RGB32 and RGBA32 bitmaps at the moment, since it's not
obvious what should happen in an Indexed8 bitmap.
2019-06-10 19:29:50 +02:00
Andreas Kling
39d1a9ae66 Meta: Tweak .clang-format to not wrap braces after enums. 2019-06-07 17:13:23 +02:00
Andreas Kling
76b3337498 SharedGraphics: Run clang-format on everything. 2019-06-07 11:46:55 +02:00
Christopher Dumas
908d9458c7 WindowServer: New API for Scaled Blit 2019-06-06 18:35:00 +02:00
Christopher Dumas
90d924a97c WindowServer: Implement scaled backgrounds and scaled blitting function 2019-06-06 18:35:00 +02:00
Christopher Dumas
c72953cf06 WindowServer: Clang-Format 2019-06-06 18:35:00 +02:00
Robin Burchell
ab004f73bf Painter: Reduce the number of draw_text overloads to only involve StringView
No more char + int sequences, as that's literally what StringView is for.
2019-06-03 20:27:05 +02:00
Robin Burchell
1024dfa81a StringViewize a bunch of things -- mostly LibGUI 2019-06-03 20:27:05 +02:00
Andreas Kling
6956d161c4 PNGLoader: Annotate the decompression buffer mmap with a name. 2019-06-01 17:06:35 +02:00
Christopher Dumas
3e26faa226 removed extra impl of scaling 2019-05-27 21:40:53 +02:00
Christopher Dumas
da9c70598f centered backgrounds are now an option 2019-05-27 21:40:53 +02:00
Christopher Dumas
aa50e5bb13 tiled backgrounds no longer has strange off-by-one pixel errors 2019-05-27 21:40:53 +02:00
Christopher Dumas
c23882dde1 can now tile background and made sure the IRC choose server popup still works 2019-05-27 21:40:53 +02:00
Andreas Kling
4fb2e5d8af SharedGraphics: Make Rect::shatter() return a Vector<Rect, 4>.
We know that shatter() will never return more than four rects, so we can
use vector inline capacity to always avoid heap allocation here.
2019-05-27 12:50:18 +02:00
Robin Burchell
9b86eb9fad WSCompositor: Allow a compose to bypass the timer when it first happens
d66fa60fcf introduced the use of a timer
to coalesce screen updates. This is OK, but it does introduce update
latency.

To help mitigate the impact of this, we now have a second (immediate)
timer. When a compose pass is first triggered, the immediate timer will
allow the compose to happen on the next spin of the event loop (so, only
coalescing updates across a single event loop pass). Any updates that
trigger while the delayed timer is running, though, will be delayed to
that (~60fps) timer.

This fixes #103.
2019-05-26 18:22:33 +02:00
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