summaryrefslogtreecommitdiff
path: root/Userland/Demos/LibGfxScaleDemo
AgeCommit message (Collapse)Author
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-05-12Everywhere: Add Alt shortcuts to remaining top-level menusLinus Groh
Not sure why some menus did have one and others didn't, even in the same application - now they all do. :^) I added character shortcuts to some menu actions as well.
2021-05-12Everywhere: Rename app_menu to file_menu, continuedLinus Groh
These were missed in 4b0098e.
2021-05-01WindowServer+LibGfx: Automatic "modified" markers in window titlesAndreas Kling
You can now add the string "[*]" to a window title and it will be replaced with " (*)" if the window is modified, and with "" otherwise.
2021-05-01Demos: Added Alt+F4 funtionality to demos that lacked itinalone
The Fire, LibGfxDemo and LibGfxScaleDemo demos did not have Alt+F4 functionality as they lacked menubars - I just added basic menubars with Quit entries to allow this shortcut with the demos that didn't have it.
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-25WindowServer+LibGfx: Show menus in windows! :^)Andreas Kling
This patch begins the transition away from the global menu towards per-window menus instead. The global menu looks neat, but has always felt clunky, and there are a number of usability problems with it, especially in programs with multiple windows. You can now call GUI::Window::set_menubar() to add a menubar to your window. It will be specific to that one window only.
2021-03-16LibGfx: Rename 32-bit BitmapFormats to BGRA8888 and BGRx888xAndreas Kling
The previous names (RGBA32 and RGB32) were misleading since that's not the actual byte order in memory. The new names reflect exactly how the color values get laid out in bitmap data.
2021-03-12Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)Andreas Kling
Good-bye LogStream. Long live AK::Format!
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-01-25LibGfx: Implement scaling support for Painter::blit_filtered()Nico Weber
...and functions implemented in terms of it: blit_brightened(), blit_dimmed(), blit_disabled(). In theory, this should stop the window server from asserting when an application becomes unresponsive, but that feature seems to be broken for unrelated reasons atm (#5111).
2021-01-25LibGfx: Fix opacity handling in Painter::draw_scaled_bitmapNico Weber
If the source image had no alpha channel we'd ignore opacity < 1.0 and blit the image as if it was fully opaque. With this fix, adjusting the opacity of windows with mousewheel while holding super works in hidpi mode.
2021-01-25LibGfx:: Implement scale support for blit_with_opacity()Nico Weber
Now we no longer crash on mousewheel over Terminal while holding the super key. The terminal window doesn't yet correctly become transparent in hidpi mode (needs more investigation), but it works in LibGfxScaleDemo, so maybe that's a problem elsewhere. Also add a FIXME for a pre-existing bug.
2021-01-23WindowServer: Don't crash on wallpapers smaller than the desktop with fill ↵Nico Weber
mode 'simple' blit() calls draw_scaled_bitmap() behind the scenes in scaled contexts, and that doesn't like src_rect to be outside of the source bitmap's bounds. Implicitly clip with the source rect, like the non-scaled codepath already does. Fixes #5017 even more.
2021-01-23LibGfx: Make draw_tiled_bitmap() in scaled contexts actually workNico Weber
2021-01-22LibGfx: Add a draw_scaled_bitmap() variant that takes a FloatRect as src_rectNico Weber
Consider draw_scaled_bitmap({0, 0, 10, 10}, source, {0, 0, 5, 5}). Imagine wanting to split that up into two calls, like e.g. the compositor when redrawing the background with damage rects. You really want to be able to say draw_scaled_bitmap({0, 0, 5, 10}, source, {0, 0, 2.5, 5}) but up to now you couldn't. Now you can. This makes painting very low-res images (such as tile.png) in mode "stretch" work much better.
2021-01-22LibGfx: Correctly handle source rect offset in draw_scaled_bitmapNico Weber
The do_draw_integer_scaled_bitmap() fastpath already handled this correctly, but the arbitrary scale path did not.
2021-01-20LibGfxScaleDemo: Add coverage for blit_with_alphaNico Weber
2021-01-20LibGfx: Give Bitmap a scale factorNico Weber
Gfx::Bitmap can now store its scale factor. Normally it's 1, but in high dpi mode it can be 2. If a Bitmap with a scale factor of 2 is blitted to a Painter with scale factor of 2, the pixels can be copied over without any resampling. (When blitting a Bitmap with a scale factor of 1 to a Painter with scale factor of 2, the Bitmap is painted at twice its width and height at paint time. Blitting a Bitmap with a scale factor of 2 to a Painter with scale factor 1 is not supported.) A Bitmap with scale factor of 2 reports the same width() and height() as one with scale factor 1. That's important because many places in the codebase use a bitmap's width() and height() to layout Widgets, and all widget coordinates are in logical coordinates as well, per Documentation/HighDPI.md. Bitmap grows physical_width() / physical_height() to access the actual pixel size. Update a few callers that work with pixels to call this instead. Make Painter's constructor take its scale factor from the target bitmap that's passed in, and update its various blit() methods to handle blitting a 2x bitmap to a 2x painter. This allows removing some gnarly code in Compositor. (In return, put some new gnarly code in LibGfxScaleDemo to preserve behavior there.) No intended behavior change.
2021-01-17LibGfx: Make Painter take the scale factor as constructor argumentNico Weber
I want to give Bitmap an intrinsic scale factor and this is a step in that direction. No behavior change.
2021-01-16Everywhere: Drop "shared_buffer" in most GUI programs, pledge "recvfd"Andreas Kling
Now that WindowServer broadcasts the system theme using an anonymous file, we need clients to pledge "recvfd" so they can receive it. Some programs keep the "shared_buffer" pledge since it's still used for a handful of things.
2021-01-15LibGfxScaleDemo: Add Emoji to window title barNico Weber
I thought this wouldn't work yet, but it already does.
2021-01-15LibGfx: Make Painter::draw_rect() scale-awareNico Weber
Needed for the window server minimize animation. draw_rect() can't just call draw_line() because that isn't draw_op()-aware. The draw_op()-awareness in Painter looks a bit ad-hoc, but that's for another day.
2021-01-15Demos+Games: Pledge "sendfd" in demos and gamesTheMorc
2021-01-12LibGfx: Make it possible to apply an (integer) scale to a PainterNico Weber
This adds a scale factor to Painter, which will be used for HighDPI support. It's also a step towards general affine transforms on Painters. All of Painter's public API takes logical coordinates, while some internals deal with physical coordinates now. If scale == 1, logical and physical coordinates are the same. For scale == 2, a 200x100 bitmap would be covered by a logical {0, 0, 100, 50} rect, while its physical size would be {0, 0, 200, 100}. Most of Painter's functions just assert that scale() == 1 is for now, but most functions called by WindowServer are updated to handle arbitrary (integer) scale. Also add a new Demo "LibGfxScaleDemo" that covers the converted functions and that can be used to iteratively add scaling support to more functions. To make Painter's interface deal with logical coordinates only, make translation() and clip_rect() non-public.