mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-30 22:24:24 +00:00
gems: reset 'Nitpicker_buffer' to gray, not black
This improves the output quality of antialiased lines onto a transparent nitpicker buffer. For antialiased graphics operations, the initial color leaks through. Leaking 50% gray is better than leaking black, in particular when drawing white lines.
This commit is contained in:
parent
c3d3815476
commit
29c6d9ee9d
@ -90,7 +90,9 @@ struct Nitpicker_buffer
|
|||||||
ram(ram), rm(rm), nitpicker(nitpicker),
|
ram(ram), rm(rm), nitpicker(nitpicker),
|
||||||
mode(Genode::max(1UL, size.w()), Genode::max(1UL, size.h()),
|
mode(Genode::max(1UL, size.w()), Genode::max(1UL, size.h()),
|
||||||
nitpicker.mode().format())
|
nitpicker.mode().format())
|
||||||
{ }
|
{
|
||||||
|
reset_surface();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -131,7 +133,20 @@ struct Nitpicker_buffer
|
|||||||
{
|
{
|
||||||
Genode::size_t const num_pixels = pixel_surface().size().count();
|
Genode::size_t const num_pixels = pixel_surface().size().count();
|
||||||
Genode::memset(alpha_surface().addr(), 0, num_pixels);
|
Genode::memset(alpha_surface().addr(), 0, num_pixels);
|
||||||
Genode::memset(pixel_surface().addr(), 0, num_pixels*sizeof(Pixel_rgb888));
|
|
||||||
|
/*
|
||||||
|
* Initialize color buffer with 50% gray
|
||||||
|
*
|
||||||
|
* We do not use black to limit the bleeding of black into antialiased
|
||||||
|
* drawing operations applied onto an initially transparent background.
|
||||||
|
*/
|
||||||
|
Pixel_surface pixels = pixel_surface();
|
||||||
|
Pixel_rgb888 *dst = pixels.addr();
|
||||||
|
|
||||||
|
Pixel_rgb888 const gray(127, 127, 127, 255);
|
||||||
|
|
||||||
|
for (unsigned n = pixels.size().count(); n; n--)
|
||||||
|
*dst++ = gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename DST_PT, typename SRC_PT>
|
template <typename DST_PT, typename SRC_PT>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user