4 /* ************************************************************************
6 * ************************************************************************ */
16 #define list_init(list) { list.head = list.tail = NULL; }
18 /* ************************************************************************
20 * ************************************************************************ */
22 enum ESVC
{ e_display
, e_svc_inact_start
, e_svc_inact_stop
, e_svc_start
,
23 e_svc_started
, e_svc_stop
, e_svc_stopped
, e_svc_stop_failed
,
28 /* ************************************************************************
30 * ************************************************************************ */
31 enum otype
{ o_box
, o_icon
, o_text
, o_anim
};
49 rect crop_from
, crop_to
, crop_curr
;
53 int id
; /* monotonically increased ID */
54 enum otype type
; /* object type */
55 void *p
; /* pointer to the type-specific data */
56 rect bnd
; /* bounding rectangle */
57 u8
*bgcache
; /* bgnd cache, directly from the bg picture if NULL */
59 bool invalid
; /* indicates whether this object has to be repainted */
60 bool visible
; /* is this object to be rendered? */
61 u8 opacity
; /* global object opacity */
62 u16 op_tstep
; /* opacity time step in ms */
63 short op_step
; /* opacity step */
64 short wait_msecs
; /* time to wait till the next step */
65 u16 blendin
; /* blend-in time in ms, 0 if disabled */
66 u16 blendout
; /* blend-out time in ms, 0 if disabled */
74 typedef struct color
{
76 } __attribute__ ((packed
)) color
;
85 #define F_TXT_MSGLOG 4
87 #define F_HS_HORIZ_MASK 7
88 #define F_HS_VERT_MASK 56
91 #define F_HS_VMIDDLE 16
92 #define F_HS_BOTTOM 32
95 #define F_HS_HMIDDLE 2
105 typedef struct text
{
106 int x
, y
, last_width
;
114 int curr_progress
; /* if this string uses the $progress variable,
115 * curr_progress holds its currently used value
116 * (i.e. the value for which the text has been
117 * rendered), otherwise = -1 */
123 typedef struct fbspl_theme
{
130 u8 modes
; /* bitmask of supported splash modes */
132 char *silentpic
; /* background pictures */
134 char *silentpic256
; /* pictures for 8bpp modes */
137 /* Loaded background images */
138 struct fb_image verbose_img
;
139 struct fb_image silent_img
;
141 u8
*bgbuf
; /* background buffer */
143 /* A list of all objects used in the theme config file. */
146 /* A list of objects forming a textbox. Objects from this list
147 * are also memebers of the objs list. */
150 /* A list of objects with currently active special effects. */
153 /* A list of anims used in the theme config file. Anims from this
154 * list are also members of the objs list. */
157 /* A list of icon_img's. */
160 /* A list of fonts used in the theme. */
163 /* A list of rectangles. Rectangles are not on the objs list as they
164 * only describe a special area on the screen and are not renderable. */
167 int xres
; /* Resolution for which this theme has been designed. */
169 int xmarg
; /* Margins. Non-zero only if using a config file
170 * designed for a different resolution than the one
171 * currently in use. */
175 int log_lines
, log_cols
;
178 list blit
; /* List of rectangular regions (rect's) that need to be re-blit to the
180 list render
; /* List of rectangular regions (orect's) that need to be re-rendered
181 to update the screen image. */
184 #if defined(CONFIG_MNG) && !defined(TARGET_KERNEL)
185 #include "mng_splash.h"
187 #define F_ANIM_METHOD_MASK 12
188 #define F_ANIM_ONCE 0
189 #define F_ANIM_LOOP 4
190 #define F_ANIM_PROPORTIONAL 8
192 #define F_ANIM_STATUS_DONE 1
194 typedef struct anim
{
204 #endif /* CONFIG_MNG */
208 struct color c_ul
, c_ur
, c_ll
, c_lr
; /* upper left, upper right,
209 lower left, lower right */
211 struct box
*curr
; /* current interpolated box */
217 } __attribute__ ((packed
)) rgbacolor
;
221 } __attribute__ ((packed
)) rgbcolor
;
223 #define BOX_NOOVER 0x01
224 #define BOX_INTER 0x02
226 /* internal attributes */
227 #define BOX_SOLID 0x80
228 #define BOX_VGRAD 0x40
229 #define BOX_HGRAD 0x20
232 struct fb_var_screeninfo var
;
233 struct fb_fix_screeninfo fix
;
234 int bytespp
; /* bytes per pixel */
235 bool opt
; /* can we use optimized 24/32bpp routines? */
236 u8 ro
, go
, bo
; /* red, green, blue offset */
237 u8 rlen
, glen
, blen
; /* red, green, blue length */
240 /* ************************************************************************
242 * ************************************************************************ */
245 int fb_get_settings(int);
246 int do_getpic(unsigned char, unsigned char, char);
247 int cfg_check_sanity(stheme_t
*theme
, u8 mode
);
249 int dev_create(char *fn
, char *sys
);
250 int fb_open(int fb
, bool create
);
251 void fb_unmap(u8
*fb
);
252 void* fb_mmap(int fb
);
254 int tty_open(int tty
);
257 #define obj_alloc(__type, __mode) ({ \
258 u8* __mptr = calloc(1, sizeof(obj) + sizeof(__type)); \
260 ((obj*)__mptr)->p = __mptr + sizeof(obj); \
261 ((obj*)__mptr)->modes = __mode; \
262 ((obj*)__mptr)->visible = true; \
263 ((obj*)__mptr)->opacity = 0xff; \
264 ((obj*)__mptr)->invalid = true; \
265 ((obj*)__mptr)->type = o_##__type; \
266 (__type*)(__mptr + sizeof(obj)); \
269 #define container_of(x) (obj*)((u8*)(x) - sizeof(obj))
271 #define obj_setmode(__obj, __mode) { ((obj*)__obj)->modes = __mode; }
273 int parse_svc_state(char *t
, enum ESVC
*state
);
274 int parse_cfg(char *cfgfile
, stheme_t
*st
);
277 void rgba2fb(rgbacolor
* data
, u8
*bg
, u8
* out
, int len
, int y
, u8 alpha
, u8 opacity
);
278 void put_pixel(u8 a
, u8 r
, u8 g
, u8 b
, u8
*src
, u8
*dst
, u8 add
);
279 void invalidate_all(stheme_t
*theme
);
280 void invalidate_service(stheme_t
*theme
, char *svc
, enum ESVC state
);
281 void invalidate_progress(stheme_t
*theme
);
282 void invalidate_textbox(stheme_t
*theme
, bool active
);
283 void rect_interpolate(rect
*a
, rect
*b
, rect
*c
);
284 bool rect_intersect(rect
*a
, rect
*b
);
285 void rect_sanitize(stheme_t
*theme
, rect
*re
);
286 void box_interpolate(box
*a
, box
*b
, box
*c
);
287 void render_objs(stheme_t
*theme
, u8
*target
, u8 mode
, bool force
);
288 void bnd_init(stheme_t
*theme
);
289 void blit_add(stheme_t
*theme
, rect
*a
);
290 void render_add(stheme_t
*theme
, obj
*o
, rect
*a
);
293 int load_images(stheme_t
*theme
, char mode
);
296 int fbcon_decor_open(bool create
);
297 int fbcon_decor_setstate(unsigned char origin
, int vc
, unsigned int state
);
298 int fbcon_decor_getstate(unsigned char origin
, int vc
);
299 int fbcon_decor_setpic(unsigned char origin
, int vc
, stheme_t
*theme
);
300 int fbcon_decor_setcfg(unsigned char origin
, int vc
, stheme_t
*theme
);
301 int fbcon_decor_getcfg(int vc
);
307 void list_add(list
*l
, void *obj
);
308 void list_free(list l
, bool free_item
);
309 void list_del(list
*l
, item
*prev
, item
*curr
);
312 void paint_rect(stheme_t
*theme
, u8
*dst
, u8
*src
, int x1
, int y1
, int x2
, int y2
);
313 void put_img(stheme_t
*theme
, u8
*dst
, u8
*src
);
314 void paint_img(stheme_t
*theme
, u8
*dst
, u8
*src
);
315 void fade(stheme_t
*theme
, u8
*dst
, u8
*image
, struct fb_cmap cmap
, u8 bgnd
, int fd
, char type
);
316 void set_directcolor_cmap(int fd
);
320 extern char *arg_pidfile
;
324 extern int fd_fbcondecor
;
325 extern sendian_t endianess
;
326 extern fbspl_cfg_t config
;
328 /* libsplashrender */
329 extern int fd_tty
[MAX_NR_CONSOLES
];
330 extern struct fb_data fbd
;
334 #endif /* __RENDER_H */