mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-21 06:33:31 +00:00
parent
5bd8fa9678
commit
8a1675e12e
@ -60,8 +60,8 @@ class Genode::Animated_rect : private Animator::Item, Noncopyable
|
||||
}
|
||||
}
|
||||
|
||||
int x() const { return _x >> 10; }
|
||||
int y() const { return _y >> 10; }
|
||||
int x() const { return (int)(_x >> 10); }
|
||||
int y() const { return (int)(_y >> 10); }
|
||||
};
|
||||
|
||||
Animated_point _p1 { }, _p2 { };
|
||||
|
@ -21,16 +21,17 @@
|
||||
*/
|
||||
static inline Genode::Color color_from_hsv(unsigned h, unsigned s, unsigned v)
|
||||
{
|
||||
typedef Genode::Color Color;
|
||||
using Color = Genode::Color;
|
||||
using uint8_t = Genode::uint8_t;
|
||||
|
||||
if (s == 0)
|
||||
return Color(v, v, v);
|
||||
|
||||
unsigned char const region = h / 43;
|
||||
unsigned char const remainder = (h - (region*43)) * 6;
|
||||
unsigned char const p = (v*(255 - s)) >> 8,
|
||||
q = (v*(255 - ((s*remainder) >> 8))) >> 8,
|
||||
t = (v*(255 - ((s*(255 - remainder)) >> 8))) >> 8;
|
||||
uint8_t const region = (uint8_t)(h / 43);
|
||||
uint8_t const remainder = (uint8_t)((h - (region*43)) * 6);
|
||||
uint8_t const p = (uint8_t)((v*(255 - s)) >> 8),
|
||||
q = (uint8_t)((v*(255 - ((s*remainder) >> 8))) >> 8),
|
||||
t = (uint8_t)((v*(255 - ((s*(255 - remainder)) >> 8))) >> 8);
|
||||
|
||||
switch (region) {
|
||||
case 0: return Color(v, t, p);
|
||||
|
@ -39,6 +39,8 @@ struct Gui_buffer
|
||||
|
||||
typedef Genode::Attached_ram_dataspace Ram_ds;
|
||||
|
||||
using size_t = Genode::size_t;
|
||||
|
||||
Genode::Ram_allocator &ram;
|
||||
Genode::Region_map &rm;
|
||||
|
||||
@ -116,7 +118,7 @@ struct Gui_buffer
|
||||
|
||||
Pixel_rgb888 const gray(127, 127, 127, 255);
|
||||
|
||||
for (unsigned n = num_pixels; n; n--)
|
||||
for (size_t n = num_pixels; n; n--)
|
||||
*dst++ = gray;
|
||||
}
|
||||
|
||||
@ -134,7 +136,7 @@ struct Gui_buffer
|
||||
|
||||
void _update_input_mask()
|
||||
{
|
||||
unsigned const num_pixels = size().count();
|
||||
size_t const num_pixels = size().count();
|
||||
|
||||
unsigned char * const alpha_base = fb_ds.local_addr<unsigned char>()
|
||||
+ mode.bytes_per_pixel()*num_pixels;
|
||||
|
@ -40,11 +40,11 @@ class Genode::Lru_cache : Noncopyable
|
||||
|
||||
struct Time { unsigned value; };
|
||||
|
||||
Allocator &_alloc;
|
||||
unsigned const _max_elements;
|
||||
unsigned _used_elements = 0;
|
||||
Time _now { 0 };
|
||||
Stats _stats { };
|
||||
Allocator &_alloc;
|
||||
size_t const _max_elements;
|
||||
size_t _used_elements = 0;
|
||||
Time _now { 0 };
|
||||
Stats _stats { };
|
||||
|
||||
class Tag
|
||||
{
|
||||
|
@ -18,7 +18,10 @@
|
||||
#include <os/texture.h>
|
||||
|
||||
/* libpng include */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#include <png.h>
|
||||
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
|
||||
|
||||
/* gems includes */
|
||||
#include <gems/chunky_texture.h>
|
||||
@ -65,7 +68,7 @@ class Png_image
|
||||
png_bytep const data;
|
||||
|
||||
/* read position, maintained by 'read_callback' */
|
||||
unsigned pos = 0;
|
||||
unsigned long pos = 0;
|
||||
|
||||
static void callback(png_structp png_ptr, png_bytep dst, png_size_t len)
|
||||
{
|
||||
|
@ -45,10 +45,10 @@ static void scale(Genode::Texture<PT> const &src, Genode::Texture<PT> &dst,
|
||||
PT const pixel = pixel_line[pixel_offset];
|
||||
unsigned char const alpha = alpha_line[pixel_offset];
|
||||
|
||||
*d++ = pixel.r();
|
||||
*d++ = pixel.g();
|
||||
*d++ = pixel.b();
|
||||
*d++ = alpha;
|
||||
*d++ = (unsigned char)pixel.r();
|
||||
*d++ = (unsigned char)pixel.g();
|
||||
*d++ = (unsigned char)pixel.b();
|
||||
*d++ = (unsigned char)alpha;
|
||||
}
|
||||
|
||||
dst.rgba(row, dst.size().w(), y);
|
||||
@ -83,10 +83,10 @@ static void convert_pixel_format(Genode::Texture<SRC_PT> const &src,
|
||||
unsigned char *d = row;
|
||||
for (unsigned x = 0; x < w; x++, src_pixel++, src_alpha++) {
|
||||
|
||||
*d++ = src_pixel->r();
|
||||
*d++ = src_pixel->g();
|
||||
*d++ = src_pixel->b();
|
||||
*d++ = (*src_alpha * alpha) >> 8;
|
||||
*d++ = (unsigned char)src_pixel->r();
|
||||
*d++ = (unsigned char)src_pixel->g();
|
||||
*d++ = (unsigned char)src_pixel->b();
|
||||
*d++ = (unsigned char)((*src_alpha * alpha) >> 8);
|
||||
}
|
||||
|
||||
/* assign row to destination texture */
|
||||
|
@ -43,7 +43,7 @@ class Genode::Vfs_font : public Text_painter::Font
|
||||
|
||||
float _advance() const
|
||||
{
|
||||
float value = 256.0*_advance_decimal + _advance_fractional;
|
||||
float value = 256.0f*_advance_decimal + _advance_fractional;
|
||||
return value/256;
|
||||
}
|
||||
|
||||
@ -83,7 +83,7 @@ class Genode::Vfs_font : public Text_painter::Font
|
||||
{
|
||||
Allocator &_alloc;
|
||||
|
||||
unsigned const num_bytes;
|
||||
size_t const num_bytes;
|
||||
|
||||
Glyph_header &header;
|
||||
|
||||
|
@ -57,7 +57,7 @@ static inline void Polygon::interpolate_rgba(Polygon::Color start,
|
||||
|
||||
/* combine current color value with existing pixel via alpha blending */
|
||||
*dst = PT::mix(*dst, PT(r>>16, g>>16, b>>16), a>>16);
|
||||
*dst_alpha += ((255 - *dst_alpha)*a) >> (16 + 8);
|
||||
*dst_alpha += (unsigned char)(((255 - *dst_alpha)*a) >> (16 + 8));
|
||||
|
||||
/* increment color-component values by ascent */
|
||||
r += r_ascent;
|
||||
|
@ -43,8 +43,8 @@ struct Line_painter
|
||||
static Fixpoint from_int(long v) { return Fixpoint(v << FRAC_BITS); }
|
||||
static Fixpoint from_raw(long v) { return Fixpoint(v); }
|
||||
|
||||
long integer() const { return value >> FRAC_BITS; }
|
||||
long fractional() const { return value & FRAC_MASK; }
|
||||
int integer() const { return (int)(value >> FRAC_BITS); }
|
||||
int fractional() const { return (int)(value & FRAC_MASK); }
|
||||
};
|
||||
|
||||
/**
|
||||
@ -58,7 +58,7 @@ struct Line_painter
|
||||
{
|
||||
auto fill_segment = [&] (long x1, long y1, long x2, long)
|
||||
{
|
||||
for (long i = x1; i < x2; i++) value[i] = y1;
|
||||
for (long i = x1; i < x2; i++) value[i] = (unsigned char)y1;
|
||||
};
|
||||
|
||||
int const v = 210;
|
||||
|
@ -58,7 +58,7 @@ static inline void Polygon::texturize_rgba(Genode::Point<> start, Genode::Point<
|
||||
int const a = alpha_base[src_offset];
|
||||
|
||||
*dst = texture_base[src_offset];
|
||||
*dst_alpha += ((255 - *dst_alpha)*a) >> 8;
|
||||
*dst_alpha += (unsigned char)(((255 - *dst_alpha)*a) >> 8);
|
||||
|
||||
/* walk through texture */
|
||||
tx += tx_ascent;
|
||||
|
@ -5,3 +5,5 @@ vpath vfs.cc $(REP_DIR)/src/lib/vfs/cbe_crypto/
|
||||
vpath %.cc $(REP_DIR)/src/lib/vfs/cbe_crypto/memcopy
|
||||
|
||||
SHARED_LIB = yes
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
@ -101,8 +101,11 @@ struct Backdrop::Main
|
||||
void flush_surface()
|
||||
{
|
||||
/* blit back to front buffer */
|
||||
blit(surface_ds.local_addr<void>(), surface_num_bytes(),
|
||||
fb_ds.local_addr<void>(), surface_num_bytes(), surface_num_bytes(), 1);
|
||||
blit(surface_ds.local_addr<void>(),
|
||||
(unsigned)surface_num_bytes(),
|
||||
fb_ds.local_addr<void>(),
|
||||
(unsigned)surface_num_bytes(),
|
||||
(unsigned)surface_num_bytes(), 1);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -8,3 +8,5 @@ SRC_CC += vfs_utilities.cc
|
||||
|
||||
INC_DIR := $(PRG_DIR)
|
||||
LIBS += base cbe_cxx cbe_init_cxx cbe_check_cxx cbe_dump_cxx vfs
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
@ -2,3 +2,5 @@ TARGET = cpu_load_display
|
||||
SRC_CC = main.cc
|
||||
LIBS = base
|
||||
INC_DIR += $(PRG_DIR)
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
@ -156,7 +156,7 @@ class Decorator::Config
|
||||
* We always report at least one window control. Even if none
|
||||
* was configured, we present a title.
|
||||
*/
|
||||
return Genode::max(_num_window_controls, 1UL);
|
||||
return Genode::max(_num_window_controls, 1U);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,11 +178,11 @@ class Decorator::Config
|
||||
/**
|
||||
* Return gradient intensity in percent
|
||||
*/
|
||||
int gradient_percent(Window_title const &title) const
|
||||
unsigned gradient_percent(Window_title const &title) const
|
||||
{
|
||||
unsigned long result =
|
||||
_buffered_config->xml().attribute_value("gradient", 32UL);
|
||||
|
||||
unsigned result =
|
||||
_buffered_config->xml().attribute_value("gradient", 32U);
|
||||
|
||||
try {
|
||||
Genode::Session_policy policy(title, _buffered_config->xml());
|
||||
result = policy.attribute_value("gradient", result);
|
||||
|
@ -185,7 +185,7 @@ struct Decorator::Main : Window_factory_base
|
||||
for (;;) {
|
||||
try {
|
||||
return new (_heap)
|
||||
Window(window_node.attribute_value("id", 0UL),
|
||||
Window(window_node.attribute_value("id", 0U),
|
||||
_gui, _animator, _decorator_config);
|
||||
}
|
||||
catch (Genode::Out_of_ram) {
|
||||
|
@ -43,7 +43,7 @@ struct Depot_download_manager::Child_exit_state
|
||||
exists = true;
|
||||
if (child.has_attribute("exited")) {
|
||||
exited = true;
|
||||
code = child.attribute_value("exited", 0L);
|
||||
code = (int)child.attribute_value("exited", 0L);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -466,8 +466,8 @@ void Driver_manager::Main::_handle_pci_devices_update()
|
||||
|
||||
_pci_devices.xml().for_each_sub_node([&] (Xml_node device) {
|
||||
|
||||
uint16_t const vendor_id = device.attribute_value("vendor_id", 0UL);
|
||||
uint16_t const class_code = device.attribute_value("class_code", 0UL) >> 8;
|
||||
uint16_t const vendor_id = (uint16_t)device.attribute_value("vendor_id", 0U);
|
||||
uint16_t const class_code = (uint16_t)(device.attribute_value("class_code", 0U) >> 8);
|
||||
|
||||
enum {
|
||||
VENDOR_VBOX = 0x80EEU,
|
||||
|
@ -52,7 +52,7 @@ class File_vault::Child_exit_state
|
||||
|
||||
if (child.has_attribute("exited")) {
|
||||
_exited = true;
|
||||
_code = child.attribute_value("exited", 0L);
|
||||
_code = (int)child.attribute_value("exited", 0L);
|
||||
}
|
||||
|
||||
_responsive = (child.attribute_value("skipped_heartbeats", 0U) <= 2);
|
||||
|
@ -13,10 +13,13 @@
|
||||
|
||||
/* libC includes */
|
||||
extern "C" {
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
|
||||
}
|
||||
|
||||
int main(int, char **)
|
||||
|
@ -2,3 +2,5 @@ TARGET := gpt_write
|
||||
LIBS := base jitterentropy
|
||||
SRC_CC := main.cc util.cc
|
||||
INC_DIR := $(PRG_DIR)
|
||||
|
||||
CC_CXX_WARN_STRICT_CONVERSION =
|
||||
|
@ -673,7 +673,7 @@ struct Menu_view::Depgraph_widget : Widget
|
||||
y4 = p2.y();
|
||||
|
||||
/* subdivide the curve depending on the size of its bounding box */
|
||||
unsigned const levels = max(log2(max(abs(x4 - x1), abs(y4 - y1)) >> 2), 3);
|
||||
unsigned const levels = (unsigned)max(log2(max(abs(x4 - x1), abs(y4 - y1)) >> 2), 3);
|
||||
|
||||
bezier(x1 << 8, y1 << 8, x2 << 8, y2 << 8,
|
||||
x3 << 8, y3 << 8, x4 << 8, y4 << 8, draw_segment, levels);
|
||||
|
@ -231,8 +231,8 @@ void Menu_view::Main::_handle_dialog_update()
|
||||
|
||||
_position = Decorator::point_attribute(config);
|
||||
|
||||
_configured_size = Area(config.attribute_value("width", 0UL),
|
||||
config.attribute_value("height", 0UL));
|
||||
_configured_size = Area(config.attribute_value("width", 0U),
|
||||
config.attribute_value("height", 0U));
|
||||
} catch (...) { }
|
||||
|
||||
_dialog_rom.update();
|
||||
|
@ -40,7 +40,7 @@ struct Menu_view::Additive_alpha
|
||||
template <typename TPT, typename PT>
|
||||
static void transfer(TPT const &, int src_a, int alpha, PT &dst)
|
||||
{
|
||||
dst.pixel += (alpha*src_a) >> 8;
|
||||
dst.pixel += (uint8_t)((alpha*src_a) >> 8);
|
||||
}
|
||||
|
||||
static Surface_base::Pixel_format format() { return Surface_base::UNKNOWN; }
|
||||
|
@ -60,7 +60,7 @@ class Scene : public Nano3d::Scene<PT>
|
||||
|
||||
int const radius = Nano3d::sqrt(dx*dx + dy*dy);
|
||||
|
||||
alpha[y][x] = 250 - (radius*250)/r_max;
|
||||
alpha[y][x] = (unsigned char)(250 - (radius*250)/r_max);
|
||||
|
||||
if ((x&4) ^ (y&4))
|
||||
alpha[y][x] = 0;
|
||||
|
@ -302,12 +302,12 @@ Dialog::Hover_result Graph::hover(Xml_node hover)
|
||||
if (!dialog.has_type("dialog")) return Rect();
|
||||
|
||||
auto point_from_xml = [] (Xml_node node) {
|
||||
return Point(node.attribute_value("xpos", 0L),
|
||||
node.attribute_value("ypos", 0L)); };
|
||||
return Point((int)node.attribute_value("xpos", 0L),
|
||||
(int)node.attribute_value("ypos", 0L)); };
|
||||
|
||||
auto area_from_xml = [] (Xml_node node) {
|
||||
return Area(node.attribute_value("width", 0UL),
|
||||
node.attribute_value("height", 0UL)); };
|
||||
return Area(node.attribute_value("width", 0U),
|
||||
node.attribute_value("height", 0U)); };
|
||||
|
||||
if (!dialog.has_sub_node("depgraph")) return Rect();
|
||||
Xml_node const depgraph = dialog.sub_node("depgraph");
|
||||
|
@ -107,7 +107,7 @@ struct Sculpt::Main : Input_event_handler,
|
||||
dir.for_each_sub_node("dir", [&] (Xml_node type) {
|
||||
if (type.attribute_value("name", String<16>()) == "text") {
|
||||
type.for_each_sub_node("ttf", [&] (Xml_node ttf) {
|
||||
float const px = ttf.attribute_value("size_px", 0.0);
|
||||
double const px = ttf.attribute_value("size_px", 0.0);
|
||||
if (px > 0.0)
|
||||
_font_size_px = px; }); } }); } }); });
|
||||
|
||||
@ -380,7 +380,7 @@ struct Sculpt::Main : Input_event_handler,
|
||||
|
||||
Settings _settings { };
|
||||
|
||||
float _font_size_px = 14;
|
||||
double _font_size_px = 14;
|
||||
|
||||
Area _screen_size { };
|
||||
|
||||
@ -1169,10 +1169,10 @@ void Sculpt::Main::_handle_window_layout()
|
||||
|
||||
Xml_node const floating = node.sub_node("floating");
|
||||
|
||||
top = floating.attribute_value("top", 0UL);
|
||||
bottom = floating.attribute_value("bottom", 0UL);
|
||||
left = floating.attribute_value("left", 0UL);
|
||||
right = floating.attribute_value("right", 0UL);
|
||||
top = floating.attribute_value("top", 0U);
|
||||
bottom = floating.attribute_value("bottom", 0U);
|
||||
left = floating.attribute_value("left", 0U);
|
||||
right = floating.attribute_value("right", 0U);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1199,8 +1199,8 @@ void Sculpt::Main::_handle_window_layout()
|
||||
Xml_node const window_list = _window_list.xml();
|
||||
|
||||
auto win_size = [&] (Xml_node win) {
|
||||
return Area(win.attribute_value("width", 0UL),
|
||||
win.attribute_value("height", 0UL)); };
|
||||
return Area(win.attribute_value("width", 0U),
|
||||
win.attribute_value("height", 0U)); };
|
||||
|
||||
unsigned panel_height = 0;
|
||||
_with_window(window_list, panel_view_label, [&] (Xml_node win) {
|
||||
@ -1393,7 +1393,7 @@ void Sculpt::Main::_handle_gui_mode()
|
||||
|
||||
if (!_settings.manual_fonts_config) {
|
||||
|
||||
_font_size_px = (float)mode.area.h() / 60.0;
|
||||
_font_size_px = (double)mode.area.h() / 60.0;
|
||||
|
||||
/*
|
||||
* Limit lower bound of font size. Otherwise, the glyph rendering
|
||||
@ -1413,7 +1413,7 @@ void Sculpt::Main::_handle_gui_mode()
|
||||
gen_named_node(xml, "dir", "fonts", [&] () {
|
||||
|
||||
auto gen_ttf_dir = [&] (char const *dir_name,
|
||||
char const *ttf_path, float size_px) {
|
||||
char const *ttf_path, double size_px) {
|
||||
|
||||
gen_named_node(xml, "dir", dir_name, [&] () {
|
||||
gen_named_node(xml, "ttf", "regular", [&] () {
|
||||
@ -1450,7 +1450,7 @@ void Sculpt::Main::_handle_gui_mode()
|
||||
|
||||
_screen_size = mode.area;
|
||||
_panel_menu_view.min_width = _screen_size.w();
|
||||
unsigned const menu_width = max(_font_size_px*21, 320.0);
|
||||
unsigned const menu_width = max((unsigned)(_font_size_px*21.0), 320u);
|
||||
_main_menu_view.min_width = menu_width;
|
||||
_network.min_dialog_width(menu_width);
|
||||
|
||||
|
@ -71,7 +71,7 @@ struct Sculpt::Access_point_update_policy : List_model<Access_point>::Update_pol
|
||||
|
||||
void update_element(Access_point &ap, Xml_node node)
|
||||
{
|
||||
ap.quality = node.attribute_value("quality", 0UL);
|
||||
ap.quality = node.attribute_value("quality", 0U);
|
||||
}
|
||||
|
||||
static bool element_matches_xml_node(Access_point const &elem, Xml_node node)
|
||||
|
@ -43,7 +43,7 @@ struct Sculpt::Child_exit_state
|
||||
|
||||
if (child.has_attribute("exited")) {
|
||||
exited = true;
|
||||
code = child.attribute_value("exited", 0L);
|
||||
code = (int)child.attribute_value("exited", 0L);
|
||||
}
|
||||
|
||||
responsive = (child.attribute_value("skipped_heartbeats", 0U) <= 2);
|
||||
|
@ -108,7 +108,7 @@ struct Sculpt::Partition : List_model<Partition>::Element
|
||||
Number const number = node.attribute_value("number", Number());
|
||||
|
||||
unsigned long const block_size =
|
||||
node.attribute_value("block_size", 512ULL);
|
||||
node.attribute_value("block_size", 512UL);
|
||||
|
||||
unsigned long long const expandable =
|
||||
node.attribute_value("expandable", 0ULL);
|
||||
|
@ -51,7 +51,7 @@ namespace Sculpt {
|
||||
void gen_launcher_query_start_content(Xml_generator &);
|
||||
|
||||
void gen_runtime_view_start_content(Xml_generator &, Child_state const &,
|
||||
float font_size);
|
||||
double font_size);
|
||||
|
||||
struct Inspect_view_version { unsigned value; };
|
||||
void gen_inspect_view(Xml_generator &, Storage_devices const &,
|
||||
|
@ -20,7 +20,7 @@
|
||||
|
||||
void Sculpt::gen_runtime_view_start_content(Xml_generator &xml,
|
||||
Child_state const &state,
|
||||
float font_size)
|
||||
double font_size)
|
||||
{
|
||||
state.gen_start_node_content(xml);
|
||||
|
||||
|
@ -42,9 +42,9 @@ void Sculpt::gen_download_status(Xml_generator &xml, Xml_node state)
|
||||
|
||||
typedef String<16> Info;
|
||||
|
||||
Info info = archive.attribute_value("state", Info());
|
||||
float const total = archive.attribute_value("total", 0.0);
|
||||
float const now = archive.attribute_value("now", 0.0);
|
||||
Info info = archive.attribute_value("state", Info());
|
||||
double const total = archive.attribute_value("total", 0.0d);
|
||||
double const now = archive.attribute_value("now", 0.0d);
|
||||
|
||||
if (info == "download") {
|
||||
if (total > 0.0)
|
||||
|
@ -41,7 +41,7 @@ struct Text_area::Dynamic_array
|
||||
|
||||
Element *_array = nullptr;
|
||||
|
||||
unsigned _capacity = 0;
|
||||
size_t _capacity = 0;
|
||||
unsigned _upper_bound = 0; /* index after last used element */
|
||||
|
||||
bool _index_valid(Index at) const
|
||||
|
@ -173,7 +173,7 @@ struct Decorator::Main : Window_factory_base
|
||||
for (;;) {
|
||||
try {
|
||||
return new (_heap)
|
||||
Window(_env, window_node.attribute_value("id", 0UL),
|
||||
Window(_env, window_node.attribute_value("id", 0U),
|
||||
_gui, _animator, _theme, _decorator_config);
|
||||
}
|
||||
catch (Out_of_ram) {
|
||||
|
@ -124,10 +124,10 @@ struct Margins_from_metadata : Decorator::Theme::Margins
|
||||
Decorator::Theme::Margins()
|
||||
{
|
||||
Genode::Xml_node aura = metadata(alloc).sub_node(sub_node);
|
||||
top = aura.attribute_value("top", 0UL);
|
||||
bottom = aura.attribute_value("bottom", 0UL);
|
||||
left = aura.attribute_value("left", 0UL);
|
||||
right = aura.attribute_value("right", 0UL);
|
||||
top = aura.attribute_value("top", 0U);
|
||||
bottom = aura.attribute_value("bottom", 0U);
|
||||
left = aura.attribute_value("left", 0U);
|
||||
right = aura.attribute_value("right", 0U);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -48,7 +48,7 @@ class Vfs_replay
|
||||
|
||||
Xml_node _replay_node;
|
||||
Xml_node _request_node { "<empty/>" };
|
||||
unsigned _num_requests { 0 };
|
||||
size_t _num_requests { 0 };
|
||||
unsigned _curr_request_id { 0 };
|
||||
|
||||
bool _finished { false };
|
||||
|
@ -134,7 +134,7 @@ class Window_layouter::Assign : public List_model<Assign>::Element
|
||||
|
||||
bool suffix_matches = false;
|
||||
if (label.length() >= _label_suffix.length()) {
|
||||
unsigned const offset = label.length() - _label_suffix.length();
|
||||
unsigned const offset = (unsigned)(label.length() - _label_suffix.length());
|
||||
suffix_matches = !strcmp(_label.string() + offset, _label_suffix.string());
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,10 @@ struct Window_layouter::Decorator_margins
|
||||
|
||||
Decorator_margins(Xml_node node)
|
||||
:
|
||||
top (node.attribute_value("top", 0UL)),
|
||||
bottom(node.attribute_value("bottom", 0UL)),
|
||||
left (node.attribute_value("left", 0UL)),
|
||||
right (node.attribute_value("right", 0UL))
|
||||
top (node.attribute_value("top", 0U)),
|
||||
bottom(node.attribute_value("bottom", 0U)),
|
||||
left (node.attribute_value("left", 0U)),
|
||||
right (node.attribute_value("right", 0U))
|
||||
{ }
|
||||
|
||||
/**
|
||||
|
@ -594,7 +594,7 @@ void Window_layouter::Main::_handle_hover()
|
||||
try {
|
||||
Xml_node const hover_window_xml = _hover.xml().sub_node("window");
|
||||
|
||||
_user_state.hover(hover_window_xml.attribute_value("id", 0UL),
|
||||
_user_state.hover(hover_window_xml.attribute_value("id", 0U),
|
||||
_element_from_hover_model(hover_window_xml));
|
||||
}
|
||||
|
||||
@ -632,7 +632,7 @@ void Window_layouter::Main::_handle_focus_request()
|
||||
{
|
||||
_focus_request.update();
|
||||
|
||||
int const id = _focus_request.xml().attribute_value("id", 0L);
|
||||
int const id = (int)_focus_request.xml().attribute_value("id", 0L);
|
||||
|
||||
/* don't apply the same focus request twice */
|
||||
if (id == _handled_focus_request_id)
|
||||
|
@ -40,7 +40,7 @@ class Window_layouter::Target : Noncopyable
|
||||
Target(Xml_node target, Rect geometry, Visible visible)
|
||||
:
|
||||
_name (target.attribute_value("name", Name())),
|
||||
_layer(target.attribute_value("layer", 9999UL)),
|
||||
_layer(target.attribute_value("layer", 9999U)),
|
||||
_geometry(geometry),
|
||||
_visible(visible == Visible::YES)
|
||||
{ }
|
||||
|
@ -42,22 +42,22 @@ class Window_layouter::Target_list
|
||||
void _process_rec(Xml_node node, Rect avail, bool row,
|
||||
Target::Visible visible)
|
||||
{
|
||||
unsigned long const avail_px = row ? avail.w() : avail.h();
|
||||
unsigned const avail_px = row ? avail.w() : avail.h();
|
||||
|
||||
char const *sub_node_type = row ? "column" : "row";
|
||||
char const *px_size_attr = row ? "width" : "height";
|
||||
|
||||
unsigned long px_pos = row ? avail.x1() : avail.y1();
|
||||
unsigned px_pos = row ? avail.x1() : avail.y1();
|
||||
|
||||
unsigned long const default_weight = 1;
|
||||
unsigned const default_weight = 1;
|
||||
|
||||
/*
|
||||
* Determinine space reserved in pixels, the total weight, and
|
||||
* number of weighted rows/columns.
|
||||
*/
|
||||
unsigned long preserved_pixels = 0;
|
||||
unsigned long total_weight = 0;
|
||||
unsigned long num_weighted = 0;
|
||||
unsigned preserved_pixels = 0;
|
||||
unsigned total_weight = 0;
|
||||
unsigned num_weighted = 0;
|
||||
|
||||
/* ignore weight if pixel size is provided */
|
||||
auto weight_attr_value = [&] (Xml_node node) {
|
||||
@ -65,7 +65,7 @@ class Window_layouter::Target_list
|
||||
? 0 : node.attribute_value("weight", default_weight); };
|
||||
|
||||
node.for_each_sub_node(sub_node_type, [&] (Xml_node child) {
|
||||
preserved_pixels += child.attribute_value(px_size_attr, 0UL);
|
||||
preserved_pixels += child.attribute_value(px_size_attr, 0U);
|
||||
total_weight += weight_attr_value(child);
|
||||
num_weighted += child.has_attribute(px_size_attr) ? 0 : 1;
|
||||
});
|
||||
@ -76,26 +76,26 @@ class Window_layouter::Target_list
|
||||
}
|
||||
|
||||
/* amount of pixels we can use for weighed columns */
|
||||
unsigned long const weigthed_avail = avail_px - preserved_pixels;
|
||||
unsigned const weigthed_avail = avail_px - preserved_pixels;
|
||||
|
||||
/*
|
||||
* Calculate positions
|
||||
*/
|
||||
unsigned long count_weighted = 0;
|
||||
unsigned long used_weighted = 0;
|
||||
unsigned count_weighted = 0;
|
||||
unsigned used_weighted = 0;
|
||||
node.for_each_sub_node(sub_node_type, [&] (Xml_node child) {
|
||||
|
||||
auto calc_px_size = [&] () {
|
||||
|
||||
unsigned long const px = child.attribute_value(px_size_attr, 0UL);
|
||||
unsigned const px = child.attribute_value(px_size_attr, 0U);
|
||||
if (px)
|
||||
return px;
|
||||
|
||||
unsigned long const weight = weight_attr_value(child);
|
||||
unsigned const weight = weight_attr_value(child);
|
||||
if (weight && total_weight)
|
||||
return (((weight << 16)*weigthed_avail)/total_weight) >> 16;
|
||||
|
||||
return 0UL;
|
||||
return 0U;
|
||||
};
|
||||
|
||||
bool const weighted = !child.has_attribute(px_size_attr);
|
||||
@ -107,9 +107,9 @@ class Window_layouter::Target_list
|
||||
bool const last_weighted = weighted
|
||||
&& (count_weighted == num_weighted);
|
||||
|
||||
unsigned long const px_size = last_weighted
|
||||
? (weigthed_avail - used_weighted)
|
||||
: calc_px_size();
|
||||
unsigned const px_size = last_weighted
|
||||
? (weigthed_avail - used_weighted)
|
||||
: calc_px_size();
|
||||
|
||||
if (weighted)
|
||||
used_weighted += px_size;
|
||||
|
@ -71,8 +71,8 @@ class Window_layouter::Window_list
|
||||
|
||||
Window &create_element(Xml_node node)
|
||||
{
|
||||
unsigned long const id = node.attribute_value("id", 0UL);
|
||||
Area const initial_size = area_attribute(node);
|
||||
unsigned const id = node.attribute_value("id", 0U);
|
||||
Area const initial_size = area_attribute(node);
|
||||
|
||||
Window::Label const label =
|
||||
node.attribute_value("label",Window::Label());
|
||||
@ -94,7 +94,7 @@ class Window_layouter::Window_list
|
||||
|
||||
static bool element_matches_xml_node(Window const &elem, Xml_node node)
|
||||
{
|
||||
return elem.has_id(node.attribute_value("id", 0UL));
|
||||
return elem.has_id(node.attribute_value("id", 0U));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -26,6 +26,9 @@
|
||||
* STB TrueType library
|
||||
*/
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
|
||||
static void *local_malloc(Genode::size_t, void *);
|
||||
static void local_free(void *, void *);
|
||||
#define STBTT_malloc local_malloc
|
||||
@ -38,6 +41,8 @@ static void local_free(void *, void *);
|
||||
#define STB_TRUETYPE_IMPLEMENTATION
|
||||
#include "stb_truetype.h"
|
||||
|
||||
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
|
||||
|
||||
static void *STBTT_malloc(size_t size, void *userdata)
|
||||
{
|
||||
return ((Genode::Allocator *)userdata)->alloc(size);
|
||||
@ -83,7 +88,7 @@ struct Ttf_font::Glyph_buffer
|
||||
{
|
||||
auto fill_segment = [&] (long x1, long y1, long x2, long) {
|
||||
for (long i = x1>>8; i < x2>>8; i++)
|
||||
value[i] = Genode::min(255, y1>>8); };
|
||||
value[i] = (unsigned char)Genode::min(255l, y1>>8); };
|
||||
|
||||
bezier(0, 0, 0, 130<<8, 256<<8, 260<<8, fill_segment, 7);
|
||||
value[0] = 0;
|
||||
@ -198,7 +203,7 @@ Ttf_font::Glyph_buffer::render_shifted(Codepoint const c,
|
||||
return Glyph { .width = width,
|
||||
.height = height,
|
||||
.vpos = (unsigned)((int)baseline + y0),
|
||||
.advance = scale*advance,
|
||||
.advance = scale * (float)advance,
|
||||
.values = _values + _headroom };
|
||||
}
|
||||
|
||||
@ -214,13 +219,14 @@ static Text_painter::Area obtain_bounding_box(stbtt_fontinfo const &font, float
|
||||
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
|
||||
stbtt_GetFontBoundingBox(&font, &x0, &y0, &x1, &y1);
|
||||
|
||||
int const w = x1 - x0 + 1,
|
||||
h = y1 - y0 + 1;
|
||||
float const w = (float)(x1 - x0 + 1),
|
||||
h = (float)(y1 - y0 + 1);
|
||||
|
||||
if (w < 1 || h < 1)
|
||||
throw Ttf_font::Unsupported_data();
|
||||
|
||||
return Text_painter::Area(w*scale + 2*PAD_X, h*scale + 2*PAD_Y);
|
||||
return Text_painter::Area((unsigned)(w*scale) + 2*PAD_X,
|
||||
(unsigned)(h*scale) + 2*PAD_Y);
|
||||
}
|
||||
|
||||
|
||||
@ -229,7 +235,7 @@ static unsigned obtain_baseline(stbtt_fontinfo const &font, float scale)
|
||||
int ascent = 0;
|
||||
stbtt_GetFontVMetrics(&font, &ascent, 0, 0);
|
||||
|
||||
return (unsigned)(ascent*scale);
|
||||
return (unsigned)((float)ascent*scale);
|
||||
}
|
||||
|
||||
|
||||
@ -253,7 +259,7 @@ Ttf_font::Ttf_font(Allocator &alloc, void const *ttf, float px)
|
||||
_px(px),
|
||||
_scale(stbtt_ScaleForPixelHeight(&_stbtt_font_info, px)),
|
||||
_baseline(obtain_baseline(_stbtt_font_info, _scale)),
|
||||
_height(px + 0.5 /* round to integer */),
|
||||
_height((unsigned)(px + 0.5)),
|
||||
_bounding_box(obtain_bounding_box(_stbtt_font_info, _scale)),
|
||||
_glyph_buffer(*new (alloc) Glyph_buffer(alloc, _bounding_box))
|
||||
{ }
|
||||
@ -284,7 +290,7 @@ void Ttf_font::_apply_glyph(Codepoint c, Apply_fn const &fn) const
|
||||
float best_shift_y = 0;
|
||||
{
|
||||
unsigned sharpest = 0;
|
||||
for (float shift_y = -0.3; shift_y < 0.3; shift_y += 0.066) {
|
||||
for (float shift_y = -0.3f; shift_y < 0.3f; shift_y += 0.066f) {
|
||||
|
||||
Glyph const glyph =
|
||||
_glyph_buffer.render_shifted(c, _stbtt_font_info, _scale,
|
||||
@ -311,7 +317,9 @@ Text_painter::Font::Advance_info Ttf_font::advance_info(Codepoint c) const
|
||||
int advance = 0, lsb = 0;
|
||||
stbtt_GetCodepointHMetrics(&_stbtt_font_info, c.value, &advance, &lsb);
|
||||
|
||||
return Font::Advance_info { .width = (unsigned)(_scale*advance),
|
||||
.advance = _scale*advance };
|
||||
float const scaled_advance = _scale * (float)advance;
|
||||
|
||||
return Font::Advance_info { .width = (unsigned)scaled_advance,
|
||||
.advance = scaled_advance };
|
||||
}
|
||||
|
||||
|
@ -529,7 +529,7 @@ class Vfs_cbe_crypto::Keys_file_system : public Vfs::File_system
|
||||
}
|
||||
|
||||
try {
|
||||
Key_file_system const &fs = _key_reg.by_index(index);
|
||||
Key_file_system const &fs = _key_reg.by_index((unsigned)index);
|
||||
Genode::String<32> name { fs.key_id() };
|
||||
|
||||
out = {
|
||||
|
@ -60,7 +60,7 @@ void Aes_256::encrypt_with_zeroed_iv(unsigned char *ciphertext_base,
|
||||
size_t key_size)
|
||||
{
|
||||
Openssl::AES_KEY aes_key;
|
||||
if (AES_set_encrypt_key(key_base, key_size * 8, &aes_key)) {
|
||||
if (AES_set_encrypt_key(key_base, (int)(key_size * 8), &aes_key)) {
|
||||
class Failed_to_set_key { };
|
||||
throw Failed_to_set_key { };
|
||||
}
|
||||
@ -82,7 +82,7 @@ void Aes_256::decrypt_with_zeroed_iv(unsigned char *plaintext_base,
|
||||
size_t key_size)
|
||||
{
|
||||
Openssl::AES_KEY aes_key;
|
||||
if (AES_set_decrypt_key(key_base, key_size * 8, &aes_key)) {
|
||||
if (AES_set_decrypt_key(key_base, (int)(key_size * 8), &aes_key)) {
|
||||
class Failed_to_set_key { };
|
||||
throw Failed_to_set_key { };
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ class Vfs_trace::Trace_buffer_file_system : public Single_file_system
|
||||
out_count = 0;
|
||||
_entries.for_each_new_entry([&](Trace::Buffer::Entry entry) {
|
||||
file_size size = min(count - out_count, entry.length());
|
||||
memcpy(dst + out_count, entry.data(), size);
|
||||
memcpy(dst + out_count, entry.data(), (size_t)size);
|
||||
out_count += size;
|
||||
|
||||
if (out_count == count)
|
||||
@ -351,7 +351,7 @@ struct Vfs_trace::Local_factory : File_system_factory
|
||||
Trace::Connection _trace;
|
||||
enum { MAX_SUBJECTS = 128 };
|
||||
Trace::Subject_id _subjects[MAX_SUBJECTS];
|
||||
unsigned _subject_count { 0 };
|
||||
size_t _subject_count { 0 };
|
||||
Trace::Policy_id _policy_id { 0 };
|
||||
|
||||
Directory_tree _tree { _env.alloc() };
|
||||
@ -402,7 +402,7 @@ struct Vfs_trace::Local_factory : File_system_factory
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < _subject_count; i++) {
|
||||
for (size_t i = 0; i < _subject_count; i++) {
|
||||
_tree.insert(_trace.subject_info(_subjects[i]), _subjects[i]);
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class Vfs::Glyphs_file_system : public Vfs::Single_file_system
|
||||
Glyph_header const header(glyph);
|
||||
|
||||
char const * const src = (char const *)&header + byte_offset;
|
||||
size_t const len = min(sizeof(header) - byte_offset, count);
|
||||
size_t const len = min(sizeof(header) - (size_t)byte_offset, (size_t)count);
|
||||
memcpy(dst, src, len);
|
||||
|
||||
dst += len;
|
||||
@ -87,12 +87,12 @@ class Vfs::Glyphs_file_system : public Vfs::Single_file_system
|
||||
* continue working with 'alpha_offset', which is the first
|
||||
* offset of interest within the array of alpha values.
|
||||
*/
|
||||
size_t const alpha_offset = byte_offset - sizeof(Glyph_header);
|
||||
size_t const alpha_offset = (size_t)byte_offset - sizeof(Glyph_header);
|
||||
size_t const alpha_values_len = 4*glyph.width*glyph.height;
|
||||
|
||||
if (alpha_offset < alpha_values_len) {
|
||||
char const * const src = (char const *)glyph.values + alpha_offset;
|
||||
size_t const len = min(alpha_values_len - alpha_offset, count);
|
||||
size_t const len = min(alpha_values_len - alpha_offset, (size_t)count);
|
||||
memcpy(dst, src, len);
|
||||
out_count += len;
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ struct Vfs_ttf::Local_factory : File_system_factory, Watch_response_handler
|
||||
Font_config(Xml_node const &config)
|
||||
:
|
||||
path(config.attribute_value("path", Directory::Path())),
|
||||
size(config.attribute_value("size_px", 16.0)),
|
||||
size((float)config.attribute_value("size_px", 16.0d)),
|
||||
cache_limit({config.attribute_value("cache", Number_of_bytes())})
|
||||
{ }
|
||||
} _font_config;
|
||||
|
@ -22,11 +22,14 @@
|
||||
#include <terminal_session/terminal_session.h>
|
||||
|
||||
/* libc includes */
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wconversion"
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/select.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#pragma GCC diagnostic pop /* restore -Wconversion warnings */
|
||||
|
||||
|
||||
class Open_file
|
||||
|
@ -49,9 +49,11 @@ struct Alpha_dither_painter
|
||||
|
||||
for (dst = dst_line, w = clipped.w(); w--; dst++, x++) {
|
||||
|
||||
int const v = Genode::Dither_matrix::value(x, y) << 13;
|
||||
using namespace Genode;
|
||||
|
||||
dst->pixel = Genode::min(255, Genode::max(0, (fade - v) >> 16));
|
||||
int const v = Dither_matrix::value(x, y) << 13;
|
||||
|
||||
dst->pixel = (uint8_t)min(255, max(0, (fade - v) >> 16));
|
||||
}
|
||||
|
||||
y++;
|
||||
@ -88,15 +90,17 @@ struct Alpha_dither_painter
|
||||
|
||||
for (dst = dst_line, src = src_line, w = clipped.w(); w--; dst++, src++, x++) {
|
||||
|
||||
using namespace Genode;
|
||||
|
||||
/*
|
||||
* Multiply texture alpha value with fade value, dither the
|
||||
* result.
|
||||
*/
|
||||
|
||||
int const a = (((int)src->pixel)*fade);
|
||||
int const v = Genode::Dither_matrix::value(x, y) << 13;
|
||||
int const v = Dither_matrix::value(x, y) << 13;
|
||||
|
||||
dst->pixel = Genode::min(255, Genode::max(0, (a - v) >> 16));
|
||||
dst->pixel = (uint8_t)min(255, max(0, (a - v) >> 16));
|
||||
}
|
||||
|
||||
y++;
|
||||
|
@ -441,14 +441,14 @@ struct Gui_fader::Main
|
||||
|
||||
enum { PERIOD = 20 };
|
||||
|
||||
unsigned long alpha = 0;
|
||||
unsigned alpha = 0;
|
||||
|
||||
unsigned long fade_in_steps = 0;
|
||||
unsigned long fade_out_steps = 0;
|
||||
unsigned fade_in_steps = 0;
|
||||
unsigned fade_out_steps = 0;
|
||||
|
||||
bool initial_fade_in = true;
|
||||
|
||||
unsigned long initial_fade_in_steps = 0;
|
||||
unsigned initial_fade_in_steps = 0;
|
||||
|
||||
Genode::uint64_t curr_frame() const { return timer.elapsed_ms() / PERIOD; }
|
||||
|
||||
@ -471,7 +471,7 @@ struct Gui_fader::Main
|
||||
void handle_timer()
|
||||
{
|
||||
Genode::uint64_t frame = curr_frame();
|
||||
if (gui_session.animate(frame - last_frame))
|
||||
if (gui_session.animate((unsigned)(frame - last_frame)))
|
||||
timer.trigger_once(PERIOD);
|
||||
|
||||
last_frame = frame;
|
||||
@ -502,7 +502,7 @@ void Gui_fader::Main::handle_config_update()
|
||||
|
||||
Genode::Xml_node config_xml = config.xml();
|
||||
|
||||
unsigned long new_alpha = alpha;
|
||||
unsigned new_alpha = alpha;
|
||||
if (config_xml.has_attribute("alpha"))
|
||||
config_xml.attribute("alpha").value(new_alpha);
|
||||
|
||||
@ -515,7 +515,7 @@ void Gui_fader::Main::handle_config_update()
|
||||
|
||||
bool const fade_in = (new_alpha > alpha);
|
||||
|
||||
int const steps =
|
||||
unsigned const steps =
|
||||
fade_in ? (initial_fade_in ? initial_fade_in_steps : fade_in_steps)
|
||||
: fade_out_steps;
|
||||
|
||||
|
@ -100,9 +100,9 @@ class Terminal::Session_component : public Rpc_object<Session, Session_component
|
||||
{
|
||||
char const *src = _io_buffer.local_addr<char const>();
|
||||
|
||||
unsigned const max = min(num_bytes, _io_buffer.size());
|
||||
size_t const max = min(num_bytes, _io_buffer.size());
|
||||
|
||||
unsigned i = 0;
|
||||
size_t i = 0;
|
||||
for (Utf8_ptr utf8(src); utf8.complete() && i < max; ) {
|
||||
|
||||
_character_consumer.consume_character(
|
||||
@ -121,7 +121,7 @@ class Terminal::Session_component : public Rpc_object<Session, Session_component
|
||||
/* we don't support UTF-8 sequences split into multiple writes */
|
||||
if (i != num_bytes) {
|
||||
warning("truncated UTF-8 sequence");
|
||||
for (unsigned j = i; j < num_bytes; j++)
|
||||
for (size_t j = i; j < num_bytes; j++)
|
||||
warning("(unhandled value ", Hex(src[j]), ")");
|
||||
}
|
||||
|
||||
|
@ -232,7 +232,7 @@ struct Wm::Decorator_gui_session : Genode::Rpc_object<Gui::Session>,
|
||||
|
||||
case Command::OP_TITLE:
|
||||
{
|
||||
unsigned long id = 0;
|
||||
unsigned id = 0;
|
||||
Genode::ascii_to(cmd.title.title.string(), id);
|
||||
|
||||
if (id > 0)
|
||||
|
@ -73,7 +73,7 @@ struct Wm::Main : Pointer::Tracker
|
||||
if (!focus_rom.valid())
|
||||
return;
|
||||
|
||||
unsigned long win_id = 0;
|
||||
unsigned win_id = 0;
|
||||
|
||||
Xml_node(focus_rom.local_addr<char>()).sub_node("window")
|
||||
.attribute("id").value(win_id);
|
||||
@ -97,10 +97,10 @@ struct Wm::Main : Pointer::Tracker
|
||||
|
||||
resize_request_rom.xml().for_each_sub_node("window", [&] (Xml_node window) {
|
||||
|
||||
unsigned long const
|
||||
win_id = window.attribute_value("id", 0UL),
|
||||
width = window.attribute_value("width", 0UL),
|
||||
height = window.attribute_value("height", 0UL);
|
||||
unsigned const
|
||||
win_id = window.attribute_value("id", 0U),
|
||||
width = window.attribute_value("width", 0U),
|
||||
height = window.attribute_value("height", 0U);
|
||||
|
||||
gui_root.request_resize(win_id, Area(width, height));
|
||||
});
|
||||
|
@ -213,7 +213,7 @@ class Wm::Window_registry
|
||||
|
||||
Id create()
|
||||
{
|
||||
Window * const win = new (_alloc) Window(_window_ids.alloc());
|
||||
Window * const win = new (_alloc) Window((unsigned)_window_ids.alloc());
|
||||
|
||||
_windows.insert(win);
|
||||
|
||||
|
@ -26,23 +26,22 @@ void Component::construct(Genode::Env &env)
|
||||
|
||||
log("--- magic ring buffer test, ", ring_buffer.capacity(), " int ring ---");
|
||||
|
||||
size_t const count = ring_buffer.capacity()/3;
|
||||
|
||||
int const count = ring_buffer.capacity()/3;
|
||||
size_t total = 0;
|
||||
|
||||
int total = 0;
|
||||
|
||||
for (int j = 0; j < 99; ++j) {
|
||||
for (int i = 0; i < count; ++i) {
|
||||
ring_buffer.write_addr()[i] = i;
|
||||
for (size_t j = 0; j < 99; ++j) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
ring_buffer.write_addr()[i] = (int)i;
|
||||
}
|
||||
|
||||
ring_buffer.fill(count);
|
||||
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (ring_buffer.read_addr()[i] != i) {
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
if (ring_buffer.read_addr()[i] != (int)i) {
|
||||
error("ring buffer corruption, ",
|
||||
ring_buffer.read_addr()[i], " != ", i);
|
||||
env.parent().exit(total+i);
|
||||
env.parent().exit((int)(total + i));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -111,8 +111,9 @@ struct Test::Main
|
||||
/* test horizontal subpixel positioning */
|
||||
_surface.clip(Rect(Point(90, 15), Area(100, 300)));
|
||||
Box_painter::paint(_surface, Rect(Point(0, 0), _size), Color(150, 20, 10));
|
||||
float const font_3_h = (float)_font_3.bounding_box().h();
|
||||
|
||||
for (float x = 90, y = -30; y < (int)_size.h() + 30; x += 0.2, y += _font_3.bounding_box().h())
|
||||
for (float x = 90, y = -30; y < (float)_size.h() + 30; x += 0.2f, y += font_3_h)
|
||||
Text_painter::paint(_surface,
|
||||
Text_painter::Position(x, y), _font_3,
|
||||
Color(255, 255, 255),
|
||||
@ -121,7 +122,7 @@ struct Test::Main
|
||||
_surface.clip(Rect(Point(90, 320), Area(100, 300)));
|
||||
Box_painter::paint(_surface, Rect(Point(0, 0), _size), Color(255, 255, 255));
|
||||
|
||||
for (float x = 90, y = 300; y < (int)_size.h() + 30; x += 0.2, y += _font_3.bounding_box().h())
|
||||
for (float x = 90, y = 300; y < (float)_size.h() + 30; x += 0.2f, y += font_3_h)
|
||||
Text_painter::paint(_surface,
|
||||
Text_painter::Position(x, y), _font_3,
|
||||
Color(0, 0, 0),
|
||||
@ -136,7 +137,8 @@ struct Test::Main
|
||||
{
|
||||
auto fill_segment = [&] (long x1, long y1, long x2, long)
|
||||
{
|
||||
for (long i = x1>>8; i < x2>>8; i++) value[i] = min(255, y1>>8);
|
||||
for (long i = x1>>8; i < x2>>8; i++)
|
||||
value[i] = (unsigned char)min(255L, y1>>8);
|
||||
};
|
||||
|
||||
bezier(0, 0, 0, 130<<8, 256<<8, 260<<8, fill_segment, 7);
|
||||
@ -170,7 +172,7 @@ struct Test::Main
|
||||
Genode::uint64_t const end_us = timer.elapsed_us();
|
||||
unsigned long num_glyphs = strlen(vfs_text_string)*ITERATIONS;
|
||||
|
||||
log("uncached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph");
|
||||
log("uncached painting: ", (float)(end_us - start_us)/(float)num_glyphs, " us/glyph");
|
||||
_refresh();
|
||||
}
|
||||
|
||||
@ -188,13 +190,13 @@ struct Test::Main
|
||||
Text_painter::paint(_surface,
|
||||
Text_painter::Position(260 + (i*83 % 500),
|
||||
320 + (i*153 % 400)),
|
||||
cached_font, Color(30, limit_kib, 150 + i*73),
|
||||
cached_font, Color(30, (int)limit_kib, 150 + i*73),
|
||||
"Glyphs obtained from VFS");
|
||||
|
||||
Genode::uint64_t const end_us = timer.elapsed_us();
|
||||
unsigned long num_glyphs = strlen(vfs_text_string)*iterations;
|
||||
|
||||
log("cached painting: ", (float)(end_us - start_us)/num_glyphs, " us/glyph"
|
||||
log("cached painting: ", (float)(end_us - start_us)/(float)num_glyphs, " us/glyph"
|
||||
" (", cached_font.stats(), ")");
|
||||
_refresh();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user