Revision: 75426
http://sourceforge.net/p/brlcad/code/75426
Author: starseeker
Date: 2020-04-16 02:48:48 +0000 (Thu, 16 Apr 2020)
Log Message:
-----------
First high level experiment with combining libfb with libdm - got as far as
being able to run MGED and Archer successfully.
Modified Paths:
--------------
brlcad/branches/dm-fb-merge/include/CMakeLists.txt
brlcad/branches/dm-fb-merge/include/dm/calltable.h
brlcad/branches/dm-fb-merge/include/dm/defines.h
brlcad/branches/dm-fb-merge/include/dm.h
brlcad/branches/dm-fb-merge/include/tclcad.h
brlcad/branches/dm-fb-merge/misc/doxygen/CMakeLists.txt
brlcad/branches/dm-fb-merge/misc/pkgconfig/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/art/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/burst/extern.h
brlcad/branches/dm-fb-merge/src/burst/fb.c
brlcad/branches/dm-fb-merge/src/burst/glob.c
brlcad/branches/dm-fb-merge/src/burst/grid.c
brlcad/branches/dm-fb-merge/src/burst/paint.c
brlcad/branches/dm-fb-merge/src/fb/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/fb/bw-fb.c
brlcad/branches/dm-fb-merge/src/fb/cmap-crunch.c
brlcad/branches/dm-fb-merge/src/fb/fb-bw.c
brlcad/branches/dm-fb-merge/src/fb/fb-fb.c
brlcad/branches/dm-fb-merge/src/fb/fb-pix.c
brlcad/branches/dm-fb-merge/src/fb/fb-png.c
brlcad/branches/dm-fb-merge/src/fb/fbcbars.c
brlcad/branches/dm-fb-merge/src/fb/fbclear.c
brlcad/branches/dm-fb-merge/src/fb/fbcmap.c
brlcad/branches/dm-fb-merge/src/fb/fbcolor.c
brlcad/branches/dm-fb-merge/src/fb/fbfade.c
brlcad/branches/dm-fb-merge/src/fb/fbframe.c
brlcad/branches/dm-fb-merge/src/fb/fbfree.c
brlcad/branches/dm-fb-merge/src/fb/fbgamma.c
brlcad/branches/dm-fb-merge/src/fb/fbgrid.c
brlcad/branches/dm-fb-merge/src/fb/fbhelp.c
brlcad/branches/dm-fb-merge/src/fb/fblabel.c
brlcad/branches/dm-fb-merge/src/fb/fbline.c
brlcad/branches/dm-fb-merge/src/fb/fbpoint.c
brlcad/branches/dm-fb-merge/src/fb/fbstretch.c
brlcad/branches/dm-fb-merge/src/fb/fbzoom.c
brlcad/branches/dm-fb-merge/src/fb/gif-fb.c
brlcad/branches/dm-fb-merge/src/fb/gif2fb.c
brlcad/branches/dm-fb-merge/src/fb/ioutil.c
brlcad/branches/dm-fb-merge/src/fb/pix-fb.c
brlcad/branches/dm-fb-merge/src/fb/pixautosize.c
brlcad/branches/dm-fb-merge/src/fb/plot3-fb.c
brlcad/branches/dm-fb-merge/src/fb/png-fb.c
brlcad/branches/dm-fb-merge/src/fb/spm-fb.c
brlcad/branches/dm-fb-merge/src/fb/tests/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/fb/tests/fbthreadtest.c
brlcad/branches/dm-fb-merge/src/fbserv/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/fbserv/fbserv.c
brlcad/branches/dm-fb-merge/src/fbserv/server.c
brlcad/branches/dm-fb-merge/src/halftone/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/halftone/main.c
brlcad/branches/dm-fb-merge/src/libdm/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libdm/dm-X.c
brlcad/branches/dm-fb-merge/src/libdm/dm-ogl.c
brlcad/branches/dm-fb-merge/src/libdm/dm-osgl.cpp
brlcad/branches/dm-fb-merge/src/libdm/dm-qt.cpp
brlcad/branches/dm-fb-merge/src/libdm/dm-wgl.c
brlcad/branches/dm-fb-merge/src/libdm/dm_obj.c
brlcad/branches/dm-fb-merge/src/libdm/tcl.c
brlcad/branches/dm-fb-merge/src/libdm/vers.c
brlcad/branches/dm-fb-merge/src/libged/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libged/fb2pix.c
brlcad/branches/dm-fb-merge/src/libged/fbclear.c
brlcad/branches/dm-fb-merge/src/libged/pix2fb.c
brlcad/branches/dm-fb-merge/src/libged/png2fb.c
brlcad/branches/dm-fb-merge/src/liboptical/sh_points.c
brlcad/branches/dm-fb-merge/src/liboptical/sh_spm.c
brlcad/branches/dm-fb-merge/src/libtclcad/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/libtclcad/libfuncs.c
brlcad/branches/dm-fb-merge/src/libtclcad/tclcad.c
brlcad/branches/dm-fb-merge/src/libtclcad/tclcad_init.c
brlcad/branches/dm-fb-merge/src/libtclcad/tclcad_obj.c
brlcad/branches/dm-fb-merge/src/libtclcad/tkImgFmtPIX.c
brlcad/branches/dm-fb-merge/src/mged/attach.c
brlcad/branches/dm-fb-merge/src/mged/fbserv.h
brlcad/branches/dm-fb-merge/src/mged/rect.c
brlcad/branches/dm-fb-merge/src/remrt/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/remrt/remrt.c
brlcad/branches/dm-fb-merge/src/remrt/rtsrv.c
brlcad/branches/dm-fb-merge/src/rt/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/rt/do.c
brlcad/branches/dm-fb-merge/src/rt/ext.h
brlcad/branches/dm-fb-merge/src/rt/heatgraph.c
brlcad/branches/dm-fb-merge/src/rt/libfb-dummy.c
brlcad/branches/dm-fb-merge/src/rt/main.c
brlcad/branches/dm-fb-merge/src/rt/opt.c
brlcad/branches/dm-fb-merge/src/rt/view.c
brlcad/branches/dm-fb-merge/src/rt/viewedge.c
brlcad/branches/dm-fb-merge/src/rt/viewxray.c
brlcad/branches/dm-fb-merge/src/rt/worker.c
brlcad/branches/dm-fb-merge/src/rtwizard/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/sig/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/sig/ddisp.c
brlcad/branches/dm-fb-merge/src/util/CMakeLists.txt
brlcad/branches/dm-fb-merge/src/util/bw-a.c
brlcad/branches/dm-fb-merge/src/util/bw-png.c
brlcad/branches/dm-fb-merge/src/util/bwhist.c
brlcad/branches/dm-fb-merge/src/util/double-asc.c
brlcad/branches/dm-fb-merge/src/util/imgdims.c
brlcad/branches/dm-fb-merge/src/util/pix-png.c
brlcad/branches/dm-fb-merge/src/util/pix-ppm.c
brlcad/branches/dm-fb-merge/src/util/pix-spm.c
brlcad/branches/dm-fb-merge/src/util/pixbgstrip.c
brlcad/branches/dm-fb-merge/src/util/pixborder.c
brlcad/branches/dm-fb-merge/src/util/pixelswap.c
brlcad/branches/dm-fb-merge/src/util/pixhalve.c
brlcad/branches/dm-fb-merge/src/util/pixhist.c
brlcad/branches/dm-fb-merge/src/util/pixhist3d.c
brlcad/branches/dm-fb-merge/src/util/pixmorph.c
brlcad/branches/dm-fb-merge/src/util/wavelet.c
Added Paths:
-----------
brlcad/branches/dm-fb-merge/src/libdm/asize.c
brlcad/branches/dm-fb-merge/src/libdm/fb_X.h
brlcad/branches/dm-fb-merge/src/libdm/fb_generic.c
brlcad/branches/dm-fb-merge/src/libdm/fb_log.c
brlcad/branches/dm-fb-merge/src/libdm/fb_obj.c
brlcad/branches/dm-fb-merge/src/libdm/fb_ogl.h
brlcad/branches/dm-fb-merge/src/libdm/fb_osgl.h
brlcad/branches/dm-fb-merge/src/libdm/fb_paged_io.c
brlcad/branches/dm-fb-merge/src/libdm/fb_private.h
brlcad/branches/dm-fb-merge/src/libdm/fb_qt.h
brlcad/branches/dm-fb-merge/src/libdm/fb_rect.c
brlcad/branches/dm-fb-merge/src/libdm/fb_util.c
brlcad/branches/dm-fb-merge/src/libdm/fb_wgl.h
brlcad/branches/dm-fb-merge/src/libdm/fbserv_obj.c
brlcad/branches/dm-fb-merge/src/libdm/if_TEMPLATE.c
brlcad/branches/dm-fb-merge/src/libdm/if_X24.c
brlcad/branches/dm-fb-merge/src/libdm/if_debug.c
brlcad/branches/dm-fb-merge/src/libdm/if_disk.c
brlcad/branches/dm-fb-merge/src/libdm/if_mem.c
brlcad/branches/dm-fb-merge/src/libdm/if_null.c
brlcad/branches/dm-fb-merge/src/libdm/if_ogl.c
brlcad/branches/dm-fb-merge/src/libdm/if_osgl.cpp
brlcad/branches/dm-fb-merge/src/libdm/if_qt.cpp
brlcad/branches/dm-fb-merge/src/libdm/if_remote.c
brlcad/branches/dm-fb-merge/src/libdm/if_stack.c
brlcad/branches/dm-fb-merge/src/libdm/if_tk.c
brlcad/branches/dm-fb-merge/src/libdm/if_wgl.c
brlcad/branches/dm-fb-merge/src/libdm/osg_fb_manipulator.h
Removed Paths:
-------------
brlcad/branches/dm-fb-merge/include/fb/
brlcad/branches/dm-fb-merge/include/fb.h
brlcad/branches/dm-fb-merge/misc/doxygen/libfb.dox
brlcad/branches/dm-fb-merge/src/libfb/
Modified: brlcad/branches/dm-fb-merge/include/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/include/CMakeLists.txt 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/include/CMakeLists.txt 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -26,7 +26,6 @@
bu.h
common.h
dm.h
- fb.h
fft.h
gcv.h
ged.h
Modified: brlcad/branches/dm-fb-merge/include/dm/calltable.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/dm/calltable.h 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/include/dm/calltable.h 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -134,7 +134,71 @@
void *dm_interp; /**< @brief interpreter */
};
+struct fb_impl {
+ uint32_t if_magic;
+ uint32_t type_magic;
+ /* Static information: per device TYPE. */
+ int (*if_open)(struct fb *ifp, const char *file, int _width, int _height);
/**< @brief open device */
+ int (*if_open_existing)(struct fb *ifp, int width, int height, struct
fb_platform_specific *fb_p); /**< @brief open device */
+ int (*if_close_existing)(struct fb *ifp); /**<
@brief close embedded struct fb */
+ struct fb_platform_specific *(*if_existing_get)(uint32_t magic);
/**< @brief allocate memory for platform specific container*/
+ void (*if_existing_put)(struct
fb_platform_specific *fb_p); /**< @brief free memory for
platform specific container */
+ int (*if_close)(struct fb *ifp);
/**< @brief close device */
+ int (*if_clear)(struct fb *ifp, unsigned char *pp);
/**< @brief clear device */
+ ssize_t (*if_read)(struct fb *ifp, int x, int y, unsigned char *pp, size_t
count); /**< @brief read pixels */
+ ssize_t (*if_write)(struct fb *ifp, int x, int y, const unsigned char *pp,
size_t count); /**< @brief write pixels */
+ int (*if_rmap)(struct fb *ifp, ColorMap *cmap);
/**< @brief read colormap */
+ int (*if_wmap)(struct fb *ifp, const ColorMap *cmap);
/**< @brief write colormap */
+ int (*if_view)(struct fb *ifp, int xcent, int ycent, int xzoom, int
yzoom); /**< @brief set view */
+ int (*if_getview)(struct fb *ifp, int *xcent, int *ycent, int *xzoom, int
*yzoom); /**< @brief get view */
+ int (*if_setcursor)(struct fb *ifp, const unsigned char *bits, int xb, int
yb, int xo, int yo); /**< @brief define cursor */
+ int (*if_cursor)(struct fb *ifp, int mode, int x, int y);
/**< @brief set cursor */
+ int (*if_getcursor)(struct fb *ifp, int *mode, int *x, int *y);
/**< @brief get cursor */
+ int (*if_readrect)(struct fb *ifp, int xmin, int ymin, int _width, int
_height, unsigned char *pp); /**< @brief read rectangle */
+ int (*if_writerect)(struct fb *ifp, int xmin, int ymin, int _width, int
_height, const unsigned char *pp); /**< @brief write rectangle */
+ int (*if_bwreadrect)(struct fb *ifp, int xmin, int ymin, int _width, int
_height, unsigned char *pp); /**< @brief read monochrome rectangle */
+ int (*if_bwwriterect)(struct fb *ifp, int xmin, int ymin, int _width, int
_height, const unsigned char *pp); /**< @brief write rectangle */
+ int (*if_configure_window)(struct fb *ifp, int width, int height);
/**< @brief configure window */
+ int (*if_refresh)(struct fb *ifp, int x, int y, int w, int h);
/**< @brief refresh window */
+ int (*if_poll)(struct fb *ifp); /**< @brief handle events */
+ int (*if_flush)(struct fb *ifp); /**< @brief flush output */
+ int (*if_free)(struct fb *ifp); /**< @brief free resources */
+ int (*if_help)(struct fb *ifp); /**< @brief print useful info */
+ char *if_type; /**< @brief what "open" calls it */
+ int if_max_width; /**< @brief max device width */
+ int if_max_height; /**< @brief max device height */
+ /* Dynamic information: per device INSTANCE. */
+ char *if_name; /**< @brief what the user called it */
+ int if_width; /**< @brief current values */
+ int if_height;
+ int if_selfd; /**< @brief select(fd) for input events if >= 0 */
+ /* Internal information: needed by the library. */
+ int if_fd; /**< @brief internal file descriptor */
+ int if_xzoom; /**< @brief zoom factors */
+ int if_yzoom;
+ int if_xcenter; /**< @brief pan position */
+ int if_ycenter;
+ int if_cursmode; /**< @brief cursor on/off */
+ int if_xcurs; /**< @brief cursor position */
+ int if_ycurs;
+ unsigned char *if_pbase;/**< @brief Address of malloc()ed page buffer.
*/
+ unsigned char *if_pcurp;/**< @brief Current pointer into page buffer.
*/
+ unsigned char *if_pendp;/**< @brief End of page buffer.
*/
+ int if_pno; /**< @brief Current "page" in memory. */
+ int if_pdirty; /**< @brief Page modified flag. */
+ long if_pixcur; /**< @brief Current pixel number in framebuffer. */
+ long if_ppixels; /**< @brief Sizeof page buffer (pixels).
*/
+ int if_debug; /**< @brief Buffered IO debug flag. */
+ long if_poll_refresh_rate; /**< @brief Recommended polling rate for
interactive framebuffers in microseconds. */
+ /* State variables for individual interface modules */
+ union {
+ char *p;
+ size_t l;
+ } u1, u2, u3, u4, u5, u6;
+};
+
+
__END_DECLS
#endif /* DM_CALLTABLE_H */
Modified: brlcad/branches/dm-fb-merge/include/dm/defines.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/dm/defines.h 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/include/dm/defines.h 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -34,6 +34,18 @@
# endif
#endif
+#ifndef FB_EXPORT
+# if defined(FB_DLL_EXPORTS) && defined(FB_DLL_IMPORTS)
+# error "Only FB_DLL_EXPORTS or FB_DLL_IMPORTS can be defined, not both."
+# elif defined(FB_DLL_EXPORTS)
+# define FB_EXPORT __declspec(dllexport)
+# elif defined(FB_DLL_IMPORTS)
+# define FB_EXPORT __declspec(dllimport)
+# else
+# define FB_EXPORT
+# endif
+#endif
+
/** @} */
/*
* Local Variables:
Modified: brlcad/branches/dm-fb-merge/include/dm.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/dm.h 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/include/dm.h 2020-04-16 02:48:48 UTC (rev
75426)
@@ -31,7 +31,6 @@
#include "vmath.h"
#include "bn.h"
#include "raytrace.h"
-#include "fb.h"
#include "./dm/defines.h"
@@ -188,8 +187,8 @@
int *labelsColor,
int (*labelsHook)(struct dm *dmp_arg,
struct rt_wdb *wdbp_arg,
const char *name_arg,
mat_t viewmat_arg,
- int *labelsColor_arg,
ClientData labelsHookClientdata_arg),
- ClientData labelsHookClientdata);
+ int *labelsColor_arg,
void *labelsHookClientdata_arg),
+ void *labelsHookClientdata);
/* rect.c */
DM_EXPORT extern void dm_draw_rect(struct dm *dmp,
@@ -316,6 +315,266 @@
DM_EXPORT extern int dm_default_type();
+/*
+ * Needed for fd_set, avoid including sys/select.h outright since it
+ * conflicts on some systems (e.g. freebsd4).
+ *
+ * FIXME: would be nice to decouple this interface from fd_set as it's
+ * only used in one place right now.
+ */
+#if defined(HAVE_SYS_TYPES_H)
+# include <sys/types.h>
+#endif
+#if defined(HAVE_SYS_TIME_H)
+# include <sys/time.h>
+#endif
+
+#include "bsocket.h"
+#include "bio.h"
+
+#include "tcl.h"
+#include "pkg.h"
+#include "bu/magic.h"
+#include "bu/vls.h"
+
+/**
+ * Format of disk pixels is .pix raw image files. Formerly used as
+ * arguments to many of the library routines, but has fallen into
+ * disuse due to the difficulties with ANSI function prototypes, and
+ * the fact that arrays are not real types in C. The most notable
+ * problem is that of passing a pointer to an array of RGBpixel. It
+ * looks doubly dimensioned, but isn't.
+ */
+typedef unsigned char RGBpixel[3];
+
+
+/**
+ * These generic color maps have up to 16 bits of significance,
+ * left-justified in a short. Think of this as fixed-point values
+ * from 0 to 1.
+ */
+typedef struct {
+ unsigned short cm_red[256];
+ unsigned short cm_green[256];
+ unsigned short cm_blue[256];
+} ColorMap;
+
+
+#define PIXEL_NULL (unsigned char *) 0
+#define RGBPIXEL_NULL (unsigned char *) 0
+#define COLORMAP_NULL (ColorMap *) 0
+
+/* The internals of the framebuffer structure are hidden using the PImpl
pattern */
+struct fb_impl;
+struct fb {
+ struct fb_impl *i;
+};
+#define FB_NULL (struct fb *) 0
+
+/**
+ * assert the integrity of a framebuffer struct.
+ */
+#define FB_CK_FB(_p) BU_CKMAG(_p, FB_MAGIC, "FB")
+
+/* Library entry points */
+
+FB_EXPORT struct fb *fb_get();
+FB_EXPORT void fb_put(struct fb *ifp);
+FB_EXPORT extern char *fb_gettype(struct fb *ifp);
+FB_EXPORT extern int fb_get_max_width(struct fb *ifp);
+FB_EXPORT extern int fb_get_max_height(struct fb *ifp);
+FB_EXPORT extern int fb_getwidth(struct fb *ifp);
+FB_EXPORT extern int fb_getheight(struct fb *ifp);
+FB_EXPORT extern int fb_poll(struct fb *ifp);
+/* Returns in microseconds the maximum recommended amount of time to linger
+ * before polling for updates for a specific framebuffer instance (can be
+ * implementation dependent.) Zero means the fb_poll process does nothing
+ * (for example, the NULL fb). */
+FB_EXPORT extern long fb_poll_rate(struct fb *ifp);
+FB_EXPORT extern int fb_help(struct fb *ifp);
+FB_EXPORT extern int fb_free(struct fb *ifp);
+FB_EXPORT extern int fb_clear(struct fb *ifp, unsigned char *pp);
+FB_EXPORT extern ssize_t fb_read(struct fb *ifp, int x, int y, unsigned char
*pp, size_t count);
+FB_EXPORT extern ssize_t fb_write(struct fb *ifp, int x, int y, const unsigned
char *pp, size_t count);
+FB_EXPORT extern int fb_rmap(struct fb *ifp, ColorMap *cmap);
+FB_EXPORT extern int fb_wmap(struct fb *ifp, const ColorMap *cmap);
+FB_EXPORT extern int fb_view(struct fb *ifp, int xcenter, int ycenter, int
xzoom, int yzoom);
+FB_EXPORT extern int fb_getview(struct fb *ifp, int *xcenter, int *ycenter,
int *xzoom, int *yzoom);
+FB_EXPORT extern int fb_setcursor(struct fb *ifp, const unsigned char *bits,
int xb, int yb, int xo, int yo);
+FB_EXPORT extern int fb_cursor(struct fb *ifp, int mode, int x, int y);
+FB_EXPORT extern int fb_getcursor(struct fb *ifp, int *mode, int *x, int *y);
+FB_EXPORT extern int fb_readrect(struct fb *ifp, int xmin, int ymin, int
width, int height, unsigned char *pp);
+FB_EXPORT extern int fb_writerect(struct fb *ifp, int xmin, int ymin, int
width, int height, const unsigned char *pp);
+FB_EXPORT extern int fb_bwreadrect(struct fb *ifp, int xmin, int ymin, int
width, int height, unsigned char *pp);
+FB_EXPORT extern int fb_bwwriterect(struct fb *ifp, int xmin, int ymin, int
width, int height, const unsigned char *pp);
+
+FB_EXPORT extern struct fb *fb_open(const char *file, int _width, int _height);
+FB_EXPORT extern int fb_close(struct fb *ifp);
+FB_EXPORT extern int fb_close_existing(struct fb *ifp);
+FB_EXPORT extern int fb_genhelp(void);
+FB_EXPORT extern int fb_ioinit(struct fb *ifp);
+FB_EXPORT extern int fb_seek(struct fb *ifp, int x, int y);
+FB_EXPORT extern int fb_tell(struct fb *ifp, int *xp, int *yp);
+FB_EXPORT extern int fb_rpixel(struct fb *ifp, unsigned char *pp);
+FB_EXPORT extern int fb_wpixel(struct fb *ifp, unsigned char *pp);
+FB_EXPORT extern int fb_flush(struct fb *ifp);
+FB_EXPORT extern int fb_configure_window(struct fb *, int, int);
+FB_EXPORT extern int fb_refresh(struct fb *ifp, int x, int y, int w, int h);
+#if !defined(_WIN32) || defined(__CYGWIN__)
+FB_EXPORT extern void fb_log(const char *fmt, ...) _BU_ATTR_PRINTF12;
+#endif
+FB_EXPORT extern int fb_null(struct fb *ifp);
+FB_EXPORT extern int fb_null_setcursor(struct fb *ifp, const unsigned char
*bits, int xbits, int ybits, int xorig, int yorig);
+
+/* utility functions */
+FB_EXPORT extern int fb_common_file_size(size_t *widthp, size_t *heightp,
const char *filename, int pixel_size);
+FB_EXPORT extern int fb_common_image_size(size_t *widthp, size_t *heightp,
size_t npixels);
+FB_EXPORT extern int fb_common_name_size(size_t *widthp, size_t *heightp,
const char *name);
+FB_EXPORT extern int fb_write_fp(struct fb *ifp, FILE *fp, int req_width, int
req_height, int crunch, int inverse, struct bu_vls *result);
+FB_EXPORT extern int fb_read_fd(struct fb *ifp, int fd, int file_width, int
file_height, int file_xoff, int file_yoff, int scr_width, int scr_height, int
scr_xoff, int scr_yoff, int fileinput, char *file_name, int one_line_only, int
multiple_lines, int autosize, int inverse, int clear, int zoom, struct bu_vls
*result);
+FB_EXPORT extern int fb_read_png(struct fb *ifp, FILE *fp, int file_xoff, int
file_yoff, int scr_xoff, int scr_yoff, int clear, int zoom, int inverse, int
one_line_only, int multiple_lines, int verbose, int header_only, double
def_screen_gamma, struct bu_vls *result);
+
+FB_EXPORT extern void fb_set_interface(struct fb *ifp, const char
*interface_type);
+FB_EXPORT extern void fb_set_name(struct fb *ifp, const char *name);
+FB_EXPORT extern char *fb_get_name(struct fb *ifp);
+FB_EXPORT extern void fb_set_magic(struct fb *ifp, uint32_t magic);
+FB_EXPORT extern long fb_get_pagebuffer_pixel_size(struct fb *ifp);
+
+FB_EXPORT extern int fb_is_set_fd(struct fb *ifp, fd_set *infds);
+FB_EXPORT extern int fb_set_fd(struct fb *ifp, fd_set *select_list);
+FB_EXPORT extern int fb_clear_fd(struct fb *ifp, fd_set *select_list);
+
+/* color mapping */
+FB_EXPORT extern int fb_is_linear_cmap(const ColorMap *cmap);
+FB_EXPORT extern void fb_make_linear_cmap(ColorMap *cmap);
+
+/* open_existing functionality. */
+struct fb_platform_specific {uint32_t magic; void *data;};
+FB_EXPORT extern struct fb_platform_specific
*fb_get_platform_specific(uint32_t magic);
+FB_EXPORT extern void fb_put_platform_specific(struct fb_platform_specific
*fb_p);
+FB_EXPORT extern struct fb *fb_open_existing(const char *file, int _width, int
_height, struct fb_platform_specific *fb_p);
+
+/* backward compatibility hacks */
+FB_EXPORT extern int fb_reset(struct fb *ifp);
+FB_EXPORT extern int fb_viewport(struct fb *ifp, int left, int top, int right,
int bottom);
+FB_EXPORT extern int fb_window(struct fb *ifp, int xcenter, int ycenter);
+FB_EXPORT extern int fb_zoom(struct fb *ifp, int xzoom, int yzoom);
+FB_EXPORT extern int fb_scursor(struct fb *ifp, int mode, int x, int y);
+
+/*
+ * Copy one RGB pixel to another.
+ */
+#define COPYRGB(to, from) { (to)[RED]=(from)[RED];\
+ (to)[GRN]=(from)[GRN];\
+ (to)[BLU]=(from)[BLU]; }
+
+/* Debug Bitvector Definition */
+#define FB_DEBUG_BIO 1 /* Buffered io calls (less r/wpixel) */
+#define FB_DEBUG_CMAP 2 /* Contents of colormaps */
+#define FB_DEBUG_RW 4 /* Contents of reads and writes */
+#define FB_DEBUG_BRW 8 /* Buffered IO rpixel and wpixel */
+
+/* tcl.c */
+/* The presence of Tcl_Interp as an arg prevents giving arg list */
+FB_EXPORT extern void fb_tcl_setup(void);
+FB_EXPORT extern int Fb_Init(Tcl_Interp *interp);
+
+/**
+ * report version information about LIBFB
+ */
+FB_EXPORT extern const char *fb_version(void);
+
+
+/* To avoid breaking things too badly, temporarily expose
+ * what is now internal API */
+#ifdef EXPOSE_FB_HEADER
+# include "../src/libfb/fb_private.h"
+#endif
+
+typedef struct fb_internal FBIO;
+
+
+/*
+ * Types of packages used for the remote frame buffer
+ * communication
+ */
+#define MSG_FBOPEN 1
+#define MSG_FBCLOSE 2
+#define MSG_FBCLEAR 3
+#define MSG_FBREAD 4
+#define MSG_FBWRITE 5
+#define MSG_FBCURSOR 6 /**< @brief fb_cursor() */
+#define MSG_FBWINDOW 7 /**< @brief OLD */
+#define MSG_FBZOOM 8 /**< @brief OLD */
+#define MSG_FBSCURSOR 9 /**< @brief OLD */
+#define MSG_FBVIEW 10 /**< @brief NEW */
+#define MSG_FBGETVIEW 11 /**< @brief NEW */
+#define MSG_FBRMAP 12
+#define MSG_FBWMAP 13
+#define MSG_FBHELP 14
+#define MSG_FBREADRECT 15
+#define MSG_FBWRITERECT 16
+#define MSG_FBFLUSH 17
+#define MSG_FBFREE 18
+#define MSG_FBGETCURSOR 19 /**< @brief NEW */
+#define MSG_FBPOLL 30 /**< @brief NEW */
+#define MSG_FBSETCURSOR 31 /**< @brief NEW in Release 4.4 */
+#define MSG_FBBWREADRECT 32 /**< @brief NEW in Release 4.6 */
+#define MSG_FBBWWRITERECT 33 /**< @brief NEW in Release 4.6 */
+
+#define MSG_DATA 20
+#define MSG_RETURN 21
+#define MSG_CLOSE 22
+#define MSG_ERROR 23
+
+#define MSG_NORETURN 100
+
+
+/* Framebuffer server object */
+
+#define NET_LONG_LEN 4 /**< @brief # bytes to network long */
+#define MAX_CLIENTS 32
+#define MAX_PORT_TRIES 100
+#define FBS_CALLBACK_NULL (void (*)())NULL
+#define FBSERV_OBJ_NULL (struct fbserv_obj *)NULL
+
+struct fbserv_listener {
+ int fbsl_fd; /**< @brief socket to listen for
connections */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ Tcl_Channel fbsl_chan;
+#endif
+ int fbsl_port; /**< @brief port number to listen on */
+ int fbsl_listen; /**< @brief !0 means listen for
connections */
+ struct fbserv_obj *fbsl_fbsp; /**< @brief points to its fbserv
object */
+};
+
+
+struct fbserv_client {
+ int fbsc_fd;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ Tcl_Channel fbsc_chan;
+ Tcl_FileProc *fbsc_handler;
+#endif
+ struct pkg_conn *fbsc_pkg;
+ struct fbserv_obj *fbsc_fbsp; /**< @brief points to its fbserv
object */
+};
+
+
+struct fbserv_obj {
+ struct fb *fbs_fbp; /**< @brief framebuffer pointer
*/
+ Tcl_Interp *fbs_interp; /**< @brief tcl interpreter */
+ struct fbserv_listener fbs_listener; /**< @brief data for
listening */
+ struct fbserv_client fbs_clients[MAX_CLIENTS]; /**< @brief connected
clients */
+ void (*fbs_callback)(void *clientData); /**< @brief callback
function */
+ void *fbs_clientData;
+ int fbs_mode; /**< @brief 0-off, 1-underlay,
2-interlay, 3-overlay */
+};
+
+FB_EXPORT extern int fbs_open(struct fbserv_obj *fbsp, int port);
+FB_EXPORT extern int fbs_close(struct fbserv_obj *fbsp);
+
+
+
__END_DECLS
#endif /* DM_H */
Deleted: brlcad/branches/dm-fb-merge/include/fb.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/fb.h 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/include/fb.h 2020-04-16 02:48:48 UTC (rev
75426)
@@ -1,310 +0,0 @@
-/* F B . H
- * BRL-CAD
- *
- * Copyright (c) 2004-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @addtogroup libfb */
-/** @{ */
-/** @file fb.h
- *
- * "Generic" Framebuffer Library Interface Defines.
- *
- */
-
-#ifndef FB_H
-#define FB_H
-
-#include "common.h"
-
-#include "./fb/defines.h"
-
-/*
- * Needed for fd_set, avoid including sys/select.h outright since it
- * conflicts on some systems (e.g. freebsd4).
- *
- * FIXME: would be nice to decouple this interface from fd_set as it's
- * only used in one place right now.
- */
-#if defined(HAVE_SYS_TYPES_H)
-# include <sys/types.h>
-#endif
-#if defined(HAVE_SYS_TIME_H)
-# include <sys/time.h>
-#endif
-
-#include "bsocket.h"
-#include "bio.h"
-
-#include "tcl.h"
-#include "pkg.h"
-#include "bu/magic.h"
-#include "bu/vls.h"
-
-/**
- * Format of disk pixels is .pix raw image files. Formerly used as
- * arguments to many of the library routines, but has fallen into
- * disuse due to the difficulties with ANSI function prototypes, and
- * the fact that arrays are not real types in C. The most notable
- * problem is that of passing a pointer to an array of RGBpixel. It
- * looks doubly dimensioned, but isn't.
- */
-typedef unsigned char RGBpixel[3];
-
-
-/**
- * These generic color maps have up to 16 bits of significance,
- * left-justified in a short. Think of this as fixed-point values
- * from 0 to 1.
- */
-typedef struct {
- unsigned short cm_red[256];
- unsigned short cm_green[256];
- unsigned short cm_blue[256];
-} ColorMap;
-
-
-#define PIXEL_NULL (unsigned char *) 0
-#define RGBPIXEL_NULL (unsigned char *) 0
-#define COLORMAP_NULL (ColorMap *) 0
-
-/* The internals of the framebuffer structure are hidden using the PImpl
pattern */
-struct fb_impl;
-struct fb {
- struct fb_impl *i;
-};
-#define FB_NULL (struct fb *) 0
-
-/**
- * assert the integrity of a framebuffer struct.
- */
-#define FB_CK_FB(_p) BU_CKMAG(_p, FB_MAGIC, "FB")
-
-__BEGIN_DECLS
-
-/* Library entry points */
-
-FB_EXPORT struct fb *fb_get();
-FB_EXPORT void fb_put(struct fb *ifp);
-FB_EXPORT extern char *fb_gettype(struct fb *ifp);
-FB_EXPORT extern int fb_get_max_width(struct fb *ifp);
-FB_EXPORT extern int fb_get_max_height(struct fb *ifp);
-FB_EXPORT extern int fb_getwidth(struct fb *ifp);
-FB_EXPORT extern int fb_getheight(struct fb *ifp);
-FB_EXPORT extern int fb_poll(struct fb *ifp);
-/* Returns in microseconds the maximum recommended amount of time to linger
- * before polling for updates for a specific framebuffer instance (can be
- * implementation dependent.) Zero means the fb_poll process does nothing
- * (for example, the NULL fb). */
-FB_EXPORT extern long fb_poll_rate(struct fb *ifp);
-FB_EXPORT extern int fb_help(struct fb *ifp);
-FB_EXPORT extern int fb_free(struct fb *ifp);
-FB_EXPORT extern int fb_clear(struct fb *ifp, unsigned char *pp);
-FB_EXPORT extern ssize_t fb_read(struct fb *ifp, int x, int y, unsigned char
*pp, size_t count);
-FB_EXPORT extern ssize_t fb_write(struct fb *ifp, int x, int y, const unsigned
char *pp, size_t count);
-FB_EXPORT extern int fb_rmap(struct fb *ifp, ColorMap *cmap);
-FB_EXPORT extern int fb_wmap(struct fb *ifp, const ColorMap *cmap);
-FB_EXPORT extern int fb_view(struct fb *ifp, int xcenter, int ycenter, int
xzoom, int yzoom);
-FB_EXPORT extern int fb_getview(struct fb *ifp, int *xcenter, int *ycenter,
int *xzoom, int *yzoom);
-FB_EXPORT extern int fb_setcursor(struct fb *ifp, const unsigned char *bits,
int xb, int yb, int xo, int yo);
-FB_EXPORT extern int fb_cursor(struct fb *ifp, int mode, int x, int y);
-FB_EXPORT extern int fb_getcursor(struct fb *ifp, int *mode, int *x, int *y);
-FB_EXPORT extern int fb_readrect(struct fb *ifp, int xmin, int ymin, int
width, int height, unsigned char *pp);
-FB_EXPORT extern int fb_writerect(struct fb *ifp, int xmin, int ymin, int
width, int height, const unsigned char *pp);
-FB_EXPORT extern int fb_bwreadrect(struct fb *ifp, int xmin, int ymin, int
width, int height, unsigned char *pp);
-FB_EXPORT extern int fb_bwwriterect(struct fb *ifp, int xmin, int ymin, int
width, int height, const unsigned char *pp);
-
-FB_EXPORT extern struct fb *fb_open(const char *file, int _width, int _height);
-FB_EXPORT extern int fb_close(struct fb *ifp);
-FB_EXPORT extern int fb_close_existing(struct fb *ifp);
-FB_EXPORT extern int fb_genhelp(void);
-FB_EXPORT extern int fb_ioinit(struct fb *ifp);
-FB_EXPORT extern int fb_seek(struct fb *ifp, int x, int y);
-FB_EXPORT extern int fb_tell(struct fb *ifp, int *xp, int *yp);
-FB_EXPORT extern int fb_rpixel(struct fb *ifp, unsigned char *pp);
-FB_EXPORT extern int fb_wpixel(struct fb *ifp, unsigned char *pp);
-FB_EXPORT extern int fb_flush(struct fb *ifp);
-FB_EXPORT extern int fb_configure_window(struct fb *, int, int);
-FB_EXPORT extern int fb_refresh(struct fb *ifp, int x, int y, int w, int h);
-#if !defined(_WIN32) || defined(__CYGWIN__)
-FB_EXPORT extern void fb_log(const char *fmt, ...) _BU_ATTR_PRINTF12;
-#endif
-FB_EXPORT extern int fb_null(struct fb *ifp);
-FB_EXPORT extern int fb_null_setcursor(struct fb *ifp, const unsigned char
*bits, int xbits, int ybits, int xorig, int yorig);
-
-/* utility functions */
-FB_EXPORT extern int fb_common_file_size(size_t *widthp, size_t *heightp,
const char *filename, int pixel_size);
-FB_EXPORT extern int fb_common_image_size(size_t *widthp, size_t *heightp,
size_t npixels);
-FB_EXPORT extern int fb_common_name_size(size_t *widthp, size_t *heightp,
const char *name);
-FB_EXPORT extern int fb_write_fp(struct fb *ifp, FILE *fp, int req_width, int
req_height, int crunch, int inverse, struct bu_vls *result);
-FB_EXPORT extern int fb_read_fd(struct fb *ifp, int fd, int file_width, int
file_height, int file_xoff, int file_yoff, int scr_width, int scr_height, int
scr_xoff, int scr_yoff, int fileinput, char *file_name, int one_line_only, int
multiple_lines, int autosize, int inverse, int clear, int zoom, struct bu_vls
*result);
-FB_EXPORT extern int fb_read_png(struct fb *ifp, FILE *fp, int file_xoff, int
file_yoff, int scr_xoff, int scr_yoff, int clear, int zoom, int inverse, int
one_line_only, int multiple_lines, int verbose, int header_only, double
def_screen_gamma, struct bu_vls *result);
-
-FB_EXPORT extern void fb_set_interface(struct fb *ifp, const char
*interface_type);
-FB_EXPORT extern void fb_set_name(struct fb *ifp, const char *name);
-FB_EXPORT extern char *fb_get_name(struct fb *ifp);
-FB_EXPORT extern void fb_set_magic(struct fb *ifp, uint32_t magic);
-FB_EXPORT extern long fb_get_pagebuffer_pixel_size(struct fb *ifp);
-
-FB_EXPORT extern int fb_is_set_fd(struct fb *ifp, fd_set *infds);
-FB_EXPORT extern int fb_set_fd(struct fb *ifp, fd_set *select_list);
-FB_EXPORT extern int fb_clear_fd(struct fb *ifp, fd_set *select_list);
-
-/* color mapping */
-FB_EXPORT extern int fb_is_linear_cmap(const ColorMap *cmap);
-FB_EXPORT extern void fb_make_linear_cmap(ColorMap *cmap);
-
-/* open_existing functionality. */
-struct fb_platform_specific {uint32_t magic; void *data;};
-FB_EXPORT extern struct fb_platform_specific
*fb_get_platform_specific(uint32_t magic);
-FB_EXPORT extern void fb_put_platform_specific(struct fb_platform_specific
*fb_p);
-FB_EXPORT extern struct fb *fb_open_existing(const char *file, int _width, int
_height, struct fb_platform_specific *fb_p);
-
-/* backward compatibility hacks */
-FB_EXPORT extern int fb_reset(struct fb *ifp);
-FB_EXPORT extern int fb_viewport(struct fb *ifp, int left, int top, int right,
int bottom);
-FB_EXPORT extern int fb_window(struct fb *ifp, int xcenter, int ycenter);
-FB_EXPORT extern int fb_zoom(struct fb *ifp, int xzoom, int yzoom);
-FB_EXPORT extern int fb_scursor(struct fb *ifp, int mode, int x, int y);
-
-/*
- * Copy one RGB pixel to another.
- */
-#define COPYRGB(to, from) { (to)[RED]=(from)[RED];\
- (to)[GRN]=(from)[GRN];\
- (to)[BLU]=(from)[BLU]; }
-
-/* Debug Bitvector Definition */
-#define FB_DEBUG_BIO 1 /* Buffered io calls (less r/wpixel) */
-#define FB_DEBUG_CMAP 2 /* Contents of colormaps */
-#define FB_DEBUG_RW 4 /* Contents of reads and writes */
-#define FB_DEBUG_BRW 8 /* Buffered IO rpixel and wpixel */
-
-/* tcl.c */
-/* The presence of Tcl_Interp as an arg prevents giving arg list */
-FB_EXPORT extern void fb_tcl_setup(void);
-FB_EXPORT extern int Fb_Init(Tcl_Interp *interp);
-
-/**
- * report version information about LIBFB
- */
-FB_EXPORT extern const char *fb_version(void);
-
-
-/* To avoid breaking things too badly, temporarily expose
- * what is now internal API */
-#ifdef EXPOSE_FB_HEADER
-# include "../src/libfb/fb_private.h"
-#endif
-
-typedef struct fb_internal FBIO;
-
-
-/*
- * Types of packages used for the remote frame buffer
- * communication
- */
-#define MSG_FBOPEN 1
-#define MSG_FBCLOSE 2
-#define MSG_FBCLEAR 3
-#define MSG_FBREAD 4
-#define MSG_FBWRITE 5
-#define MSG_FBCURSOR 6 /**< @brief fb_cursor() */
-#define MSG_FBWINDOW 7 /**< @brief OLD */
-#define MSG_FBZOOM 8 /**< @brief OLD */
-#define MSG_FBSCURSOR 9 /**< @brief OLD */
-#define MSG_FBVIEW 10 /**< @brief NEW */
-#define MSG_FBGETVIEW 11 /**< @brief NEW */
-#define MSG_FBRMAP 12
-#define MSG_FBWMAP 13
-#define MSG_FBHELP 14
-#define MSG_FBREADRECT 15
-#define MSG_FBWRITERECT 16
-#define MSG_FBFLUSH 17
-#define MSG_FBFREE 18
-#define MSG_FBGETCURSOR 19 /**< @brief NEW */
-#define MSG_FBPOLL 30 /**< @brief NEW */
-#define MSG_FBSETCURSOR 31 /**< @brief NEW in Release 4.4 */
-#define MSG_FBBWREADRECT 32 /**< @brief NEW in Release 4.6 */
-#define MSG_FBBWWRITERECT 33 /**< @brief NEW in Release 4.6 */
-
-#define MSG_DATA 20
-#define MSG_RETURN 21
-#define MSG_CLOSE 22
-#define MSG_ERROR 23
-
-#define MSG_NORETURN 100
-
-
-/* Framebuffer server object */
-
-#define NET_LONG_LEN 4 /**< @brief # bytes to network long */
-#define MAX_CLIENTS 32
-#define MAX_PORT_TRIES 100
-#define FBS_CALLBACK_NULL (void (*)())NULL
-#define FBSERV_OBJ_NULL (struct fbserv_obj *)NULL
-
-struct fbserv_listener {
- int fbsl_fd; /**< @brief socket to listen for
connections */
-#if defined(_WIN32) && !defined(__CYGWIN__)
- Tcl_Channel fbsl_chan;
-#endif
- int fbsl_port; /**< @brief port number to listen on */
- int fbsl_listen; /**< @brief !0 means listen for
connections */
- struct fbserv_obj *fbsl_fbsp; /**< @brief points to its fbserv
object */
-};
-
-
-struct fbserv_client {
- int fbsc_fd;
-#if defined(_WIN32) && !defined(__CYGWIN__)
- Tcl_Channel fbsc_chan;
- Tcl_FileProc *fbsc_handler;
-#endif
- struct pkg_conn *fbsc_pkg;
- struct fbserv_obj *fbsc_fbsp; /**< @brief points to its fbserv
object */
-};
-
-
-struct fbserv_obj {
- struct fb *fbs_fbp; /**< @brief framebuffer pointer
*/
- Tcl_Interp *fbs_interp; /**< @brief tcl interpreter */
- struct fbserv_listener fbs_listener; /**< @brief data for
listening */
- struct fbserv_client fbs_clients[MAX_CLIENTS]; /**< @brief connected
clients */
- void (*fbs_callback)(void *clientData); /**< @brief callback
function */
- void *fbs_clientData;
- int fbs_mode; /**< @brief 0-off, 1-underlay,
2-interlay, 3-overlay */
-};
-
-FB_EXPORT extern int fbs_open(struct fbserv_obj *fbsp, int port);
-FB_EXPORT extern int fbs_close(struct fbserv_obj *fbsp);
-
-
-
-__END_DECLS
-
-#endif /* FB_H */
-
-/** @} */
-/*
- * Local Variables:
- * mode: C
- * tab-width: 8
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Modified: brlcad/branches/dm-fb-merge/include/tclcad.h
===================================================================
--- brlcad/branches/dm-fb-merge/include/tclcad.h 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/include/tclcad.h 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -38,8 +38,6 @@
#include "dm.h"
#include "ged.h"
-#include "fb.h"
-
__BEGIN_DECLS
#ifndef TCLCAD_EXPORT
Modified: brlcad/branches/dm-fb-merge/misc/doxygen/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/misc/doxygen/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/misc/doxygen/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -41,7 +41,6 @@
libgcv
libanalyze
libged
- libfb
libdm
libtclcad
libpkg
@@ -183,7 +182,7 @@
libbrep.dox
libbu.dox
libdm.dox
- libfb.dox
+ libdm.dox
libfft.dox
libgcv.dox
libged.dox
Deleted: brlcad/branches/dm-fb-merge/misc/doxygen/libfb.dox
===================================================================
--- brlcad/branches/dm-fb-merge/misc/doxygen/libfb.dox 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/misc/doxygen/libfb.dox 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -1,2 +0,0 @@
-/** @defgroup libfb libfb (Framebuffer) */
-
Modified: brlcad/branches/dm-fb-merge/misc/pkgconfig/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/misc/pkgconfig/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/misc/pkgconfig/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -46,7 +46,7 @@
libanalyze.pc.in
libbrlcad.pc.in
libdm.pc.in
- libfb.pc.in
+ libdm.pc.in
libfft.pc.in
libgcv.pc.in
libged.pc.in
Modified: brlcad/branches/dm-fb-merge/src/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/CMakeLists.txt 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/CMakeLists.txt 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -48,7 +48,6 @@
set(level_2_dirs
libpkg
- libfb
libgcv
libanalyze
liboptical
Modified: brlcad/branches/dm-fb-merge/src/art/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/art/CMakeLists.txt 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/art/CMakeLists.txt 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -12,7 +12,7 @@
${CMAKE_THREAD_LIBS_INIT}
librt
libnmg
- libfb
+ libdm
liboptical
libicv
${M_LIBRARY}
Modified: brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/src/burst/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -1,5 +1,5 @@
set(BURST_INCLUDE_DIRS
- ${FB_INCLUDE_DIRS}
+ ${DM_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
)
@@ -26,7 +26,7 @@
)
-BRLCAD_ADDEXEC(burst "${burst_SOURCES}" "librt;libfb;${M_LIBRARY}")
+BRLCAD_ADDEXEC(burst "${burst_SOURCES}" "librt;libdm;${M_LIBRARY}")
set(burst_noinst_HEADERS
CMakeLists.txt
Modified: brlcad/branches/dm-fb-merge/src/burst/extern.h
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/extern.h 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/burst/extern.h 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <string.h>
-#include "fb.h"
+#include "dm.h"
#include "./burst.h"
#include "./trie.h"
Modified: brlcad/branches/dm-fb-merge/src/burst/fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/burst/fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -30,7 +30,7 @@
#include <signal.h>
#include "bu/str.h"
-#include "fb.h"
+#include "dm.h"
#include "./burst.h"
#include "./ascii.h"
Modified: brlcad/branches/dm-fb-merge/src/burst/glob.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/glob.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/burst/glob.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -27,7 +27,7 @@
#include <signal.h>
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "raytrace.h"
#include "./burst.h"
Modified: brlcad/branches/dm-fb-merge/src/burst/grid.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/grid.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/burst/grid.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -33,7 +33,7 @@
#include "vmath.h"
#include "bn.h"
#include "raytrace.h"
-#include "fb.h"
+#include "dm.h"
#include "bn/plot3.h"
#include "./ascii.h"
Modified: brlcad/branches/dm-fb-merge/src/burst/paint.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/burst/paint.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/burst/paint.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -29,7 +29,7 @@
#include "vmath.h"
#include "raytrace.h"
-#include "fb.h"
+#include "dm.h"
#include "./extern.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/CMakeLists.txt 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/CMakeLists.txt 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -3,7 +3,7 @@
${BU_INCLUDE_DIRS}
${BN_INCLUDE_DIRS}
${PKG_INCLUDE_DIRS}
- ${FB_INCLUDE_DIRS}
+ ${DM_INCLUDE_DIRS}
${UTAHRLE_INCLUDE_DIR}
${PNG_INCLUDE_DIRS}
)
@@ -12,41 +12,41 @@
if(MSVC)
add_definitions(-DIF_WGL)
endif(MSVC)
-BRLCAD_ADDEXEC(bw-fb bw-fb.c libfb)
-BRLCAD_ADDEXEC(fb-bw fb-bw.c libfb)
-BRLCAD_ADDEXEC(fb-fb fb-fb.c libfb)
-BRLCAD_ADDEXEC(fb-pix "fb-pix.c;cmap-crunch.c" libfb)
-BRLCAD_ADDEXEC(fb-png "fb-png.c;cmap-crunch.c" "libfb;${PNG_LIBRARIES}")
-BRLCAD_ADDEXEC(fbcbars fbcbars.c libfb)
-BRLCAD_ADDEXEC(fbclear fbclear.c libfb)
-BRLCAD_ADDEXEC(fbcmap fbcmap.c libfb)
+BRLCAD_ADDEXEC(bw-fb bw-fb.c libdm)
+BRLCAD_ADDEXEC(fb-bw fb-bw.c libdm)
+BRLCAD_ADDEXEC(fb-fb fb-fb.c libdm)
+BRLCAD_ADDEXEC(fb-pix "fb-pix.c;cmap-crunch.c" libdm)
+BRLCAD_ADDEXEC(fb-png "fb-png.c;cmap-crunch.c" "libdm;${PNG_LIBRARIES}")
+BRLCAD_ADDEXEC(fbcbars fbcbars.c libdm)
+BRLCAD_ADDEXEC(fbclear fbclear.c libdm)
+BRLCAD_ADDEXEC(fbcmap fbcmap.c libdm)
if(TARGET libtermio)
- BRLCAD_ADDEXEC(fbcolor fbcolor.c "libfb;libtermio")
+ BRLCAD_ADDEXEC(fbcolor fbcolor.c "libdm;libtermio")
endif(TARGET libtermio)
-BRLCAD_ADDEXEC(fbfade "fbfade.c;ioutil.c" libfb)
-BRLCAD_ADDEXEC(fbframe fbframe.c libfb)
-BRLCAD_ADDEXEC(fbfree fbfree.c libfb)
-BRLCAD_ADDEXEC(fbgamma fbgamma.c "libfb;${M_LIBRARY}")
-BRLCAD_ADDEXEC(fbgrid fbgrid.c libfb)
-BRLCAD_ADDEXEC(fbhelp fbhelp.c libfb)
-BRLCAD_ADDEXEC(fblabel fblabel.c libfb)
-BRLCAD_ADDEXEC(fbline fbline.c libfb)
+BRLCAD_ADDEXEC(fbfade "fbfade.c;ioutil.c" libdm)
+BRLCAD_ADDEXEC(fbframe fbframe.c libdm)
+BRLCAD_ADDEXEC(fbfree fbfree.c libdm)
+BRLCAD_ADDEXEC(fbgamma fbgamma.c "libdm;${M_LIBRARY}")
+BRLCAD_ADDEXEC(fbgrid fbgrid.c libdm)
+BRLCAD_ADDEXEC(fbhelp fbhelp.c libdm)
+BRLCAD_ADDEXEC(fblabel fblabel.c libdm)
+BRLCAD_ADDEXEC(fbline fbline.c libdm)
if(TARGET libtermio)
- BRLCAD_ADDEXEC(fbpoint fbpoint.c "libfb;libbu;libtermio;libpkg")
+ BRLCAD_ADDEXEC(fbpoint fbpoint.c "libdm;libbu;libtermio;libpkg")
endif(TARGET libtermio)
-BRLCAD_ADDEXEC(fbstretch "fbstretch.c;ioutil.c" libfb)
+BRLCAD_ADDEXEC(fbstretch "fbstretch.c;ioutil.c" libdm)
if(TARGET libtermio)
- BRLCAD_ADDEXEC(fbzoom fbzoom.c "libfb;libtermio")
+ BRLCAD_ADDEXEC(fbzoom fbzoom.c "libdm;libtermio")
endif(TARGET libtermio)
-BRLCAD_ADDEXEC(gif-fb "gif-fb.c;ioutil.c" libfb)
-BRLCAD_ADDEXEC(gif2fb gif2fb.c libfb)
-BRLCAD_ADDEXEC(pix-fb pix-fb.c libfb)
-BRLCAD_ADDEXEC(pixautosize pixautosize.c libfb)
-BRLCAD_ADDEXEC(plot3-fb plot3-fb.c libfb)
-BRLCAD_ADDEXEC(png-fb png-fb.c "libfb;${PNG_LIBRARIES}")
+BRLCAD_ADDEXEC(gif-fb "gif-fb.c;ioutil.c" libdm)
+BRLCAD_ADDEXEC(gif2fb gif2fb.c libdm)
+BRLCAD_ADDEXEC(pix-fb pix-fb.c libdm)
+BRLCAD_ADDEXEC(pixautosize pixautosize.c libdm)
+BRLCAD_ADDEXEC(plot3-fb plot3-fb.c libdm)
+BRLCAD_ADDEXEC(png-fb png-fb.c "libdm;${PNG_LIBRARIES}")
-BRLCAD_ADDEXEC(spm-fb spm-fb.c "libfb;libbn")
+BRLCAD_ADDEXEC(spm-fb spm-fb.c "libdm;libbn")
add_subdirectory(tests)
Modified: brlcad/branches/dm-fb-merge/src/fb/bw-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/bw-fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/bw-fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -43,7 +43,7 @@
#include "bu/exit.h"
#include "bu/log.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
int skipbytes(int fd, b_off_t num);
Modified: brlcad/branches/dm-fb-merge/src/fb/cmap-crunch.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/cmap-crunch.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/cmap-crunch.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -29,7 +29,7 @@
#include <stdio.h>
#include "bu/color.h"
-#include "fb.h"
+#include "dm.h"
void
cmap_crunch(RGBpixel (*scan_buf), int pixel_ct, ColorMap *cmap)
Modified: brlcad/branches/dm-fb-merge/src/fb/fb-bw.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fb-bw.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fb-bw.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -33,7 +33,7 @@
#include "bu/getopt.h"
#include "bu/exit.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#define LINELEN 8192
Modified: brlcad/branches/dm-fb-merge/src/fb/fb-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fb-fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fb-fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -31,7 +31,7 @@
#include "bu/getopt.h"
#include "bu/log.h"
-#include "fb.h"
+#include "dm.h"
static int verbose;
Modified: brlcad/branches/dm-fb-merge/src/fb/fb-pix.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fb-pix.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fb-pix.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -33,7 +33,7 @@
#include "bu/getopt.h"
#include "bu/exit.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fb-png.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fb-png.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fb-png.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -36,7 +36,7 @@
#include "bu/log.h"
#include "bu/malloc.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbcbars.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbcbars.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbcbars.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -65,7 +65,7 @@
#include "bu/color.h"
#include "bu/getopt.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
#define MAX_LINE (8*1024) /* Max pixels/line */
Modified: brlcad/branches/dm-fb-merge/src/fb/fbclear.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbclear.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbclear.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -32,7 +32,7 @@
#include "bu/color.h"
#include "bu/getopt.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
#ifdef HAVE_WINSOCK_H
Modified: brlcad/branches/dm-fb-merge/src/fb/fbcmap.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbcmap.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbcmap.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -33,7 +33,7 @@
#include "bu/getopt.h"
#include "bu/log.h"
#include "bu/snooze.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbcolor.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbcolor.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbcolor.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -33,7 +33,7 @@
#include "bu/color.h"
#include "bu/getopt.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
#include "libtermio.h"
#define COMMA ','
Modified: brlcad/branches/dm-fb-merge/src/fb/fbfade.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbfade.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbfade.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -61,7 +61,7 @@
#include "bu/getopt.h"
#include "vmath.h"
-#include "fb.h" /* BRL-CAD package libfb.a interface */
+#include "dm.h" /* BRL-CAD package libfb.a interface */
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbframe.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbframe.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbframe.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -32,7 +32,7 @@
#include "bu/color.h"
#include "bu/getopt.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
char *Usage="[-F framebuffer] [-s|S squareframesize] [-w|W frame_width] [-n|N
frame_height]\n";
Modified: brlcad/branches/dm-fb-merge/src/fb/fbfree.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbfree.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbfree.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include "bu/getopt.h"
-#include "fb.h"
+#include "dm.h"
static char *framebuffer = NULL;
Modified: brlcad/branches/dm-fb-merge/src/fb/fbgamma.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbgamma.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbgamma.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -33,7 +33,7 @@
#include "bu/malloc.h"
#include "bu/getopt.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
char *options = "iHoF:h?";
Modified: brlcad/branches/dm-fb-merge/src/fb/fbgrid.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbgrid.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbgrid.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -29,7 +29,7 @@
#include "bu/color.h"
#include "bu/getopt.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
static unsigned char *white_line, *grey_line, *dark_line;
Modified: brlcad/branches/dm-fb-merge/src/fb/fbhelp.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbhelp.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbhelp.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -21,7 +21,7 @@
/** @file fbhelp.c
*
* Print out info about the selected frame buffer.
- * Just calls fb_help().
+ * Just calls dm.help().
*
*/
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include "bu/getopt.h"
-#include "fb.h"
+#include "dm.h"
static char *framebuffer = NULL;
Modified: brlcad/branches/dm-fb-merge/src/fb/fblabel.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fblabel.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fblabel.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -35,7 +35,7 @@
#include "bu/getopt.h"
#include "bu/exit.h"
#include "bu/vfont.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbline.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbline.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbline.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -35,7 +35,7 @@
#include "bu/getopt.h"
#include "bu/exit.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbpoint.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbpoint.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbpoint.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -34,7 +34,7 @@
#include "bu/exit.h"
#include "bu/getopt.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "libtermio.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbstretch.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbstretch.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbstretch.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -82,7 +82,7 @@
#include "bu/getopt.h"
#include "bu/log.h"
#include "bu/str.h"
-#include "fb.h" /* BRL-CAD package libfb.a interface */
+#include "dm.h" /* BRL-CAD package libfb.a interface */
#define USAGE1 "fbstretch [ -s size ] [ -w width ] [ -n height ]"
Modified: brlcad/branches/dm-fb-merge/src/fb/fbzoom.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/fbzoom.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/fbzoom.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -33,7 +33,7 @@
#include "bu/log.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "libtermio.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/gif-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/gif-fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/gif-fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -78,7 +78,7 @@
#include "bu/str.h"
#include "bu/exit.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#define USAGE "Usage: gif-fb [-F fb_file] [-c] [-i image#] [-o] [-v] [-z]
[gif_file]\n (stdin used with '<' construct if gif_file not supplied)"
Modified: brlcad/branches/dm-fb-merge/src/fb/gif2fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/gif2fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/gif2fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -45,7 +45,7 @@
#include "bu/getopt.h"
#include "bu/exit.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#define LSB 0 /* Least Significant Byte */
Modified: brlcad/branches/dm-fb-merge/src/fb/ioutil.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/ioutil.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/ioutil.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -33,7 +33,7 @@
#include "bu/log.h"
#include "bu/malloc.h"
#include "bu/path.h"
-#include "fb.h"
+#include "dm.h"
HIDDEN void
Modified: brlcad/branches/dm-fb-merge/src/fb/pix-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/pix-fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/pix-fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -44,7 +44,7 @@
#include "bu/log.h"
#include "bu/snooze.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/pixautosize.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/pixautosize.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/pixautosize.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -34,7 +34,7 @@
#include "vmath.h"
#include "bu/getopt.h"
#include "bn.h"
-#include "fb.h"
+#include "dm.h"
static int bytes_per_sample = 3;
Modified: brlcad/branches/dm-fb-merge/src/fb/plot3-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/plot3-fb.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/plot3-fb.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -82,7 +82,7 @@
#include "bu/getopt.h"
#include "bu/process.h"
#include "bu/exit.h"
-#include "fb.h"
+#include "dm.h"
#include "bn/plot3.h"
#define COMMA ','
Modified: brlcad/branches/dm-fb-merge/src/fb/png-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/png-fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/png-fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -33,7 +33,7 @@
#include "bu/log.h"
#include "bu/malloc.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/spm-fb.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/spm-fb.c 2020-04-16 01:41:42 UTC (rev
75425)
+++ brlcad/branches/dm-fb-merge/src/fb/spm-fb.c 2020-04-16 02:48:48 UTC (rev
75426)
@@ -29,7 +29,7 @@
#include "bu/exit.h"
#include "bu/getopt.h"
-#include "fb.h"
+#include "dm.h"
#include "bn/spm.h"
Modified: brlcad/branches/dm-fb-merge/src/fb/tests/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/tests/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/tests/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -1,5 +1,5 @@
if(BRLCAD_ENABLE_TK)
- BRLCAD_ADDEXEC(fbthreadtest fbthreadtest.c
"libfb;${TCL_LIBRARY};${TK_LIBRARY}" NO_INSTALL)
+ BRLCAD_ADDEXEC(fbthreadtest fbthreadtest.c
"libdm;${TCL_LIBRARY};${TK_LIBRARY}" NO_INSTALL)
SET_TARGET_PROPERTIES(fbthreadtest PROPERTIES COMPILE_DEFINITIONS "IF_TK")
SET_TARGET_PROPERTIES(fbthreadtest PROPERTIES LINKER_LANGUAGE C)
else(BRLCAD_ENABLE_TK)
Modified: brlcad/branches/dm-fb-merge/src/fb/tests/fbthreadtest.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fb/tests/fbthreadtest.c 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fb/tests/fbthreadtest.c 2020-04-16
02:48:48 UTC (rev 75426)
@@ -18,7 +18,7 @@
* information.
*
*/
-/** @file fbthreadtest.c
+/** @file dm.hreadtest.c
*
* Throwaway program to test ideas about Tcl/Tk threading and framebuffer
* display.
@@ -39,7 +39,7 @@
#endif
#include "bu/getopt.h"
-#include "fb.h"
+#include "dm.h"
#include <tcl.h>
#include <tk.h>
Modified: brlcad/branches/dm-fb-merge/src/fbserv/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/fbserv/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fbserv/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -1,8 +1,8 @@
include_directories(
- ${FB_INCLUDE_DIRS}
+ ${DM_INCLUDE_DIRS}
)
-BRLCAD_ADDEXEC(fbserv "fbserv.c;server.c" libfb)
+BRLCAD_ADDEXEC(fbserv "fbserv.c;server.c" libdm)
CMAKEFILES(CMakeLists.txt)
Modified: brlcad/branches/dm-fb-merge/src/fbserv/fbserv.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fbserv/fbserv.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fbserv/fbserv.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -76,7 +76,7 @@
#include "bsocket.h"
#include "bio.h"
-#include "../libfb/fb_private.h" /* for _fb_disk_enable */
+#include "../libdm/fb_private.h" /* for _fb_disk_enable */
#include "bu/malloc.h"
#include "bu/getopt.h"
@@ -83,7 +83,7 @@
#include "bu/exit.h"
#include "bu/snooze.h"
#include "vmath.h"
-#include "fb.h"
+#include "dm.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/fbserv/server.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/fbserv/server.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/fbserv/server.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -37,7 +37,7 @@
#include "bu/color.h"
#include "bu/log.h"
-#include "fb.h"
+#include "dm.h"
#include "vmath.h"
#include "pkg.h"
Modified: brlcad/branches/dm-fb-merge/src/halftone/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/halftone/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/src/halftone/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -1,5 +1,5 @@
set(HALFTONE_INCLUDE_DIRS
- ${FB_INCLUDE_DIRS}
+ ${DM_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
)
LIST(REMOVE_DUPLICATES HALFTONE_INCLUDE_DIRS)
@@ -15,7 +15,7 @@
tonescale.c
)
-BRLCAD_ADDEXEC(halftone "${halftone_SOURCES}" "librt;libfb")
+BRLCAD_ADDEXEC(halftone "${halftone_SOURCES}" "librt;libdm")
CMAKEFILES(CMakeLists.txt)
Modified: brlcad/branches/dm-fb-merge/src/halftone/main.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/halftone/main.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/halftone/main.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -71,7 +71,7 @@
#include "bu/getopt.h"
#include "vmath.h"
#include "raytrace.h"
-#include "fb.h"
+#include "dm.h"
long int width=512; /* width of picture */
Modified: brlcad/branches/dm-fb-merge/src/libdm/CMakeLists.txt
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/CMakeLists.txt 2020-04-16
01:41:42 UTC (rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/CMakeLists.txt 2020-04-16
02:48:48 UTC (rev 75426)
@@ -5,12 +5,12 @@
${BU_INCLUDE_DIRS}
${BN_INCLUDE_DIRS}
${RT_INCLUDE_DIRS}
- ${FB_INCLUDE_DIRS}
${X11_INCLUDE_DIR}
${OPENGL_INCLUDE_DIR_GL}
${OPENGL_INCLUDE_DIR_GLX}
${TCL_INCLUDE_PATH}
${TK_INCLUDE_PATH}
+ ${OPENNURBS_INCLUDE_DIRS}
${Qt5Widgets_INCLUDE_DIRS}
${OPENTHREADS_INCLUDE_DIR}
${OSG_INCLUDE_DIR}
@@ -29,8 +29,10 @@
# Add the individual OS specific files and definitions
if(WIN32 AND BRLCAD_ENABLE_OPENGL)
list(APPEND libdm_DEFINES DM_WGL IF_WGL)
- set(dmw32_srcs dm-wgl.c)
+ set(dmw32_srcs dm-wgl.c if_wgl.c)
+ set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${OPENGL_LIBRARIES})
set_property(SOURCE dm-wgl.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
+ set_property(SOURCE if_wgl.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
endif(WIN32 AND BRLCAD_ENABLE_OPENGL)
if(BRLCAD_ENABLE_X11)
@@ -39,21 +41,26 @@
if(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK)
list(APPEND libdm_DEFINES DM_X IF_X)
- set(dmx11_srcs dm-X.c)
+ set(dmx11_srcs dm-X.c if_X24.c)
+ set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${X11_LIBRARIES})
set_property(SOURCE dm-X.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
+ set_property(SOURCE if_X24.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_TK)
if(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
list(APPEND libdm_DEFINES DM_OGL IF_OGL)
- set(dmogl_srcs dm-ogl.c)
+ set(dmogl_srcs dm-ogl.c if_ogl.c)
+ set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${OPENGL_LIBRARIES})
set_property(SOURCE dm-ogl.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
+ set_property(SOURCE if_ogl.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
endif(BRLCAD_ENABLE_X11 AND BRLCAD_ENABLE_OPENGL AND BRLCAD_ENABLE_TK)
if(BRLCAD_ENABLE_TK AND NOT WIN32)
list(APPEND libdm_DEFINES DM_TK IF_TK)
- set(DM_TKLIB ${TCL_LIBRARY} ${TK_LIBRARY})
- set(dmtk_srcs dm-tk.c)
+ set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${TCL_LIBRARY} ${TK_LIBRARY})
+ set(dmtk_srcs dm-tk.c if_tk.c)
set_property(SOURCE dm-tk.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
+ set_property(SOURCE if_tk.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
endif(BRLCAD_ENABLE_TK AND NOT WIN32)
if(BRLCAD_ENABLE_QT)
@@ -60,8 +67,9 @@
CHECK_CXX_FLAG(Wno-float-equal)
list(APPEND libdm_DEFINES DM_QT IF_QT)
- set(dmqt_srcs dm-qt.cpp)
+ set(dmqt_srcs dm-qt.cpp if_qt.cpp)
set_property(SOURCE dm-qt.cpp APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
+ set_property(SOURCE if_qt.cpp APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
add_definitions(${Qt5Widgets_DEFINITIONS})
@@ -68,11 +76,17 @@
set(DM_EXTRA_LIBS ${DM_EXTRA_LIBS} ${Qt5Widgets_LIBRARIES})
endif(BRLCAD_ENABLE_QT)
+add_definitions(
+ -DIF_REMOTE
+ -DIF_AB
+ )
if(BRLCAD_ENABLE_OSG AND BRLCAD_ENABLE_TK)
list(APPEND libdm_DEFINES DM_OSGL IF_OSGL)
- set(dmosg_srcs dm-osgl.cpp)
+ set(dmosg_srcs dm-osgl.cpp if_osgl.cpp)
set_property(SOURCE dm-osgl.cpp APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
+ set_property(SOURCE if_osgl.cpp APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
set(OSG_LIBRARIES
+ ${OPENGL_LIBRARIES}
${OSG_LIBRARY}
${OSGTEXT_LIBRARY}
${OSGVIEWER_LIBRARY}
@@ -108,11 +122,27 @@
query.c
rect.c
scale.c
+
+ asize.c
+ fb_generic.c
+ fb_log.c
+ fb_obj.c
+ fb_paged_io.c
+ fb_rect.c
+ fb_util.c
+ fbserv_obj.c
+ if_debug.c
+ if_disk.c
+ if_mem.c
+ if_null.c
+ if_remote.c
+ if_stack.c
+
tcl.c
vers.c
)
set_property(SOURCE dm_obj.c APPEND PROPERTY COMPILE_DEFINITIONS
FB_USE_INTERNAL_API)
-BRLCAD_ADDLIB(libdm "${LIBDM_SRCS}"
"librt;libfb;${DM_X_LIBS};${DM_TKLIB};${DM_EXTRA_LIBS};${PNG_LIBRARIES}")
+BRLCAD_ADDLIB(libdm "${LIBDM_SRCS}"
"librt;libbu;libpkg;${DM_EXTRA_LIBS};${PNG_LIBRARIES}")
set_target_properties(libdm PROPERTIES VERSION 20.0.1 SOVERSION 20)
if(BRLCAD_ENABLE_OSG)
@@ -122,12 +152,13 @@
endif(CPP_DLL_DEFINES)
endif(BRLCAD_ENABLE_OSG)
-if(BRLCAD_BUILD_LOCAL_TK AND BRLCAD_ENABLE_TK)
+if (TARGET tk)
add_dependencies(libdm tk)
-endif(BRLCAD_BUILD_LOCAL_TK AND BRLCAD_ENABLE_TK)
-if(BRLCAD_ENABLE_OSG)
+endif (TARGET tk)
+if (TARGET profont_ProFont_ttf_cp)
add_dependencies(libdm profont_ProFont_ttf_cp)
-endif(BRLCAD_ENABLE_OSG)
+endif (TARGET profont_ProFont_ttf_cp)
+
set(libdm_ignore_files
CMakeLists.txt
README
@@ -150,6 +181,15 @@
dm-wgl.h
dm_private.h
dm_xvars.h
+ if_TEMPLATE.c
+ if_X24.c
+ if_ogl.c
+ if_osgl.cpp
+ if_qt.cpp
+ if_tk.c
+ if_wgl.c
+ fb_private.h
+ osg_fb_manipulator.h
fontstash/LICENSE.fontstash
fontstash/README.md
fontstash/fontstash.h
Copied: brlcad/branches/dm-fb-merge/src/libdm/asize.c (from rev 75425,
brlcad/branches/dm-fb-merge/src/libfb/asize.c)
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/asize.c
(rev 0)
+++ brlcad/branches/dm-fb-merge/src/libdm/asize.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -0,0 +1,215 @@
+/* A S I Z E . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2004-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @addtogroup libstruct fb */
+/** @{ */
+/** @file ./libfb/asize.c
+ *
+ * Image file AutoSizing code.
+ *
+ */
+/** @} */
+
+#include "common.h"
+
+#include <stdio.h>
+#include <math.h>
+#include <sys/stat.h>
+#include <string.h>
+
+#include "dm.h"
+
+
+/* This table does not need to include any square sizes */
+struct sizes {
+ size_t width; /* image width in pixels */
+ size_t height; /* image height in pixels */
+};
+struct sizes fb_common_sizes[] = {
+ { 160, 120 }, /* quarter 640x480 */
+ { 192, 128 }, /* Kodak Photo-CD, level 1, Base/16 */
+ { 320, 200 }, /* PC screen format */
+ { 320, 240 }, /* half 640x480 */
+ { 384, 256 }, /* Kodak Photo-CD, level 2, Base/4 */
+ { 640, 512 }, /* half 1280x1024 */
+ { 640, 400 }, /* PC screen format */
+ { 640, 480 }, /* Common video format */
+ { 640, 485 }, /* Common video format, most correct */
+ { 640, 486 }, /* Common video format */
+ { 720, 485 }, /* Abekas video format, most correct */
+ { 720, 486 }, /* Abekas video format */
+ { 768, 512 }, /* Kodak Photo-CD, level 3, Base */
+ { 1024, 768 }, /* SGI-3D screen size */
+ { 1152, 900 }, /* Sun screen size */
+ { 1280, 960 }, /* twice 640x480 */
+ { 1280, 1024 }, /* SGI-4D screen size */
+ { 1440, 972 }, /* double Abekas video format */
+ { 1536, 1024 }, /* Kodak Photo-CD, level 4, 4*Base */
+ { 1600, 1200 }, /* Digital camera */
+ { 1600, 1280 }, /* Large monitor */
+ { 3072, 2048 }, /* Kodak Photo-CD, level 5, 16*Base */
+ { 3200, 4000 }, /* 8x10 inches, 400 dpi */
+ { 3400, 4400 }, /* 8.5x11 inches, 400 dpi */
+ { 4700, 3300 }, /* A4 size, 11.75x8.25 inches, 400 dpi */
+ { 0, 0 }
+};
+
+
+/*
+ * If the file name contains size information encoded in it,
+ * then that size is returned, even if it differs from the actual
+ * file dimensions. (It might have been truncated).
+ * Otherwise, the actual file size is passed to fb_common_image_size()
+ * to see if this is a plausible image size.
+ *
+ * Returns -
+ * 0 size unknown
+ * 1 width and height returned
+ */
+int
+fb_common_file_size(size_t *widthp, size_t *heightp, const char *filename, int
pixel_size)
+/* pointer to returned width */
+/* pointer to returned height */
+/* image file to stat */
+/* bytes per pixel */
+{
+ struct stat sbuf;
+ size_t size;
+ register const char *cp;
+
+ *widthp = *heightp = 0; /* sanity */
+
+ if (pixel_size <= 0) {
+ return 0;
+ }
+
+ if (filename == NULL || *filename == '\0') {
+ return 0;
+ }
+
+ /* Skip over directory names, if any */
+ cp = strchr(filename, '/');
+ if (cp) {
+ cp++; /* skip over slash */
+ } else {
+ cp = filename; /* no slash */
+ }
+
+ if (fb_common_name_size(widthp, heightp, cp))
+ return 1;
+
+ if (stat(filename, &sbuf) < 0)
+ return 0;
+
+ size = (size_t)(sbuf.st_size / pixel_size);
+
+ return fb_common_image_size(widthp, heightp, size);
+}
+
+
+/*
+ * Given the number of pixels in an image file, along with a name for the
+ * image (possibly the filename), attempt to determine the
+ * the width and height of the image.
+ *
+ * Returns -
+ * 0 size unknown
+ * 1 width and height returned
+ */
+
+int
+fb_common_name_size(size_t *widthp, size_t *heightp, const char *name)
+/* pointer to returned width */
+/* pointer to returned height */
+/* name to parse */
+{
+ register const char *cp = name;
+ unsigned long w;
+ unsigned long h;
+
+ /* File name may have several minus signs in it. Try repeatedly */
+ while (*cp) {
+ cp = strchr(cp, '-'); /* Find a minus sign */
+ if (cp == NULL) break;
+ if (sscanf(cp, "-w%lu-n%lu", &w, &h) == 2) {
+ *widthp = w;
+ *heightp = h;
+ return 1;
+ }
+ cp++; /* skip over the minus */
+ }
+
+ /* If we got here, we didn't see the answer in the name. */
+ return 0;
+}
+
+
+/*
+ * Given the number of pixels in an image file,
+ * if this is a "common" image size,
+ * return the width and height of the image.
+ *
+ * Returns -
+ * 0 size unknown
+ * 1 width and height returned
+ */
+int
+fb_common_image_size(size_t *widthp, size_t *heightp, size_t npixels)
+/* pointer to returned width */
+/* pointer to returned height */
+/* Number of pixels */
+{
+ struct sizes *sp;
+ size_t root;
+
+ if (npixels <= 0)
+ return 0;
+
+ sp = fb_common_sizes;
+ while (sp->width != 0) {
+ if (npixels == sp->width * sp->height) {
+ *widthp = sp->width;
+ *heightp = sp->height;
+ return 1;
+ }
+ sp++;
+ }
+
+ /* If the size is a perfect square, then use that. */
+ root = (size_t)(sqrt((double)npixels)+0.999);
+ if (root*root == npixels) {
+ *widthp = root;
+ *heightp = root;
+ return 1;
+ }
+
+ /* Nope, we are clueless. */
+ return 0;
+}
+
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm-X.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm-X.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm-X.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -62,8 +62,8 @@
#include "dm-X.h"
#include "dm-Null.h"
#include "./dm_xvars.h"
-#include "fb.h"
-#include "fb/fb_X.h"
+#include "dm.h"
+#include "./fb_X.h"
#include "rt/solid.h"
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm-ogl.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm-ogl.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm-ogl.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -79,8 +79,8 @@
#include "dm-ogl.h"
#include "dm-Null.h"
#include "./dm_xvars.h"
-#include "fb.h"
-#include "fb/fb_ogl.h"
+#include "dm.h"
+#include "./fb_ogl.h"
#include "rt/solid.h"
#include "./dm_private.h"
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm-osgl.cpp
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm-osgl.cpp 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm-osgl.cpp 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -54,11 +54,11 @@
#include "dm.h"
#include "dm-Null.h"
#include "./dm_xvars.h"
-#include "fb.h"
+#include "dm.h"
#include "rt/solid.h"
#include "./dm_private.h"
-#include "fb/fb_osgl.h"
+#include "./fb_osgl.h"
#include "dm-osgl.h"
/* For Tk, we need to offset when thinking about screen size in
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm-qt.cpp
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm-qt.cpp 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm-qt.cpp 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -40,7 +40,7 @@
#include "dm_private.h"
#include "./dm_xvars.h"
#include "dm-Null.h"
-#include "fb/fb_qt.h"
+#include "./fb_qt.h"
#define DM_QT_DEFAULT_POINT_SIZE 1.0
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm-wgl.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm-wgl.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm-wgl.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -45,8 +45,8 @@
#include "dm-Null.h"
#include "dm-wgl.h"
#include "./dm_xvars.h"
-#include "fb.h"
-#include "fb/fb_wgl.h"
+#include "dm.h"
+#include "./fb_wgl.h"
#include "rt/solid.h"
#include "./dm_private.h"
Modified: brlcad/branches/dm-fb-merge/src/libdm/dm_obj.c
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/dm_obj.c 2020-04-16 01:41:42 UTC
(rev 75425)
+++ brlcad/branches/dm-fb-merge/src/libdm/dm_obj.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -70,7 +70,7 @@
#endif /* DM_WGL */
#ifdef USE_FBSERV
-# include "fb.h"
+# include "dm.h"
#endif
/**
Copied: brlcad/branches/dm-fb-merge/src/libdm/fb_X.h (from rev 75425,
brlcad/branches/dm-fb-merge/include/fb/fb_X.h)
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/fb_X.h
(rev 0)
+++ brlcad/branches/dm-fb-merge/src/libdm/fb_X.h 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -0,0 +1,56 @@
+/* F B _ X . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2014-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @addtogroup libfb */
+/** @{*/
+/** @file fb_X.h
+ *
+ * Structure holding information necessary for embedding a
+ * framebuffer in an X11 parent window. This is NOT public API
+ * for libfb, and is not guaranteed to be stable from one
+ * release to the next.
+ *
+ */
+/** @} */
+
+#ifdef FB_USE_INTERNAL_API
+#ifdef IF_X
+#include "common.h"
+#include <X11/X.h>
+
+struct X24_fb_info {
+ Display *dpy;
+ Window win;
+ Window cwinp;
+ Colormap cmap;
+ XVisualInfo *vip;
+ GC gc;
+};
+#endif /* IF_X */
+#endif /* FB_USE_INTERNAL_API */
+
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/dm-fb-merge/src/libdm/fb_generic.c (from rev 75425,
brlcad/branches/dm-fb-merge/src/libfb/fb_generic.c)
===================================================================
--- brlcad/branches/dm-fb-merge/src/libdm/fb_generic.c
(rev 0)
+++ brlcad/branches/dm-fb-merge/src/libdm/fb_generic.c 2020-04-16 02:48:48 UTC
(rev 75426)
@@ -0,0 +1,1131 @@
+/* F B _ G E N E R I C . C
+ * BRL-CAD
+ *
+ * Copyright (c) 1986-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+
+/** \defgroup fb Framebuffer
+ * \ingroup libstruct fb */
+/** @{ */
+/** @file fb_generic.c
+ *
+ * The main table where framebuffers are initialized and prioritized
+ * for run-time access.
+ *
+ */
+/** @} */
+
+#include "common.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include "png.h"
+
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+
+#include "bsocket.h"
+#include "bio.h"
+
+#include "bu/color.h"
+#include "bu/malloc.h"
+#include "bu/str.h"
+#include "bu/log.h"
+#include "bu/exit.h"
+
+#include "vmath.h"
+#include "fb_private.h"
+#include "dm.h"
+
+/**
+ * First element of list is default device when no name given
+ */
+static
+struct fb *_if_list[] = {
+#ifdef IF_OSGL
+ &osgl_interface,
+#endif
+#ifdef IF_WGL
+ &wgl_interface,
+#endif
+#ifdef IF_OGL
+ &ogl_interface,
+#endif
+#ifdef IF_X
+ &X24_interface,
+#endif
+#ifdef IF_TK
+ &tk_interface,
+#endif
+#ifdef IF_QT
+ &qt_interface,
+#endif
+ &debug_interface,
+/* never get any of the following by default */
+ &stk_interface,
+ &memory_interface,
+ &fb_null_interface,
+ (struct fb *) 0
+};
+
+struct fb *fb_get()
+{
+ struct fb *new_fb = FB_NULL;
+ BU_GET(new_fb, struct fb);
+ BU_GET(new_fb->i, struct fb_impl);
+ new_fb->i->if_name = NULL;
+ return new_fb;
+}
+
+void fb_put(struct fb *ifp)
+{
+ if (ifp != FB_NULL) {
+ BU_PUT(ifp->i, struct fb_impl);
+ BU_PUT(ifp, struct fb);
+ }
+}
+
+void fb_set_interface(struct fb *ifp, const char *interface_type)
+{
+ int i = 0;
+ if (!ifp) return;
+ while (_if_list[i] != FB_NULL) {
+ if (bu_strncmp(interface_type, _if_list[i]->i->if_name+5,
strlen(interface_type)) == 0) {
+ /* found it, copy its struct in */
+ *ifp = *(_if_list[i]);
+ return;
+ } else {
+ i++;
+ }
+ }
+}
+
+struct fb_platform_specific *
+fb_get_platform_specific(uint32_t magic)
+{
+ int i = 0;
+ if (!magic) return NULL;
+ while (_if_list[i] != FB_NULL) {
+ if (magic == _if_list[i]->i->type_magic) {
+ /* found it, get its specific struct */
+ return (*(_if_list[i])).i->if_existing_get(magic);
+ } else {
+ i++;
+ }
+ }
+ return NULL;
+}
+
+void
+fb_put_platform_specific(struct fb_platform_specific *fb_p)
+{
+ int i = 0;
+ if (!fb_p) return;
+ while (_if_list[i] != FB_NULL) {
+ if (fb_p->magic == _if_list[i]->i->type_magic) {
+ /* found it, clear its specific struct */
+ (*(_if_list[i])).i->if_existing_put(fb_p);
+ return;
+ } else {
+ i++;
+ }
+ }
+ return;
+}
+
+struct fb *
+fb_open_existing(const char *file, int width, int height, struct
fb_platform_specific *fb_p)
+{
+ struct fb *ifp = (struct fb *)calloc(sizeof(struct fb), 1);
+ if (!ifp) return NULL;
+ fb_set_interface(ifp, file);
+ fb_set_magic(ifp, FB_MAGIC);
+ if (ifp->i->if_open_existing) ifp->i->if_open_existing(ifp, width, height,
fb_p);
+ return ifp;
+}
+
+int
+fb_refresh(struct fb *ifp, int x, int y, int w, int h)
+{
+ return ifp->i->if_refresh(ifp, x, y, w, h);
+}
+
+int
+fb_configure_window(struct fb *ifp, int width, int height)
+{
+ /* unknown/unset framebuffer */
+ if (!ifp || !ifp->i->if_configure_window || width < 0 || height < 0) {
+ return 0;
+ }
+ return ifp->i->if_configure_window(ifp, width, height);
+}
+
+void fb_set_name(struct fb *ifp, const char *name)
+{
+ if (!ifp) return;
+ ifp->i->if_name = (char *)bu_malloc((unsigned)strlen(name)+1, "if_name");
+ bu_strlcpy(ifp->i->if_name, name, strlen(name)+1);
+}
+
+char *fb_get_name(struct fb *ifp)
+{
+ if (!ifp) return NULL;
+ return ifp->i->if_name;
+}
+
+long fb_get_pagebuffer_pixel_size(struct fb *ifp)
+{
+ if (!ifp) return 0;
+ return ifp->i->if_ppixels;
+}
+
+int fb_is_set_fd(struct fb *ifp, fd_set *infds)
+{
+ if (!ifp) return 0;
+ if (!infds) return 0;
+ if (!ifp->i->if_selfd) return 0;
+ if (ifp->i->if_selfd <= 0) return 0;
+ return FD_ISSET(ifp->i->if_selfd, infds);
+}
+
+int fb_set_fd(struct fb *ifp, fd_set *select_list)
+{
+ if (!ifp) return 0;
+ if (!select_list) return 0;
+ if (!ifp->i->if_selfd) return 0;
+ if (ifp->i->if_selfd <= 0) return 0;
+ FD_SET(ifp->i->if_selfd, select_list);
+ return ifp->i->if_selfd;
+}
+
+int fb_clear_fd(struct fb *ifp, fd_set *list)
+{
+ if (!ifp) return 0;
+ if (!list) return 0;
+ if (!ifp->i->if_selfd) return 0;
+ if (ifp->i->if_selfd <= 0) return 0;
+ FD_CLR(ifp->i->if_selfd, list);
+ return ifp->i->if_selfd;
+}
+
+void fb_set_magic(struct fb *ifp, uint32_t magic)
+{
+ if (!ifp) return;
+ ifp->i->if_magic = magic;
+}
+
+
+char *fb_gettype(struct fb *ifp)
+{
+ return ifp->i->if_type;
+}
+
+int fb_getwidth(struct fb *ifp)
+{
+ return ifp->i->if_width;
+}
+int fb_getheight(struct fb *ifp)
+{
+ return ifp->i->if_height;
+}
+
+int fb_get_max_width(struct fb *ifp)
+{
+ return ifp->i->if_max_width;
+}
+int fb_get_max_height(struct fb *ifp)
+{
+ return ifp->i->if_max_height;
+}
+
+
+int fb_poll(struct fb *ifp)
+{
+ return (*ifp->i->if_poll)(ifp);
+}
+
+long fb_poll_rate(struct fb *ifp)
+{
+ return ifp->i->if_poll_refresh_rate;
+}
+
+int fb_help(struct fb *ifp)
+{
+ return (*ifp->i->if_help)(ifp);
+}
+int fb_free(struct fb *ifp)
+{
+ return (*ifp->i->if_free)(ifp);
+}
+int fb_clear(struct fb *ifp, unsigned char *pp)
+{
+ return (*ifp->i->if_clear)(ifp, pp);
+}
+ssize_t fb_read(struct fb *ifp, int x, int y, unsigned char *pp, size_t count)
+{
+ return (*ifp->i->if_read)(ifp, x, y, pp, count);
+}
+ssize_t fb_write(struct fb *ifp, int x, int y, const unsigned char *pp, size_t
count)
+{
+ return (*ifp->i->if_write)(ifp, x, y, pp, count);
+}
+int fb_rmap(struct fb *ifp, ColorMap *cmap)
+{
+ return (*ifp->i->if_rmap)(ifp, cmap);
+}
+int fb_wmap(struct fb *ifp, const ColorMap *cmap)
+{
+ return (*ifp->i->if_wmap)(ifp, cmap);
+}
+int fb_view(struct fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
+{
+ return (*ifp->i->if_view)(ifp, xcenter, ycenter, xzoom, yzoom);
+}
+int fb_getview(struct fb *ifp, int *xcenter, int *ycenter, int *xzoom, int
*yzoom)
+{
+ return (*ifp->i->if_getview)(ifp, xcenter, ycenter, xzoom, yzoom);
+}
+int fb_setcursor(struct fb *ifp, const unsigned char *bits, int xb, int yb,
int xo, int yo)
+{
+ return (*ifp->i->if_setcursor)(ifp, bits, xb, yb, xo, yo);
+}
+int fb_cursor(struct fb *ifp, int mode, int x, int y)
+{
+ return (*ifp->i->if_cursor)(ifp, mode, x, y);
+}
+int fb_getcursor(struct fb *ifp, int *mode, int *x, int *y)
+{
+ return (*ifp->i->if_getcursor)(ifp, mode, x, y);
+}
+int fb_readrect(struct fb *ifp, int xmin, int ymin, int width, int height,
unsigned char *pp)
+{
+ return (*ifp->i->if_readrect)(ifp, xmin, ymin, width, height, pp);
+}
+int fb_writerect(struct fb *ifp, int xmin, int ymin, int width, int height,
const unsigned char *pp)
+{
+ return (*ifp->i->if_writerect)(ifp, xmin, ymin, width, height, pp);
+}
+int fb_bwreadrect(struct fb *ifp, int xmin, int ymin, int width, int height,
unsigned char *pp)
+{
+ return (*ifp->i->if_bwreadrect)(ifp, xmin, ymin, width, height, pp);
+}
+int fb_bwwriterect(struct fb *ifp, int xmin, int ymin, int width, int height,
const unsigned char *pp)
+{
+ return (*ifp->i->if_bwwriterect)(ifp, xmin, ymin, width, height, pp);
+}
+
+
+#define Malloc_Bomb(_bytes_) \
+ fb_log("\"%s\"(%d) : allocation of %lu bytes failed.\n", \
+ __FILE__, __LINE__, _bytes_)
+
+/**
+ * True if the non-null string s is all digits
+ */
+static int
+fb_totally_numeric(const char *s)
+{
+ if (s == (char *)0 || *s == 0)
+ return 0;
+
+ while (*s) {
+ if (*s < '0' || *s > '9')
+ return 0;
+ s++;
+ }
+
+ return 1;
+}
+
+
+/**
+ * Disk interface enable flag. Used so the remote daemon
+ * can turn off the disk interface.
+ */
+int _fb_disk_enable = 1;
+
+
+/**
+ * Filler for fb function slots not used by a particular device
+ */
+int fb_null(struct fb *ifp)
+{
+ if (ifp) {
+ FB_CK_FB(ifp->i);
+ }
+
+ return 0;
+}
+
+
+/**
+ * Used by if_*.c routines that don't have programmable cursor patterns.
+ */
+int fb_null_setcursor(struct fb *ifp, const unsigned char *UNUSED(bits), int
UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
+{
+ if (ifp) {
+ FB_CK_FB(ifp->i);
+ }
+
+ return 0;
+}
+
+
+
+struct fb *
+fb_open(const char *file, int width, int height)
+{
+ register struct fb *ifp;
+ int i;
+
+ if (width < 0 || height < 0)
+ return FB_NULL;
+
+ ifp = (struct fb *) calloc(sizeof(struct fb), 1);
+ ifp->i = (struct fb_impl *) calloc(sizeof(struct fb_impl), 1);
+ if (ifp == FB_NULL) {
+ Malloc_Bomb(sizeof(struct fb));
+ return FB_NULL;
+ }
+ if (file == NULL || *file == '\0') {
+ /* No name given, check environment variable first. */
+ if ((file = (const char *)getenv("FB_FILE")) == NULL || *file == '\0') {
+ /* None set, use first device as default */
+ *ifp = *(_if_list[0]); /* struct copy */
+ file = ifp->i->if_name;
+ goto found_interface;
+ }
+ }
+ /*
+ * Determine what type of hardware the device name refers to.
+ *
+ * "file" can in general look like: hostname:/pathname/devname#
+ *
+ * If we have a ':' assume the remote interface
+ * (We don't check to see if it's us. Good for debugging.)
+ * else strip out "/path/devname" and try to look it up in the
+ * device array. If we don't find it assume it's a file.
+ */
+ i = 0;
+ while (_if_list[i] != (struct fb *)NULL) {
+ if (bu_strncmp(file, _if_list[i]->i->if_name,
+ strlen(_if_list[i]->i->if_name)) == 0) {
+ /* found it, copy its struct in */
+ *ifp->i = *(_if_list[i]->i);
+ goto found_interface;
+ }
+ i++;
+ }
+
+ /* Not in list, check special interfaces or disk files */
+ /* "/dev/" protection! */
+ if (bu_strncmp(file, "/dev/", 5) == 0) {
+ fb_log("fb_open: no such device \"%s\".\n", file);
+ free((void *) ifp);
+ return FB_NULL;
+ }
+
+#ifdef IF_REMOTE
+ if (fb_totally_numeric(file) || strchr(file, ':') != NULL) {
+ /* We have a remote file name of the form <host>:<file>
+ * or a port number (which assumes localhost) */
+ *ifp = remote_interface;
+ goto found_interface;
+ }
+#endif /* IF_REMOTE */
+ /* Assume it's a disk file */
+ if (_fb_disk_enable) {
+ *ifp = disk_interface;
+ } else {
+ fb_log("fb_open: no such device \"%s\".\n", file);
+ free((void *) ifp);
+ return FB_NULL;
+ }
+
+found_interface:
+ /* Copy over the name it was opened by. */
+ ifp->i->if_name = (char*)malloc((unsigned) strlen(file) + 1);
+ if (ifp->i->if_name == (char *)NULL) {
+ Malloc_Bomb(strlen(file) + 1);
+ free((void *) ifp);
+ return FB_NULL;
+ }
+ bu_strlcpy(ifp->i->if_name, file, strlen(file)+1);
+
+ /* Mark OK by filling in magic number */
+ ifp->i->if_magic = FB_MAGIC;
+
+ i=(*ifp->i->if_open)(ifp, file, width, height);
+ if (i != 0) {
+ ifp->i->if_magic = 0; /* sanity */
+ free((void *) ifp->i->if_name);
+ free((void *) ifp);
+
+ if (i < 0)
+ fb_log("fb_open: can't open device \"%s\", ret=%d.\n", file, i);
+ else
+ bu_exit(0, "Terminating early by request\n"); /* e.g., zap memory */
+
+ return FB_NULL;
+ }
+ return ifp;
+}
+
+
+int
+fb_close(struct fb *ifp)
+{
+ int i;
+
+ FB_CK_FB(ifp->i);
+ fb_flush(ifp);
+ if ((i=(*ifp->i->if_close)(ifp)) <= -1) {
+ fb_log("fb_close: can not close device \"%s\", ret=%d.\n",
+ ifp->i->if_name, i);
+ return -1;
+ }
+ if (ifp->i->if_pbase != PIXEL_NULL)
+ free((void *) ifp->i->if_pbase);
+ free((void *) ifp->i->if_name);
+ free((void *) ifp);
+ return 0;
+}
+
+
+int
+fb_close_existing(struct fb *ifp)
+{
+ int status = 0;
+ if (!ifp)
+ return 0;
+
+ FB_CK_FB(ifp->i);
+
+ fb_flush(ifp);
+
+ /* FIXME: these should be callbacks, not listed directly */
+
+ status = ifp->i->if_close_existing(ifp);
+
+ if (status <= -1) {
+ fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n",
ifp->i->if_name, status);
+ return BRLCAD_ERROR;
+ }
+ fb_put(ifp);
+ return BRLCAD_OK;
+}
+
+
+/**
+ * Generic Help.
+ * Print out the list of available frame buffers.
+ */
+int
+fb_genhelp(void)
+{
+ int i;
+
+ i = 0;
+ while (_if_list[i] != (struct fb *)NULL) {
+ fb_log("%-12s %s\n",
+ _if_list[i]->i->if_name,
+ _if_list[i]->i->if_type);
+ i++;
+ }
+
+ /* Print the ones not in the device list */
+#ifdef IF_REMOTE
+ fb_log("%-12s %s\n",
+ remote_interface.i->if_name,
+ remote_interface.i->if_type);
+#endif
+ if (_fb_disk_enable) {
+ fb_log("%-12s %s\n",
+ disk_interface.i->if_name,
+ disk_interface.i->if_type);
+ }
+
+ return 0;
+}
+
+
+/**
+ * Check for a color map being linear in the upper 8 bits of R, G, and
+ * B. Returns 1 for linear map, 0 for non-linear map (i.e.,
+ * non-identity map).
+ */
+int
+fb_is_linear_cmap(register const ColorMap *cmap)
+{
+ register int i;
+
+ for (i=0; i<256; i++) {
+ if (cmap->cm_red[i]>>8 != i) return 0;
+ if (cmap->cm_green[i]>>8 != i) return 0;
+ if (cmap->cm_blue[i]>>8 != i) return 0;
+ }
+ return 1;
+}
+
+
+void
+fb_make_linear_cmap(register ColorMap *cmap)
+{
+ register int i;
+
+ for (i=0; i<256; i++) {
+ cmap->cm_red[i] = i<<8;
+ cmap->cm_green[i] = i<<8;
+ cmap->cm_blue[i] = i<<8;
+ }
+}
+
+static void
+fb_cmap_crunch(RGBpixel (*scan_buf), int pixel_ct, ColorMap *cmap)
+{
+ unsigned short *rp = cmap->cm_red;
+ unsigned short *gp = cmap->cm_green;
+ unsigned short *bp = cmap->cm_blue;
+
+ /* noalias ? */
+ for (; pixel_ct > 0; pixel_ct--, scan_buf++ ) {
+ (*scan_buf)[RED] = rp[(*scan_buf)[RED]] >> 8;
+ (*scan_buf)[GRN] = gp[(*scan_buf)[GRN]] >> 8;
+ (*scan_buf)[BLU] = bp[(*scan_buf)[BLU]] >> 8;
+ }
+}
+
+int
+fb_write_fp(struct fb *ifp, FILE *fp, int req_width, int req_height, int
crunch, int inverse, struct bu_vls *result)
+{
+ unsigned char *scanline; /* 1 scanline pixel buffer */
+ int scanbytes; /* # of bytes of scanline */
+ int scanpix; /* # of pixels of scanline */
+ ColorMap cmap; /* libfb color map */
+
+ scanpix = req_width;
+ scanbytes = scanpix * sizeof(RGBpixel);
+ if ((scanline = (unsigned char *)malloc(scanbytes)) == RGBPIXEL_NULL) {
+ bu_vls_printf(result, "fb_write_to_pix_fp: malloc(%d) failure",
scanbytes);
+ return BRLCAD_ERROR;
+ }
+
+ if (req_height > fb_getheight(ifp))
+ req_height = fb_getheight(ifp);
+ if (req_width > fb_getwidth(ifp))
+ req_width = fb_getwidth(ifp);
+
+ if (crunch) {
+ if (fb_rmap(ifp, &cmap) == -1) {
+ crunch = 0;
+ } else if (fb_is_linear_cmap(&cmap)) {
+ crunch = 0;
+ }
+ }
+
+ if (!inverse) {
+ int y;
+
+ /* Regular -- read bottom to top */
+ for (y=0; y < req_height; y++) {
+ fb_read(ifp, 0, y, scanline, req_width);
+ if (crunch)
+ fb_cmap_crunch((RGBpixel *)scanline, scanpix, &cmap);
+ if (fwrite((char *)scanline, scanbytes, 1, fp) != 1) {
+ perror("fwrite");
+ break;
+ }
+ }
+ } else {
+ int y;
+
+ /* Inverse -- read top to bottom */
+ for (y = req_height-1; y >= 0; y--) {
+ fb_read(ifp, 0, y, scanline, req_width);
+ if (crunch)
+ fb_cmap_crunch((RGBpixel *)scanline, scanpix, &cmap);
+ if (fwrite((char *)scanline, scanbytes, 1, fp) != 1) {
+ perror("fwrite");
+ break;
+ }
+ }
+ }
+
+ bu_free((void *)scanline, "fb_write_to_pix_fp(): scanline");
+ return BRLCAD_OK;
+}
+
+/*
+ * Throw bytes away. Use reads into scanline buffer if a pipe, else seek.
+ */
+static int
+fb_skip_bytes(int fd, b_off_t num, int fileinput, int scanbytes, unsigned char
*scanline)
+{
+ int n, tries;
+
+ if (fileinput) {
+ (void)lseek(fd, num, 1);
+ return 0;
+ }
+
+ while (num > 0) {
+ tries = num > scanbytes ? scanbytes : num;
+ n = read(fd, scanline, tries);
+ if (n <= 0) {
+ return -1;
+ }
+ num -= n;
+ }
+ return 0;
+}
+
+
+int
+fb_read_fd(struct fb *ifp, int fd, int file_width, int file_height, int
file_xoff, int file_yoff, int scr_width, int scr_height, int scr_xoff, int
scr_yoff, int fileinput, char *file_name, int one_line_only, int
multiple_lines, int autosize, int inverse, int clear, int zoom, struct bu_vls
*UNUSED(result))
+{
+ int y;
+ int xout, yout, n, m, xstart, xskip;
+ unsigned char *scanline; /* 1 scanline pixel buffer */
+ int scanbytes; /* # of bytes of scanline */
+ int scanpix; /* # of pixels of scanline */
+
+ /* autosize input? */
+ if (fileinput && autosize) {
+ size_t w, h;
+ if (fb_common_file_size(&w, &h, file_name, 3)) {
+ file_width = w;
+ file_height = h;
+ } else {
+ fprintf(stderr, "pix-fb: unable to autosize\n");
+ }
+ }
+
+ /* If screen size was not set, track the file size */
+ if (scr_width == 0)
+ scr_width = file_width;
+ if (scr_height == 0)
+ scr_height = file_height;
+
+ /* Get the screen size we were given */
+ scr_width = fb_getwidth(ifp);
+ scr_height = fb_getheight(ifp);
+
+ /* compute number of pixels to be output to screen */
+ if (scr_xoff < 0) {
+ xout = scr_width + scr_xoff;
+ xskip = (-scr_xoff);
+ xstart = 0;
+ } else {
+ xout = scr_width - scr_xoff;
+ xskip = 0;
+ xstart = scr_xoff;
+ }
+
+ if (xout < 0)
+ bu_exit(0, NULL); /* off screen */
+ if ((size_t)xout > (size_t)(file_width-file_xoff))
+ xout = (file_width-file_xoff);
+ scanpix = xout; /* # pixels on scanline */
+
+ if (inverse)
+ scr_yoff = (-scr_yoff);
+
+ yout = scr_height - scr_yoff;
+ if (yout < 0)
+ bu_exit(0, NULL); /* off screen */
+ if ((size_t)yout > (size_t)(file_height-file_yoff))
+ yout = (file_height-file_yoff);
+
+ /* Only in the simplest case use multi-line writes */
+ if (!one_line_only
+ && multiple_lines > 0
+ && !inverse
+ && !zoom
+ && (size_t)xout == (size_t)file_width
+ && (size_t)file_width <= (size_t)scr_width)
+ {
+ scanpix *= multiple_lines;
+ }
+
+ scanbytes = scanpix * sizeof(RGBpixel);
+ if ((scanline = (unsigned char *)malloc(scanbytes)) == RGBPIXEL_NULL) {
+ fprintf(stderr,
+ "pix-fb: malloc(%d) failure for scanline buffer\n",
+ scanbytes);
+ bu_exit(2, NULL);
+ }
+
+ if (clear) {
+ fb_clear(ifp, PIXEL_NULL);
+ }
+ if (zoom) {
+ /* Zoom in, and center the display. Use square zoom. */
+ int zoomit;
+ zoomit = scr_width/xout;
+ if (scr_height/yout < zoomit) zoomit = scr_height/yout;
+ if (inverse) {
+ fb_view(ifp,
+ scr_xoff+xout/2, scr_height-1-(scr_yoff+yout/2),
+ zoomit, zoomit);
+ } else {
+ fb_view(ifp,
+ scr_xoff+xout/2, scr_yoff+yout/2,
+ zoomit, zoomit);
+ }
+ }
+
+ if (file_yoff != 0) fb_skip_bytes(fd,
(b_off_t)file_yoff*(b_off_t)file_width*sizeof(RGBpixel), fileinput, scanbytes,
scanline);
+
+ if (multiple_lines) {
+ /* Bottom to top with multi-line reads & writes */
+ unsigned long height;
+ for (y = scr_yoff; y < scr_yoff + yout; y += multiple_lines) {
+ n = bu_mread(fd, (char *)scanline, scanbytes);
+ if (n <= 0) break;
+ height = multiple_lines;
+ if (n != scanbytes) {
+ height = (n/sizeof(RGBpixel)+xout-1)/xout;
+ if (height <= 0) break;
+ }
+ /* Don't over-write */
+ if ((size_t)(y + height) > (size_t)(scr_yoff + yout))
+ height = scr_yoff + yout - y;
+ if (height <= 0) break;
+ m = fb_writerect(ifp, scr_xoff, y,
+ file_width, height,
+ scanline);
+ if ((size_t)m != file_width*height) {
+ fprintf(stderr,
+ "pix-fb: fb_writerect(x=%d, y=%d, w=%lu, h=%lu)
failure, ret=%d, s/b=%d\n",
+ scr_xoff, y,
+ (unsigned long)file_width, height, m, scanbytes);
+ }
+ }
+ } else if (!inverse) {
+ /* Normal way -- bottom to top */
+ for (y = scr_yoff; y < scr_yoff + yout; y++) {
+ if (y < 0 || y > scr_height) {
+ fb_skip_bytes(fd, (b_off_t)file_width*sizeof(RGBpixel),
fileinput, scanbytes, scanline);
+ continue;
+ }
+ if (file_xoff+xskip != 0)
+ fb_skip_bytes(fd, (b_off_t)(file_xoff+xskip)*sizeof(RGBpixel),
fileinput, scanbytes, scanline);
+ n = bu_mread(fd, (char *)scanline, scanbytes);
+ if (n <= 0) break;
+ m = fb_write(ifp, xstart, y, scanline, xout);
+ if (m != xout) {
+ fprintf(stderr,
+ "pix-fb: fb_write(x=%d, y=%d, npix=%d) ret=%d,
s/b=%d\n",
+ scr_xoff, y, xout,
+ m, xout);
+ }
+ /* slop at the end of the line? */
+ if ((size_t)file_xoff+xskip+scanpix < (size_t)file_width)
+ fb_skip_bytes(fd,
(b_off_t)(file_width-file_xoff-xskip-scanpix)*sizeof(RGBpixel), fileinput,
scanbytes, scanline);
+ }
+ } else {
+ /* Inverse -- top to bottom */
+ for (y = scr_height-1-scr_yoff; y >= scr_height-scr_yoff-yout; y--) {
+ if (y < 0 || y >= scr_height) {
+ fb_skip_bytes(fd, (b_off_t)file_width*sizeof(RGBpixel),
fileinput, scanbytes, scanline);
+ continue;
+ }
+ if (file_xoff+xskip != 0)
+ fb_skip_bytes(fd, (b_off_t)(file_xoff+xskip)*sizeof(RGBpixel),
fileinput, scanbytes, scanline);
+ n = bu_mread(fd, (char *)scanline, scanbytes);
+ if (n <= 0) break;
+ m = fb_write(ifp, xstart, y, scanline, xout);
+ if (m != xout) {
+ fprintf(stderr,
+ "pix-fb: fb_write(x=%d, y=%d, npix=%d) ret=%d,
s/b=%d\n",
+ scr_xoff, y, xout,
+ m, xout);
+ }
+ /* slop at the end of the line? */
+ if ((size_t)file_xoff+xskip+scanpix < (size_t)file_width)
+ fb_skip_bytes(fd,
(b_off_t)(file_width-file_xoff-xskip-scanpix)*sizeof(RGBpixel), fileinput,
scanbytes, scanline);
+ }
+ }
+ free(scanline);
+ return BRLCAD_OK;
+}
+
+
+static png_color_16 def_backgrd={ 0, 0, 0, 0, 0 };
+
+int
+fb_read_png(struct fb *ifp, FILE *fp_in, int file_xoff, int file_yoff, int
scr_xoff, int scr_yoff, int clear, int zoom, int inverse, int one_line_only,
int multiple_lines, int verbose, int header_only, double def_screen_gamma,
struct bu_vls *result)
+{
+ int y;
+ int i;
+ int xout, yout, m, xstart;
+ png_structp png_p;
+ png_infop info_p;
+ char header[8];
+ int bit_depth;
+ int color_type;
+ png_color_16p input_backgrd;
+ double gammaval=1.0;
+ int file_width, file_height;
+ unsigned char *image;
+ unsigned char **scanline; /* 1 scanline pixel buffer */
+ int scanbytes; /* # of bytes of scanline */
+ int scanpix; /* # of pixels of scanline */
+ int scr_width;
+ int scr_height;
+
+ if (fread(header, 8, 1, fp_in) != 1) {
+ bu_vls_printf(result, "png-fb: ERROR: Failed while reading file
header!!!\n");
+ return BRLCAD_ERROR;
+ }
+
+ if (png_sig_cmp((png_bytep)header, 0, 8)) {
+ bu_vls_printf(result, "png-fb: This is not a PNG file!!!\n");
+ return BRLCAD_ERROR;
+ }
+
+ png_p = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (!png_p) {
+ bu_vls_printf(result, "png-fb: png_create_read_struct() failed!!\n");
+ return BRLCAD_ERROR;
+ }
+
+ info_p = png_create_info_struct(png_p);
+ if (!info_p) {
+ bu_vls_printf(result, "png-fb: png_create_info_struct() failed!!\n");
+ return BRLCAD_ERROR;
+ }
+
+ png_init_io(png_p, fp_in);
+
+ png_set_sig_bytes(png_p, 8);
+
+ png_read_info(png_p, info_p);
+
+ color_type = png_get_color_type(png_p, info_p);
+
+ png_set_expand(png_p);
+ bit_depth = png_get_bit_depth(png_p, info_p);
+ if (bit_depth == 16)
+ png_set_strip_16(png_p);
+
+ if (color_type == PNG_COLOR_TYPE_GRAY ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
+ png_set_gray_to_rgb(png_p);
+
+ file_width = png_get_image_width(png_p, info_p);
+ file_height = png_get_image_height(png_p, info_p);
+
+ if (verbose) {
+ switch (color_type) {
+ case PNG_COLOR_TYPE_GRAY:
+ bu_vls_printf(result, "color type: b/w (bit depth=%d)\n",
bit_depth);
+ break;
+ case PNG_COLOR_TYPE_GRAY_ALPHA:
+ bu_vls_printf(result, "color type: b/w with alpha channel (bit
depth=%d)\n", bit_depth);
+ break;
+ case PNG_COLOR_TYPE_PALETTE:
+ bu_vls_printf(result, "color type: color palette (bit
depth=%d)\n", bit_depth);
+ break;
+ case PNG_COLOR_TYPE_RGB:
+ bu_vls_printf(result, "color type: RGB (bit depth=%d)\n",
bit_depth);
+ break;
+ case PNG_COLOR_TYPE_RGB_ALPHA:
+ bu_vls_printf(result, "color type: RGB with alpha channel (bit
depth=%d)\n", bit_depth);
+ break;
+ default:
+ bu_vls_printf(result, "Unrecognized color type (bit
depth=%d)\n", bit_depth);
+ break;
+ }
+ bu_vls_printf(result, "Image size: %d X %d\n", file_width, file_height);
+ }
+
+ if (header_only) {
+ bu_vls_printf(result, "WIDTH=%d HEIGHT=%d\n", file_width, file_height);
+ return BRLCAD_OK;
+ }
+
+ if (png_get_bKGD(png_p, info_p, &input_backgrd)) {
+ if (verbose && (color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
+ color_type == PNG_COLOR_TYPE_RGB_ALPHA))
+ bu_vls_printf(result, "background color: %d %d %d\n",
input_backgrd->red, input_backgrd->green, input_backgrd->blue);
+ png_set_background(png_p, input_backgrd, PNG_BACKGROUND_GAMMA_FILE, 1,
1.0);
+ } else
+ png_set_background(png_p, &def_backgrd, PNG_BACKGROUND_GAMMA_FILE, 0,
1.0);
+
+ if (!png_get_gAMA(png_p, info_p, &gammaval))
+ gammaval = 0.5;
+ png_set_gamma(png_p, def_screen_gamma, gammaval);
+ if (verbose)
+ bu_vls_printf(result, "file gamma: %f, additional screen gamma: %f\n",
+ gammaval, def_screen_gamma);
+
+ if (verbose) {
+ if (png_get_interlace_type(png_p, info_p) == PNG_INTERLACE_NONE)
+ bu_vls_printf(result, "not interlaced\n");
+ else
+ bu_vls_printf(result, "interlaced\n");
+ }
+
+ png_read_update_info(png_p, info_p);
+
+ /* allocate memory for image */
+ image = (unsigned char *)bu_calloc(1, file_width*file_height*3, "image");
+
+ /* create rows array */
+ scanline = (unsigned char **)bu_calloc(file_height, sizeof(unsigned char
*), "scanline");
+ for (i=0; i<file_height; i++)
+ scanline[i] = image+(i*file_width*3);
+
+ png_read_image(png_p, scanline);
+
+ if (verbose) {
+ png_timep mod_time;
+ png_textp text;
+ int num_text;
+
+ png_read_end(png_p, info_p);
+ if (png_get_text(png_p, info_p, &text, &num_text)) {
+ for (i=0; i<num_text; i++)
+ bu_vls_printf(result, "%s: %s\n", text[i].key, text[i].text);
+ }
+ if (png_get_tIME(png_p, info_p, &mod_time))
+ bu_vls_printf(result, "Last modified: %d/%d/%d %d:%d:%d\n",
mod_time->month, mod_time->day,
+ mod_time->year, mod_time->hour, mod_time->minute,
mod_time->second);
+ }
+
+ /* Get the screen size we were given */
+ scr_width = fb_getwidth(ifp);
+ scr_height = fb_getheight(ifp);
+
+ /* compute number of pixels to be output to screen */
+ if (scr_xoff < 0) {
+ xout = scr_width + scr_xoff;
+ xstart = 0;
+ } else {
+ xout = scr_width - scr_xoff;
+ xstart = scr_xoff;
+ }
+
+ if (xout < 0) {
+ bu_free(image, "image");
+ bu_free(scanline, "scanline");
+ return BRLCAD_OK;
+ }
+ V_MIN(xout, (file_width-file_xoff));
+ scanpix = xout; /* # pixels on scanline */
+
+ if (inverse)
+ scr_yoff = (-scr_yoff);
+
+ yout = scr_height - scr_yoff;
+ if (yout < 0) {
+ bu_free(image, "image");
+ bu_free(scanline, "scanline");
+ return BRLCAD_OK;
+ }
+ V_MIN(yout, (file_height-file_yoff));
+
+ /* Only in the simplest case use multi-line writes */
+ if (!one_line_only && multiple_lines > 0 && !inverse && !zoom &&
+ xout == file_width && file_xoff == 0 &&
+ file_width <= scr_width) {
+ scanpix *= multiple_lines;
+ }
+
+ scanbytes = scanpix * sizeof(RGBpixel);
+
+ if (clear) {
+ fb_clear(ifp, PIXEL_NULL);
+ }
+ if (zoom) {
+ /* Zoom in, and center the display. Use square zoom. */
+ int newzoom;
+ newzoom = scr_width/xout;
+ V_MIN(newzoom, scr_height/yout);
+
+ if (inverse) {
+ fb_view(ifp,
+ scr_xoff+xout/2, scr_height-1-(scr_yoff+yout/2),
+ newzoom, newzoom);
+ } else {
+ fb_view(ifp,
+ scr_xoff+xout/2, scr_yoff+yout/2,
+ newzoom, newzoom);
+ }
+ }
+
+ if (multiple_lines) {
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits