diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2019-02-03 13:08:57 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-02-03 13:08:57 +0100 |
commit | 930713cf44bcae9a91f92a1582f329643d38abfd (patch) | |
tree | a02b43454a26174c905ef1e2035685eb7b6428e1 | |
parent | 4ff884bd2510326dafb5adb97e69797d006b0e14 (diff) | |
download | fbida-930713cf44bcae9a91f92a1582f329643d38abfd.tar.gz |
add gfxfmt, fixes
-rw-r--r-- | fbi.c | 8 | ||||
-rw-r--r-- | gfx.h | 25 | ||||
-rw-r--r-- | meson.build | 6 | ||||
-rw-r--r-- | readers.c | 10 |
4 files changed, 36 insertions, 13 deletions
@@ -46,14 +46,6 @@ #include "transupp.h" /* Support routines for jpegtran */ #include "jpegtools.h" -#define TRUE 1 -#define FALSE 0 -#undef MAX -#define MAX(x,y) ((x)>(y)?(x):(y)) -#undef MIN -#define MIN(x,y) ((x)<(y)?(x):(y)) -#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) - /* ---------------------------------------------------------------------- */ /* variables for read_image */ @@ -1,8 +1,33 @@ #include <stdbool.h> #include <inttypes.h> +#include <pixman.h> +#include <cairo.h> + +/* ---------------------------------------------------------------------- */ + +#undef MAX +#define MAX(x,y) ((x)>(y)?(x):(y)) +#undef MIN +#define MIN(x,y) ((x)<(y)?(x):(y)) +#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) + +/* ---------------------------------------------------------------------- */ + +typedef struct gfxfmt gfxfmt; typedef struct gfxstate gfxstate; +struct gfxfmt { + uint32_t fourcc; /* little endian (drm) */ + cairo_format_t cairo; /* native endian */ + pixman_format_code_t pixman; /* native endian */ + uint32_t bits_pp; + uint32_t bytes_pp; +}; + +extern gfxfmt fmt_list[]; +extern uint32_t fmt_count; + struct gfxstate { /* info */ uint32_t hdisplay; diff --git a/meson.build b/meson.build index e438440..5746eb9 100644 --- a/meson.build +++ b/meson.build @@ -82,7 +82,7 @@ add_global_arguments(['-include', 'config.h'], language : 'c') # build fbi fbi_srcs = [ 'fbi.c', 'fb-gui.c', 'desktop.c', 'parseconfig.c', 'fbiconfig.c', - 'vt.c', 'kbd.c', 'fbtools.c', 'drmtools.c', + 'vt.c', 'kbd.c', 'fbtools.c', 'drmtools.c', 'gfx.c', 'filter.c', 'op.c', 'jpegtools.c', trans_src, read_srcs ] fbi_deps = [ drm_dep, pixman_dep, cairo_dep, @@ -116,7 +116,7 @@ executable('thumbnail.cgi', # build fbpdf fbpdf_srcs = [ 'fbpdf.c', 'parseconfig.c', 'fbiconfig.c', - 'vt.c', 'kbd.c', 'fbtools.c', 'drmtools.c' ] + 'vt.c', 'kbd.c', 'fbtools.c', 'drmtools.c', 'gfx.c' ] fbpdf_deps = [ drm_dep, gbm_dep, epoxy_dep, pixman_dep, poppler_dep, cairo_dep, udev_dep, input_dep ] @@ -127,7 +127,7 @@ executable('fbpdf', install : true) # build fbcon -fbcon_srcs = [ 'fbcon.c', 'drmtools.c', 'fbtools.c', 'vt.c', 'kbd.c', 'tmt.c' ] +fbcon_srcs = [ 'fbcon.c', 'drmtools.c', 'fbtools.c', 'gfx.c', 'vt.c', 'kbd.c', 'tmt.c' ] fbcon_deps = [ drm_dep, cairo_dep, util_dep, udev_dep, input_dep, xkb_dep ] executable('fbcon', @@ -3,6 +3,7 @@ #include <stddef.h> #include <string.h> #include <assert.h> +#include <endian.h> #include "readers.h" @@ -130,8 +131,13 @@ int load_free_extras(struct ida_image_info *info) void ida_image_alloc(struct ida_image *img) { assert(img->p == NULL); - img->p = pixman_image_create_bits(/* PIXMAN_r8g8b8 */ PIXMAN_b8g8r8, - img->i.width, img->i.height, NULL, 0); + img->p = pixman_image_create_bits( +#if __BYTE_ORDER == __LITTLE_ENDIAN + PIXMAN_b8g8r8, +#else + PIXMAN_r8g8b8, +#endif + img->i.width, img->i.height, NULL, 0); } uint8_t *ida_image_scanline(struct ida_image *img, int y) |