Commit Graph

31 Commits

Author SHA1 Message Date
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
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
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
Robin Burchell
1024dfa81a StringViewize a bunch of things -- mostly LibGUI 2019-06-03 20:27:05 +02:00
Andreas Kling
aff2fa4383 GraphicsBitmap: size_in_bytes() was overshooting by 4x, oops! 2019-05-08 03:28:40 +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
f4b190c58b PNGLoader: Tag the decoded bitmap with the source PNG path. 2019-04-30 13:46:03 +02:00
Andreas Kling
e90b501b31 GraphicsBitmap: munmap() pixels on destruction of self-allocating bitmaps. 2019-04-26 18:25:05 +02:00
Andreas Kling
5b296718d8 GraphicsBitmap: Use MappedFile. 2019-04-03 14:32:45 +02:00
Andreas Kling
92627154a7 FileManager: Add basic thumbnailing of PNG images.
These use nearest neighbor and are computed synchronously on directory load
so it's neither fast nor very beautiful. These issues both need work on
other parts of the system to fix.
2019-03-23 12:37:33 +01:00
Andreas Kling
7c0a185970 Use the PNG loader for all images, and get rid of the .rgb files. 2019-03-22 00:21:03 +01:00
Andreas Kling
4e451c1e92 Add client-side double buffering of window backing stores.
This prevents flicker and looks rather good. The main downside is that
resizing gets even more sluggish. That's the price we pay for now.
2019-03-17 04:23:54 +01:00
Andreas Kling
eda0866992 Add a C++ helper class for working with shared buffers.
This is a bit more comfortable than passing the shared buffer ID manually
everywhere and keeping track of size etc.
2019-03-08 12:24:05 +01:00
Andreas Kling
2cfcbdc735 AK: Add Retained<T>, like RetainPtr, but never null.
Also use some Clang attribute wizardry to get a warning for use-after-move.
2019-02-25 12:43:52 +01:00
Andreas Kling
9b71307d49 WindowServer: Support windows with alpha channels. And per-WSWindow opacity.
This patch also adds a Format concept to GraphicsBitmap. For now there are
only two formats: RGB32 and RGBA32. Windows with alpha channel have their
backing stores created in the RGBA32 format.

Use this to make Terminal windows semi-transparent for that comfy rice look.
There is one problem here, in that window compositing overdraw incurs
multiple passes of blending of the same pixels. This leads to a mismatch in
opacity which is obviously not good. I will work on this in a later patch.

The alpha blending is currently straight C++. It should be relatively easy
to optimize this using SSE instructions.

For now I'm just happy with the cute effect. :^)
2019-02-19 01:42:53 +01:00
Andreas Kling
640360e958 Move WindowServer to userspace.
This is a monster patch that required changing a whole bunch of things.
There are performance and stability issues all over the place, but it works.
Pretty cool, I have to admit :^)
2019-02-17 00:13:47 +01:00
Andreas Kling
09aaa41e62 SharedGraphics: Rework GraphicsBitmap::create_kernel_only() into create().
And just use mmap() to allocate the pixels.
2019-02-16 12:22:52 +01:00
Andreas Kling
4ea28bf0a5 Kernel: Add a simple shared memory API for two processes only.
And use this to implement shared bitmaps between WindowServer and clients.
2019-02-16 12:13:43 +01:00
Andreas Kling
443b043b49 WindowServer: Start implementing a menu system.
I'm going with a global top-of-the-screen menu instead of per-window menus.
The basic idea is that menus will live in the WindowServer and clients can
create menus via WindowServer requests.
2019-02-11 09:47:10 +01:00
Andreas Kling
887b4a7a1a Start working on a simple Launcher app.
Let GButton have an optional icon (GraphicsBitmap) that gets rendered in the
middle of the button if present.

Also add GraphicsBitmap::load_from_file() which allows mmap'ed RGBA32 files.
I wrote a little program to take "raw" files from GIMP and swizzle them into
the correct byte order.
2019-02-07 23:17:06 +01:00
Andreas Kling
2dc9c86bad Kernel: Make Process a Weakable class.
Use this to fix a use-after-free in ~GraphicsBitmap(). We'd hit this when
the WindowServer was doing a deferred destruction of a WSWindow whose
backing store referred to a now-reaped Process.
2019-01-31 07:02:40 +01:00
Andreas Kling
86eae0f8df Let userland retain the window backing store while drawing into it.
To start painting, call:
gui$get_window_backing_store()

Then finish up with:
gui$release_window_backing_store()

Process will retain the underlying GraphicsBitmap behind the scenes.
This fixes racing between the WindowServer and GUI clients.

This patch also adds a WSWindowLocker that is exactly what it sounds like.
2019-01-24 23:44:19 +01:00
Andreas Kling
7e5b81fe48 Make a SharedGraphics directory for classes shared between Kernel and LibGUI. 2019-01-19 23:22:46 +01:00