Commit graph

207 commits

Author SHA1 Message Date
Tom
607c78336b LibGfx: Add ability to draw inverted rectangles 2020-09-08 10:45:35 +02:00
Andreas Kling
08f1ea3e45 LibGfx: Make fill_rect_with_dither_pattern() skip transparent colors
Maybe this should do full blending, but for now at least skip source
pixels that have zero alpha.
2020-09-01 23:55:35 +02:00
Peter Nelson
259f8541fc LibGfx: implement GIF RestorePrevious frame disposal mode 2020-08-31 18:54:44 +02:00
Peter Nelson
c3ee5e3451 LibGfx: clear previous GIF frame to transparent instead of whole image 2020-08-31 18:54:44 +02:00
Andreas Kling
95ed363b15 LibGfx: Fix Lagom build (possible uninitialized variable warnings) 2020-08-30 10:40:40 +02:00
Peter Nelson
b742d593dd LibGfx: use Gfx::Color instead of local struct for GIF colour map 2020-08-30 10:27:36 +02:00
Peter Nelson
c8eccc00b1 LibGfx: only cache last decoded GIF frame
GIFLoader now uses a single frame buffer to cache the last decoded
frame. This drastically reduces memory usage at the small expense of
re-decoding frames on each loop.
2020-08-30 10:27:36 +02:00
Peter Nelson
786872e4c9 LibGfx: add support for interlaced GIFs 2020-08-30 10:27:36 +02:00
Peter Nelson
1341025da7 LibGfx: correctly handle GIF frame disposal modes
RestoreBackground disposal mode is now a transparent fill to allow
background to show through.

RestorePrevious disposal mode now restores the previous frame.
2020-08-30 10:27:36 +02:00
Ben Wiederhake
d8e22fedc3 Libraries: Unbreak building with extra debug macros 2020-08-30 09:43:49 +02:00
thankyouverycool
0bb2025b69 Base: Create /res/icons/serenity for misc. sized system icons 2020-08-27 15:38:02 +02:00
Ben Wiederhake
9f7ec33180 Meta: Force semi-colon after MAKE_AK_NONXXXABLE()
Before, we had about these occurrence counts:
COPY: 13 without, 33 with
MOVE: 12 without, 28 with

Clearly, 'with' was the preferred way. However, this introduced double-semicolons
all over the place, and caused some warnings to trigger.

This patch *forces* the usage of a semi-colon when calling the macro,
by removing the semi-colon within the macro. (And thus also gets rid
of the double-semicolon.)
2020-08-27 10:12:04 +02:00
thankyouverycool
208cb995ba WindowServer+LibGfx: Move title bar button layout to WindowTheme 2020-08-26 08:53:14 +02:00
LepkoQQ
bb5014fad7 LibGfx: Use valid hsv values in painter debug 2020-08-26 00:38:23 +02:00
LepkoQQ
7a46e0fa35 LibGfx: Always use 0..360 0..1 0..1 in HSV colors 2020-08-26 00:38:23 +02:00
asynts
10c6f062b3 AK: Add Endian.h header to replace NetworkOrdered.h. 2020-08-25 16:22:14 +02:00
Andreas Kling
03c576acc5 LibGUI+LibGfx: Implement upside-down appearance for bottom-side tabs
GUI::TabWidget has long has a TabPosition::Bottom option, but we still
rendered the tab buttons the same as TabPosition::Top.

This patch implements a custom look for bottom-side tabs. I've done my
best to match the look of the top-side ones, but there might be some
improvements we can make here. :^)
2020-08-23 23:53:45 +02:00
Andreas Kling
85e818206c LibGfx+WindowServer: Simplify notification window frame theming
Don't require theme clients to provide the frame rect, the theme can
compute that internally based on the window rect.
2020-08-23 13:17:34 +02:00
Peter Elliott
28db3cd5ef LibGfx: Add TextAlignment::BottomRight 2020-08-23 01:05:22 +02:00
Andreas Kling
50076997f4 LibGfx: Use an enumerator macro for color roles 2020-08-21 21:16:13 +02:00
Andreas Kling
80a9896e83 LibGfx+WindowServer: Simplify WindowTheme::paint_normal_frame() API
Don't require passing in the outer frame rect since the theme can
compute that itself, based on the window rect.
2020-08-21 21:16:13 +02:00
Andreas Kling
7903cfa5e4 LibGfx: Support loading GIF local color maps if present :^) 2020-08-20 19:42:06 +02:00
Andreas Kling
28e34ffe38 LibGfx: Initialize some uninitialized things in GIFLoader 2020-08-20 19:41:29 +02:00
Tom
5cd2a37079 LibGfx: Small improvement for DisjointRectSet::shatter
This avoids a call to clone() which would be discarded immediately.
Also, avoid essentially cloning for each hammer rectangle unless
there is actually a need for it.
2020-08-19 11:20:27 +02:00
Tom
f8903acea2 LibGfx: Add convenience helpers for Rect 2020-08-18 12:12:27 +02:00
Tom
a43ba348e1 LibGfx: Add convenience method Point::constrained 2020-08-18 12:12:27 +02:00
Tom
790eacfbd1 LibGfx: Add a few convenience methods to DisjointRectSet 2020-08-18 12:12:27 +02:00
Sarah
ee912e023c LibGfx: Move original StylePainter code to ClassicStylePainter
StylePainter should continue to work the same as before.
2020-08-17 00:00:34 +02:00
Sarah
d0900228d0 LibGfx: Add abstract StylePainter class
StylePainter's behavior is now handled by a static instance
of BaseStylePainter. The original static behavior of StylePainter
is left as-is for API compatibility.
2020-08-17 00:00:34 +02:00
thankyouverycool
126a03f087 LibGfx: Add initial font family matching
Fonts following the TypefaceWeightSize naming scheme now associate
with bold weights of the same name and glyph size on construction.
2020-08-16 19:39:46 +02:00
Nico Weber
430b265cd4 AK: Rename KB, MB, GB to KiB, MiB, GiB
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9".
The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30".

Let's use the correct name, at least in code.

Only changes the name of the constants, no other behavior change.
2020-08-16 16:33:28 +02:00
Peter Nelson
c8f8f4e6c3 LibGfx: use disposal method of previous frame in GIF transparency
The disposal method on a GIF animation frame now correctly applies to
rendering of the next frame.
2020-08-13 15:49:41 +02:00
Peter Nelson
daa762bb06 LibGfx: correctly handle transparency between GIF frames
This fixes an issue where transparent pixels in GIF animation frames
have their alpha values incorrectly set to zero, allowing the
background behind the GIF to show through, instead of the previous
animation frame.

Additionally, transparent pixels are now correctly identified based on
their index matching the image transparency index, instead of their
color values.
2020-08-13 15:49:41 +02:00
Ben Wiederhake
f2f0c22052 LibGfx: Mark compilation-unit-only functions as static
This enables a nice warning in case a function becomes dead code.
2020-08-12 20:40:59 +02:00
Linus Groh
7072806234 Meta: Replace remaining LibM/math.h includes with math.h 2020-08-12 16:18:33 +02:00
Andreas Kling
ae0ff13f66 LibGfx: Correct copyright years for {Classic,}WindowTheme.{cpp,h} 2020-08-10 21:20:28 +02:00
Andreas Kling
de1a54c378 WindowServer+LibGfx: Move window frame rect calculation to WindowTheme 2020-08-10 13:03:44 +02:00
Sarah
9714e61d62 ClassicWindowTheme: Fix titlebar redraw issues
This fixes titlebar rects being overly large and leaving smeary
undrawn areas when using a theme with a titlebar height
different to 19px.
2020-08-10 11:48:47 +02:00
Andreas Kling
c81c8b68bb WindowServer+LibGfx: Move notification window frame painting to LibGfx
ClassicWindowTheme can now also paint notification window frames.
2020-08-09 19:34:56 +02:00
Andreas Kling
e7460b6fb4 WindowServer+LibGfx: Move normal window frame painting to a WindowTheme
This patch introduces the ClassicWindowTheme, which is our default
theme implemented as a Gfx::WindowTheme subclass.

In this initial cut, we move normal window frame painting and title
bar metrics helpers out of WindowServer and into LibGfx.

This will eventually allow us much greater flexibility with theming
windows, and also makes it easier to build applications that want to
render a window with a specific style for some reason. :^)
2020-08-09 19:29:15 +02:00
Andreas Kling
a94be95e27 LibGfx: Add a basic abstract WindowTheme class
This class will provide painting and metrics for window themes. :^)
2020-08-09 19:28:36 +02:00
Andreas Kling
0bbced444b LibGfx: Add dummy Font::x_height() getter
Right now we just guess that the x-height is glyph_height/2, which is
obviously not accurate. We currently don't store the x-height in fonts,
so that's something we'll need to fix.
2020-08-07 20:29:32 +02:00
asynts
b3d1a05261 Refactor: Expose const_cast by removing ByteBuffer::warp(const void*, size_t)
This function did a const_cast internally which made the call side look
"safe". This method is removed completely and call sites are replaced
with ByteBuffer::wrap(const_cast<void*>(data), size) which makes the
behaviour obvious.
2020-08-06 10:33:16 +02:00
Nico Weber
ce95628b7f Unicode: Try s/codepoint/code_point/g again
This time, without trailing 's'. Ran:

    git grep -l 'codepoint' | xargs sed -ie 's/codepoint/code_point/g
2020-08-05 22:33:42 +02:00
Nico Weber
19ac1f6368 Revert "Unicode: s/codepoint/code_point/g"
This reverts commit ea9ac3155d.
It replaced "codepoint" with "code_points", not "code_point".
2020-08-05 22:33:42 +02:00
Andreas Kling
00fe4c7bcb LibGfx: Make draw_scaled_bitmap() apply relative opacity
Instead of overriding the alpha value of all source pixels, apply the
override opacity by multiplying with the source alpha.

Fixes #3004.
2020-08-05 14:43:36 +02:00
Andreas Kling
984683cf34 Revert "LibM: Always include <math.h> instead of <LibM/math.h>"
This reverts commit dc12cbca41.

Sadly this broke the build due to some confusion about <new>.
Reverting until this can be solved fully.
2020-08-04 21:17:43 +02:00
Andreas Kling
dc12cbca41 LibM: Always include <math.h> instead of <LibM/math.h>
This makes Lagom pick up the host math.h, which is what we want.
2020-08-04 19:06:27 +02:00
Andreas Kling
ea9ac3155d Unicode: s/codepoint/code_point/g
Unicode calls them "code points" so let's follow their style.
2020-08-03 19:06:41 +02:00
Nico Weber
6dd10ad8dc Themes: Fix default theme window stripes and shadow after #2811
Change #2811 made window title stripes and window title shadow themable,
but it used the same stripe and shadow color for all window modes.
This is fine for the new 'basalt' theme which uses the same color
in all four window modes, but it changed the default theme so that
background windows had brown stripes and a brown shadow.

Instead, make the title stripe and title shadow themable per window mode,
and change the default theme to restore the colors it had before
change #2811: The title stripe color is the same as Border1 for all
window modes, and the title shadow is the same as the title stripe
darkened by 0.6.
2020-08-01 19:26:54 +02:00