Compare commits

...
Author SHA1 Message Date
Clifford Yapp a3dcc30da3 Framebuffer API is (hopefully) close enough for now, so shifting focus to libdm (svn branch delete)
svn:revision:62127
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-13 18:27:27 +00:00
Clifford Yapp edb693e538 With the type magic number in the structure, don't need the string nonsense.
svn:revision:62123
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-13 18:01:14 +00:00
Clifford Yapp 9948ef9665 Move magic numbers to bu/magic.h
svn:revision:62121
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-13 17:06:49 +00:00
Clifford Yapp ea81315884 Sync through trunk r62100
svn:revision:62105
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 18:46:49 +00:00
Clifford Yapp 78f890cf50 Update comment
svn:revision:62100
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 18:39:17 +00:00
Clifford Yapp b17650e5e7 stub in functions for configure_window and refresh
svn:revision:62099
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 18:36:09 +00:00
Clifford Yapp eae4a6fb11 Shorten switch, since all statements are returns
svn:revision:62095
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 16:52:41 +00:00
Clifford Yapp 92114eac84 More cleanup
svn:revision:62093
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 16:49:20 +00:00
Clifford Yapp f780209956 Refactor fb_close_existing
svn:revision:62090
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 16:27:05 +00:00
Clifford Yapp fae364dfff Switch more code over to the new approach.
svn:revision:62087
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 16:09:05 +00:00
Clifford Yapp a9551caa99 Fix copyright and update protective wrapper
svn:revision:62082
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 14:25:47 +00:00
Clifford Yapp 82bfb9649c Move internals header to generic name
svn:revision:62081
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 14:20:29 +00:00
Clifford Yapp 57cfe814bc Fix the other two fb_open_existing calls.
svn:revision:62080
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 14:07:46 +00:00
Clifford Yapp e10cec999d Cleanup, refactor. Can't leave the NULLs in the interface definitions - minimally, need stub functions - but this gets things building.
svn:revision:62079
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 14:03:39 +00:00
Clifford Yapp d8cf182d6a Get the embedded X24 framebuffer running with the new API.
svn:revision:62078
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 13:26:46 +00:00
Clifford Yapp b1c39dfb44 Don't forget to svn add
svn:revision:62076
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 01:41:44 +00:00
Clifford Yapp 808c2e2f87 Not working yet, but start trying to use new interface.
svn:revision:62075
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 01:41:23 +00:00
Clifford Yapp 6de1069331 Remove the fb_open_existing and fb_close_existing tcl commands - they don't appear to be used. If some sort of Tcl controls for this are needed, hopefully they can be set up in a way that requires less data to pass tough an argc/argv string interface - that's an ackward way to pass things like window pointers. Once the new libdm intrfce is worked out, perhaps we can define a new fb_open_existing command via libdm or just have an fb command with subcommands.
svn:revision:62074
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 00:33:22 +00:00
Clifford Yapp dab0d4e801 Move some logic out of tcl.c - needs more refactoring, but this is a first step - whittling down tcl.c to the parts that actually require tcl
svn:revision:62073
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-12 00:25:46 +00:00
Clifford Yapp edeba28b49 Tweak the open existing function - will need to play with this some more to see what is needed.
svn:revision:62072
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-11 20:56:51 +00:00
Clifford Yapp ad5b315781 Stub in API for handling/hiding the messy details of window embedding from the main fb.h API.
svn:revision:62071
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-11 20:35:39 +00:00
Clifford Yapp 86fda4f51d Use fb instead of fb_s for the public typedef, and fb_internal for the actual structure definition.
svn:revision:62069
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-11 15:30:47 +00:00
Clifford Yapp a3885cc38d Sync through trunk r62062
svn:revision:62067
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-11 14:23:50 +00:00
Clifford Yapp 98a4a76a5c Stub in Sean's idea of an fb_platform_specific container with magic number.
svn:revision:62053
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-08 17:06:52 +00:00
Clifford Yapp 61bf8aabf8 Consolidate the lists - needed to offset to account for the /dev/ in the if_name for string comparison.
svn:revision:62051
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-08 16:04:39 +00:00
Clifford Yapp aaee10184b Whoops, broke something - revert
svn:revision:62049
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-08 15:52:54 +00:00
Clifford Yapp ca1650ef1f do a bit of refactoring, start thinking about interface to replace the open_existing setup...
svn:revision:62048
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-08 15:47:53 +00:00
Clifford Yapp 99f53ef3df Take a step towards hiding all the backend specific bits in fb_private.h - major problem looks to be the *_open_existing functions. Those are a problem, because the fundamental issue is going to be hard to hide - namely, that creating embedded windows is inherently specific to each platform. Not even clear we can pass all the responsibility to the parent, since low level drawing may have to know platform specific details.
svn:revision:62035
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-07 23:02:27 +00:00
Clifford Yapp 1401cfc0bd Successfully hide struct fb (a.k.a FBIO) in a private header in libfb.
svn:revision:62033
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-07 21:26:47 +00:00
Clifford Yapp f65436fe1d Use a typedef and rename FBIO.
svn:revision:62030
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-07 18:47:05 +00:00
Clifford Yapp d563cdc45b Trying some experimentation with the framebuffer code that is Likely To Break Things - hence, create a branch for it.
svn:revision:62029
svn:branch:framebuffer-experiment
svn:account:starseeker
2014-08-07 18:33:59 +00:00
130 changed files with 2121 additions and 3702 deletions
+14 -14
View File
@@ -22,10 +22,10 @@
<funcsynopsis>
<funcprototype>
<funcdef><function>FBIO</function> *fb_open</funcdef>
<funcdef><function>fb</function> *fb_open</funcdef>
<paramdef>* <parameter>fbfile</parameter></paramdef>
<paramdef>int fb_close ( fbp ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_read ( fbp , x , y , addr , count ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_close ( fbp ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_read ( fbp , x , y , addr , count ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>RGBpixel <parameter>*addr;</parameter></paramdef>
<paramdef>long <parameter>count;</parameter></paramdef>
</funcprototype>
@@ -35,7 +35,7 @@
<paramdef>* <parameter>fbp</parameter></paramdef>
<paramdef>RGBpixel * <parameter>addr</parameter></paramdef>
<paramdef>long <parameter>count</parameter></paramdef>
<paramdef>int fb_rmap ( fbp , cmap ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_rmap ( fbp , cmap ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>ColorMap * <parameter>cmap</parameter></paramdef>
</funcprototype>
@@ -78,8 +78,8 @@
<funcprototype>
<funcdef>int <function>fb_cursor</function></funcdef>
<paramdef>* <parameter>fbp</parameter></paramdef>
<paramdef>int fb_scursor ( fbp , mode , x , y ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_setcursor ( fbp , bits , xbits , ybits , xorig , yorig ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_scursor ( fbp , mode , x , y ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_setcursor ( fbp , bits , xbits , ybits , xorig , yorig ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>unsigned char <parameter>bits</parameter>[]</paramdef>
<paramdef>int <parameter>xbits</parameter>, <parameter>ybits</parameter>;</paramdef>
<paramdef>int <parameter>xorig</parameter>, <parameter>yorig</parameter>;</paramdef>
@@ -88,14 +88,14 @@
<funcprototype>
<funcdef>int <function>fb_window</function></funcdef>
<paramdef>* <parameter>fbp</parameter></paramdef>
<paramdef>int fb_zoom ( fbp , x , y ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>/ *Buffered frame buffer I/O: */ int fb_ioinit ( fbp ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>int fb_zoom ( fbp , x , y ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>/ *Buffered frame buffer I/O: */ int fb_ioinit ( fbp ) fb * <parameter>fbp</parameter></paramdef>
</funcprototype>
<funcprototype>
<funcdef>int <function>fb_seek</function></funcdef>
<paramdef>* <parameter>fbp</parameter></paramdef>
<paramdef>void fb_tell ( fbp , xp , yp ) FBIO * <parameter>fbp</parameter></paramdef>
<paramdef>void fb_tell ( fbp , xp , yp ) fb * <parameter>fbp</parameter></paramdef>
<paramdef>int *xp , * <parameter>yp</parameter></paramdef>
</funcprototype>
@@ -168,10 +168,10 @@
See below for more details. The <emphasis remap="I">width</emphasis>
and <emphasis remap="I">height</emphasis> parameters specify the initial
size of display desired. If these are zero the default sizes for that
device will be used. On a successful open, the frame buffer I/O (FBIO)
device will be used. On a successful open, the frame buffer I/O (fb)
structure pointer is returned. This structure contains size you were
actually given, as well as the maximum possible size for the selected
device. A return of FBIO_NULL indicates failure.
device. A return of fb_NULL indicates failure.
</para>
<para><emphasis remap="I">Fb_close</emphasis> simply closes the frame buffer.
</para>
@@ -214,11 +214,11 @@
</para>
<para><emphasis remap="I">Fb_gettype</emphasis>
returns a pointer to a string describing the frame buffer
specified by the FBIO pointer.
specified by the fb pointer.
</para>
<para><emphasis remap="I">Fb_getwidth</emphasis>
and <emphasis remap="I">Fb_getheight</emphasis>
returns the current size of the FBIO frame buffer.
returns the current size of the fb frame buffer.
</para>
<para>
The following routines work in conjunction with those described above
@@ -433,7 +433,7 @@
<emphasis remap="I">fb_flush</emphasis>
return -1 to indicate failure.
<emphasis remap="I">Fb_open</emphasis>
returns FBIO_NULL to indicate failure, and a non-null FBIO structure pointer
returns fb_NULL to indicate failure, and a non-null fb structure pointer
upon success.
<emphasis remap="I">fb_read</emphasis>,
and
+2 -2
View File
@@ -3850,7 +3850,7 @@ view_pixel(ap)
register struct application *ap;
{
....
if( fbp != FBIO_NULL ) {
if( fbp != fb_NULL ) {
/* Framebuffer output */
RES_ACQUIRE( &rt_g.res_syscall );
fb_write( fbp, ap-&gt;a_x, ap-&gt;a_y, (char *)p, 1 );
@@ -3891,7 +3891,7 @@ followed a little later by the actual output section:
<p>
case BUFMODE_DYNAMIC:
if( fbp != FBIO_NULL ) {
if( fbp != fb_NULL ) {
RES_ACQUIRE( &rt_g.res_syscall );
fb_write( fbp, 0, ap-&gt;a_y,
scanline[ap-&gt;a_y].sl_buf, width );
+1 -1
View File
@@ -1,6 +1,7 @@
add_subdirectory(bu)
add_subdirectory(dm)
add_subdirectory(rt)
add_subdirectory(fb)
set(public_hdrs
RtServerImpl.h
@@ -27,7 +28,6 @@ set(public_hdrs
dm.h
dvec.h
fb.h
fbio.h
fbserv_obj.h
fft.h
gcv.h
+15 -1
View File
@@ -192,6 +192,21 @@ __BEGIN_DECLS
#define GED_CMD_MAGIC 0x65786563 /**< exec */
/* fb */
#define FB_MAGIC 0xfbfb00fb /**< ???? */
#define FB_WGL_MAGIC 0x574f4642 /**< WOFB */
#define FB_OGL_MAGIC 0x584f4642 /**< XOFB */
#define FB_X24_MAGIC 0x58324642 /**< X2FB */
#define FB_TK_MAGIC 0x544b4642 /**< TKFB */
#define FB_QT_MAGIC 0x51544642 /**< QTFB */
#define FB_DEBUG_MAGIC 0x44424642 /**< DBFB */
#define FB_DISK_MAGIC 0x44494642 /**< STFB */
#define FB_STK_MAGIC 0x53544642 /**< STFB */
#define FB_MEMORY_MAGIC 0x4d454642 /**< MEFB */
#define FB_REMOTE_MAGIC 0x524d4642 /**< MEFB */
#define FB_NULL_MAGIC 0x4e554642 /**< NUFB */
/* misc */
#define ANIMATE_MAGIC 0x414e4963 /**< ANIc */
@@ -202,7 +217,6 @@ __BEGIN_DECLS
#define DB5_RAW_INTERNAL_MAGIC 0x64357269 /**< d5ri */
#define DBI_MAGIC 0x57204381 /**< W C? */
#define DB_FULL_PATH_MAGIC 0x64626670 /**< dbfp */
#define FB_MAGIC 0xfbfb00fb /**< ???? */
#define LIGHT_MAGIC 0xdbddbdb7 /**< ???? */
#define MF_MAGIC 0x55968058 /**< U??X */
#define PIXEL_EXT_MAGIC 0x50787400 /**< Pxt */
+1 -1
View File
@@ -248,7 +248,7 @@ struct dm {
int (*dm_getDisplayImage)(struct dm *dmp, unsigned char **image);
void (*dm_reshape)(struct dm *dmp, int width, int height);
int (*dm_makeCurrent)(struct dm *dmp);
int (*dm_openFb)(struct dm *dmp, FBIO *ifp);
int (*dm_openFb)(struct dm *dmp, fb *ifp);
unsigned long dm_id; /**< @brief window id */
int dm_displaylist; /**< @brief !0 means device has displaylist */
int dm_stereo; /**< @brief stereo flag */
+1 -1
View File
@@ -187,7 +187,7 @@ null_processEvents(struct dm *dmp);
DM_EXPORT extern int
null_openFb(struct dm *dmp, FBIO *ifp);
null_openFb(struct dm *dmp, fb *ifp);
__END_DECLS
+111 -119
View File
@@ -28,10 +28,17 @@
#ifndef FB_H
#define FB_H
#include "common.h"
#include <limits.h> /* For INT_MAX */
#include <stdlib.h>
#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
/*
* Needed for fd_set, avoid including sys/select.h outright since it
@@ -47,141 +54,127 @@
# include <sys/time.h>
#endif
#include "fbio.h"
#include "bu/bu_tcl.h"
#include "bu/magic.h"
#include "bu/vls.h"
/* Library entry points which are macros.
*
* FIXME: turn these into proper functions so we can appropriately
* avoid dereferencing a NULL _ifp or calling an invalid callback.
/**
* 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.
*/
#define fb_gettype(_ifp) (_ifp->if_type)
#define fb_getwidth(_ifp) (_ifp->if_width)
#define fb_getheight(_ifp) (_ifp->if_height)
#define fb_poll(_ifp) (*_ifp->if_poll)(_ifp)
#define fb_help(_ifp) (*_ifp->if_help)(_ifp)
#define fb_free(_ifp) (*_ifp->if_free)(_ifp)
#define fb_clear(_ifp, _pp) (*_ifp->if_clear)(_ifp, _pp)
#define fb_read(_ifp, _x, _y, _pp, _ct) (*_ifp->if_read)(_ifp, _x, _y, _pp, _ct)
#define fb_write(_ifp, _x, _y, _pp, _ct) (*_ifp->if_write)(_ifp, _x, _y, _pp, _ct)
#define fb_rmap(_ifp, _cmap) (*_ifp->if_rmap)(_ifp, _cmap)
#define fb_wmap(_ifp, _cmap) (*_ifp->if_wmap)(_ifp, _cmap)
#define fb_view(_ifp, _xc, _yc, _xz, _yz) (*_ifp->if_view)(_ifp, _xc, _yc, _xz, _yz)
#define fb_getview(_ifp, _xcp, _ycp, _xzp, _yzp) (*_ifp->if_getview)(_ifp, _xcp, _ycp, _xzp, _yzp)
#define fb_setcursor(_ifp, _bits, _xb, _yb, _xo, _yo) (*_ifp->if_setcursor)(_ifp, _bits, _xb, _yb, _xo, _yo)
#define fb_cursor(_ifp, _mode, _x, _y) (*_ifp->if_cursor)(_ifp, _mode, _x, _y)
#define fb_getcursor(_ifp, _modep, _xp, _yp) (*_ifp->if_getcursor)(_ifp, _modep, _xp, _yp)
#define fb_readrect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_readrect)(_ifp, _xmin, _ymin, _width, _height, _pp)
#define fb_writerect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_writerect)(_ifp, _xmin, _ymin, _width, _height, _pp)
#define fb_bwreadrect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_bwreadrect)(_ifp, _xmin, _ymin, _width, _height, _pp)
#define fb_bwwriterect(_ifp, _xmin, _ymin, _width, _height, _pp) (*_ifp->if_bwwriterect)(_ifp, _xmin, _ymin, _width, _height, _pp)
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.
*/
/* FIXME: ColorMap is same as RLEColorMap defined in 'orle.h' */
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
/* Use a typedef to hide the details of the framebuffer structure */
typedef struct fb_internal fb;
#define FB_NULL (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 which are true functions. */
FB_EXPORT extern void fb_configureWindow(FBIO *, int, int);
FB_EXPORT extern FBIO *fb_open(const char *file, int _width, int _height);
FB_EXPORT extern int fb_close(FBIO *ifp);
FB_EXPORT extern int fb_close_existing(FBIO *ifp);
/* Library entry points */
FB_EXPORT fb *fb_get();
FB_EXPORT void fb_put(fb *ifp);
FB_EXPORT extern char *fb_gettype(fb *ifp);
FB_EXPORT extern int fb_get_max_width(fb *ifp);
FB_EXPORT extern int fb_get_max_height(fb *ifp);
FB_EXPORT extern int fb_getwidth(fb *ifp);
FB_EXPORT extern int fb_getheight(fb *ifp);
FB_EXPORT extern int fb_poll(fb *ifp);
FB_EXPORT extern int fb_help(fb *ifp);
FB_EXPORT extern int fb_free(fb *ifp);
FB_EXPORT extern int fb_clear(fb *ifp, unsigned char *pp);
FB_EXPORT extern ssize_t fb_read(fb *ifp, int x, int y, unsigned char *pp, size_t count);
FB_EXPORT extern ssize_t fb_write(fb *ifp, int x, int y, const unsigned char *pp, size_t count);
FB_EXPORT extern int fb_rmap(fb *ifp, ColorMap *cmap);
FB_EXPORT extern int fb_wmap(fb *ifp, const ColorMap *cmap);
FB_EXPORT extern int fb_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom);
FB_EXPORT extern int fb_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom);
FB_EXPORT extern int fb_setcursor(fb *ifp, const unsigned char *bits, int xb, int yb, int xo, int yo);
FB_EXPORT extern int fb_cursor(fb *ifp, int mode, int x, int y);
FB_EXPORT extern int fb_getcursor(fb *ifp, int *mode, int *x, int *y);
FB_EXPORT extern int fb_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp);
FB_EXPORT extern int fb_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp);
FB_EXPORT extern int fb_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp);
FB_EXPORT extern int fb_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp);
FB_EXPORT extern fb *fb_open(const char *file, int _width, int _height);
FB_EXPORT extern int fb_close(fb *ifp);
FB_EXPORT extern int fb_close_existing(fb *ifp);
FB_EXPORT extern int fb_genhelp(void);
FB_EXPORT extern int fb_ioinit(FBIO *ifp);
FB_EXPORT extern int fb_seek(FBIO *ifp, int x, int y);
FB_EXPORT extern int fb_tell(FBIO *ifp, int *xp, int *yp);
FB_EXPORT extern int fb_rpixel(FBIO *ifp, unsigned char *pp);
FB_EXPORT extern int fb_wpixel(FBIO *ifp, unsigned char *pp);
FB_EXPORT extern int fb_flush(FBIO *ifp);
FB_EXPORT extern int fb_ioinit(fb *ifp);
FB_EXPORT extern int fb_seek(fb *ifp, int x, int y);
FB_EXPORT extern int fb_tell(fb *ifp, int *xp, int *yp);
FB_EXPORT extern int fb_rpixel(fb *ifp, unsigned char *pp);
FB_EXPORT extern int fb_wpixel(fb *ifp, unsigned char *pp);
FB_EXPORT extern int fb_flush(fb *ifp);
FB_EXPORT extern int fb_configure_window(fb *, int, int);
FB_EXPORT extern int fb_refresh(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(FBIO *ifp);
FB_EXPORT extern int fb_null_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig);
FB_EXPORT extern int fb_null(fb *ifp);
FB_EXPORT extern int fb_null_setcursor(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(FBIO *ifp, FILE *fp, int req_width, int req_height, int crunch, int inverse, struct bu_vls *result);
FB_EXPORT extern int fb_read_fd(FBIO *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_write_fp(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(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 void fb_set_interface(fb *ifp, const char *interface_type);
FB_EXPORT extern void fb_set_name(fb *ifp, const char *name);
FB_EXPORT extern char *fb_get_name(fb *ifp);
FB_EXPORT extern void fb_set_magic(fb *ifp, uint32_t magic);
FB_EXPORT extern long fb_get_pagebuffer_pixel_size(fb *ifp);
FB_EXPORT extern int fb_is_set_fd(fb *ifp, fd_set *infds);
FB_EXPORT extern int fb_set_fd(fb *ifp, fd_set *select_list);
FB_EXPORT extern int fb_clear_fd(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 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(FBIO *ifp);
FB_EXPORT extern int fb_viewport(FBIO *ifp, int left, int top, int right, int bottom);
FB_EXPORT extern int fb_window(FBIO *ifp, int xcenter, int ycenter);
FB_EXPORT extern int fb_zoom(FBIO *ifp, int xzoom, int yzoom);
FB_EXPORT extern int fb_scursor(FBIO *ifp, int mode, int x, int y);
/*
* Some functions and variables we couldn't hide.
* Not for general consumption.
*/
FB_EXPORT extern int _fb_disk_enable;
FB_EXPORT extern int fb_sim_readrect(FBIO *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp);
FB_EXPORT extern int fb_sim_writerect(FBIO *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp);
FB_EXPORT extern int fb_sim_bwreadrect(FBIO *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp);
FB_EXPORT extern int fb_sim_bwwriterect(FBIO *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp);
FB_EXPORT extern int fb_sim_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom);
FB_EXPORT extern int fb_sim_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom);
FB_EXPORT extern int fb_sim_cursor(FBIO *ifp, int mode, int x, int y);
FB_EXPORT extern int fb_sim_getcursor(FBIO *ifp, int *mode, int *x, int *y);
/* FIXME: these IF_* sections need to die. they don't belong in a public header. */
#ifdef IF_X
# ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
FB_EXPORT extern int _X24_open_existing(FBIO *ifp, Display *dpy, Window win, Window cwinp, Colormap cmap, XVisualInfo *vip, int width, int height, GC gc);
#endif
#ifdef IF_OGL
# ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
/* glx.h on Mac OS X (and perhaps elsewhere) defines a slew of
* parameter names that shadow system symbols. protect the system
* symbols by redefining the parameters prior to header inclusion.
*/
# define j1 J1
# define y1 Y1
# define read rd
# define index idx
# define access acs
# define remainder rem
# ifdef HAVE_GL_GLX_H
# include <GL/glx.h>
# endif
# undef remainder
# undef access
# undef index
# undef read
# undef y1
# undef j1
# ifdef HAVE_GL_GL_H
# include <GL/gl.h>
# endif
FB_EXPORT extern int _ogl_open_existing(FBIO *ifp, Display *dpy, Window win, Colormap cmap, XVisualInfo *vip, int width, int height, GLXContext glxc, int double_buffer, int soft_cmap);
#endif
#ifdef IF_WGL
# include <windows.h>
# include <tk.h>
# ifdef HAVE_GL_GL_H
# include <GL/gl.h>
# endif
FB_EXPORT extern int _wgl_open_existing(FBIO *ifp, Display *dpy, Window win, Colormap cmap, PIXELFORMATDESCRIPTOR *vip, HDC hdc, int width, int height, HGLRC glxc, int double_buffer, int soft_cmap);
#endif
#ifdef IF_QT
FB_EXPORT extern int _qt_open_existing(FBIO *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg);
#endif
FB_EXPORT extern int fb_reset(fb *ifp);
FB_EXPORT extern int fb_viewport(fb *ifp, int left, int top, int right, int bottom);
FB_EXPORT extern int fb_window(fb *ifp, int xcenter, int ycenter);
FB_EXPORT extern int fb_zoom(fb *ifp, int xzoom, int yzoom);
FB_EXPORT extern int fb_scursor(fb *ifp, int mode, int x, int y);
/*
* Copy one RGB pixel to another.
@@ -200,14 +193,13 @@ FB_EXPORT extern int _qt_open_existing(FBIO *ifp, int width, int height, void *q
/* 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);
FB_EXPORT extern int fb_refresh(FBIO *ifp, int x, int y, int w, int h);
/**
* report version information about LIBFB
*/
FB_EXPORT extern const char *fb_version(void);
__END_DECLS
#endif /* FB_H */
+12
View File
@@ -0,0 +1,12 @@
set(fb_noinstall_headers
fb_platform_specific.h
)
CMAKEFILES(${fb_noinstall_headers})
# Local Variables:
# tab-width: 8
# mode: cmake
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+130
View File
@@ -0,0 +1,130 @@
/* F B _ P L A T F O R M _ S P E C I F I C . H
* BRL-CAD
*
* Copyright (c) 2014 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 if */
/** @{*/
/** @file fb_platform_specific.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 */
#ifdef IF_OGL
# ifdef HAVE_X11_XLIB_H
# include <X11/Xlib.h>
# include <X11/Xutil.h>
# endif
/* glx.h on Mac OS X (and perhaps elsewhere) defines a slew of
* * * parameter names that shadow system symbols. protect the system
* * * symbols by redefining the parameters prior to header inclusion.
* * */
# define j1 J1
# define y1 Y1
# define read rd
# define index idx
# define access acs
# define remainder rem
# ifdef HAVE_GL_GLX_H
# include <GL/glx.h>
# endif
# undef remainder
# undef access
# undef index
# undef read
# undef y1
# undef j1
# ifdef HAVE_GL_GL_H
# include <GL/gl.h>
# endif
struct ogl_fb_info {
Display *dpy;
Window win;
Colormap cmap;
XVisualInfo *vip;
GLXContext glxc;
int double_buffer;
int soft_cmap;
};
#endif /* IF_OGL */
#ifdef IF_WGL
# include <windows.h>
/* The wgl interface as currently implemented uses some
* X11 types, supplied by Tk. */
# include <tk.h>
# ifdef HAVE_GL_GL_H
# include <GL/gl.h>
# endif
struct wgl_fb_info {
Display *dpy;
Window win;
Colormap cmap;
PIXELFORMATDESCRIPTOR *vip;
HDC hdc;
HGLRC glxc;
int double_buffer;
int soft_cmap;
};
#endif /* IF_WGL */
#ifdef IF_QT
struct qt_fb_info {
void *qapp;
void *qwin;
void *qpainter;
void *draw;
void *qimg;
}
#endif /* IF_QT */
#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
*/
-185
View File
@@ -1,185 +0,0 @@
/* F B I O . H
* BRL-CAD
*
* Copyright (c) 2005-2014 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 fbio.h
*
* BRL-CAD Framebuffer Library I/O Interfaces
*
*/
#ifndef FBIO_H
#define FBIO_H
#include "common.h"
#include "bu/magic.h"
#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
/**
* 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.
*/
/* FIXME: ColorMap is same as RLEColorMap defined in 'orle.h' */
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
#define FBIO_NULL (FBIO *) 0
/**
*@brief
* A frame-buffer IO structure.
*
* One of these is allocated for each active framebuffer. A pointer
* to this structure is the first argument to all the library
* routines.
*/
typedef struct FBIO_ {
uint32_t if_magic;
/* Static information: per device TYPE. */
int (*if_open)(struct FBIO_ *ifp, const char *file, int _width, int _height); /**< @brief open device */
int (*if_close)(struct FBIO_ *ifp); /**< @brief close device */
int (*if_clear)(struct FBIO_ *ifp, unsigned char *pp); /**< @brief clear device */
ssize_t (*if_read)(struct FBIO_ *ifp, int x, int y, unsigned char *pp, size_t count); /**< @brief read pixels */
ssize_t (*if_write)(struct FBIO_ *ifp, int x, int y, const unsigned char *pp, size_t count); /**< @brief write pixels */
int (*if_rmap)(struct FBIO_ *ifp, ColorMap *cmap); /**< @brief read colormap */
int (*if_wmap)(struct FBIO_ *ifp, const ColorMap *cmap); /**< @brief write colormap */
int (*if_view)(struct FBIO_ *ifp, int xcent, int ycent, int xzoom, int yzoom); /**< @brief set view */
int (*if_getview)(struct FBIO_ *ifp, int *xcent, int *ycent, int *xzoom, int *yzoom); /**< @brief get view */
int (*if_setcursor)(struct FBIO_ *ifp, const unsigned char *bits, int xb, int yb, int xo, int yo); /**< @brief define cursor */
int (*if_cursor)(struct FBIO_ *ifp, int mode, int x, int y); /**< @brief set cursor */
int (*if_getcursor)(struct FBIO_ *ifp, int *mode, int *x, int *y); /**< @brief get cursor */
int (*if_readrect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read rectangle */
int (*if_writerect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
int (*if_bwreadrect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read monochrome rectangle */
int (*if_bwwriterect)(struct FBIO_ *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
int (*if_poll)(struct FBIO_ *ifp); /**< @brief handle events */
int (*if_flush)(struct FBIO_ *ifp); /**< @brief flush output */
int (*if_free)(struct FBIO_ *ifp); /**< @brief free resources */
int (*if_help)(struct FBIO_ *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. */
/* State variables for individual interface modules */
union {
char *p;
size_t l;
} u1, u2, u3, u4, u5, u6;
} FBIO;
/**
* assert the integrity of an FBIO struct.
*/
#define FB_CK_FBIO(_p) BU_CKMAG(_p, FB_MAGIC, "FBIO")
/* declare all the possible interfaces */
#ifdef IF_REMOTE
FB_EXPORT extern FBIO remote_interface; /* not in list[] */
#endif
#ifdef IF_OGL
FB_EXPORT extern FBIO ogl_interface;
#endif
#ifdef IF_WGL
FB_EXPORT extern FBIO wgl_interface;
#endif
#ifdef IF_X
FB_EXPORT extern FBIO X24_interface;
FB_EXPORT extern FBIO X_interface;
#endif
#ifdef IF_TK
FB_EXPORT extern FBIO tk_interface;
#endif
#ifdef IF_QT
FB_EXPORT extern FBIO qt_interface;
#endif
/* Always included */
FB_EXPORT extern FBIO debug_interface, disk_interface, stk_interface;
FB_EXPORT extern FBIO memory_interface, null_interface;
#endif /* FBIO_H */
/** @} */
/*
* Local Variables:
* mode: C
* tab-width: 8
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+1 -1
View File
@@ -59,7 +59,7 @@ struct fbserv_client {
struct fbserv_obj {
FBIO *fbs_fbp; /**< @brief framebuffer pointer */
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 */
+1 -1
View File
@@ -161,7 +161,7 @@ __BEGIN_DECLS
}
#define GED_CHECK_FBSERV_FBP(_gedp, _flags) \
if (_gedp->ged_fbsp->fbs_fbp == FBIO_NULL) { \
if (_gedp->ged_fbsp->fbs_fbp == FB_NULL) { \
int ged_check_view_quiet = (_flags) & GED_QUIET; \
if (!ged_check_view_quiet) { \
bu_vls_trunc((_gedp)->ged_result_str, 0); \
+1 -1
View File
@@ -116,7 +116,7 @@ extern void brst_log(const char *, ...);
extern int roundToInt(fastf_t f);
extern Colors colorids;
extern FBIO *fbiop;
extern fb *fbiop;
extern FILE *burstfp;
extern FILE *gridfp;
extern FILE *histfp;
+4 -4
View File
@@ -58,7 +58,7 @@ imageInit()
zoom = 1;
/* Determine whether it is necessary to open fbfile. */
if (fbiop == FBIO_NULL || fb_getwidth(fbiop) != devwid)
if (fbiop == FB_NULL || fb_getwidth(fbiop) != devwid)
needopen = 1; /* not currently open or size changed */
else
if (lastfbfile[0] != NUL && !BU_STR_EQUAL(fbfile, lastfbfile))
@@ -89,7 +89,7 @@ openFbDevice(char *fbdev)
ret = 0;
goto safe_exit;
}
if (((fbiop != FBIO_NULL && fb_getwidth(fbiop) != devwid)
if (((fbiop != FB_NULL && fb_getwidth(fbiop) != devwid)
|| pixgrid == NULL)
&& (pixgrid = (unsigned char *) calloc(devwid*3, sizeof(unsigned char)))
== (unsigned char *) NULL) {
@@ -99,7 +99,7 @@ openFbDevice(char *fbdev)
goto safe_exit;
}
(void) memset((char *) pixgrid, NUL, sizeof(unsigned char)*devwid*3);
if (fbiop != FBIO_NULL) {
if (fbiop != FB_NULL) {
if (! closFbDevice()) {
ret = 0;
goto safe_exit;
@@ -132,7 +132,7 @@ closFbDevice()
ret = 0;
else {
ret = 1;
fbiop = FBIO_NULL;
fbiop = FB_NULL;
}
notify(NULL, NOTIFY_DELETE);
return ret;
+1 -1
View File
@@ -35,7 +35,7 @@
Colors colorids; /* ident range to color mappings for plots */
FBIO *fbiop = NULL; /* frame buffer specific access from libfb */
fb *fbiop = NULL; /* frame buffer specific access from libfb */
FILE *burstfp = NULL; /* input stream for burst point locations */
FILE *gridfp = NULL; /* grid file output stream (2-d shots) */
FILE *histfp = NULL; /* histogram output stream (statistics) */
+1 -1
View File
@@ -68,7 +68,7 @@ static int blueflag = 0;
static char *framebuffer = NULL;
static char *file_name;
static int infd;
static FBIO *fbp;
static fb *fbp;
static char usage[] = "\
Usage: bw-fb [-a -i -c -z -R -G -B] [-F framebuffer]\n\
+2 -2
View File
@@ -188,7 +188,7 @@ static int xorigin = 0, yorigin = 0; /* Pixel location of image low lft */
static int view_flag = 0; /* The view that is of interest */
static long maxcells = 10000; /* Max number of cells in the image */
static FBIO *fbiop = FBIO_NULL; /* Frame-buffer device */
static fb *fbiop = FB_NULL; /* Frame-buffer device */
static FILE *filep; /* Input stream */
static struct locrec gp_locs;
@@ -427,7 +427,7 @@ display_Cells(long int ncells)
zoom = 1;
fbiop = fb_open((fbfile[0] != '\0') ? fbfile : NULL, fb_width, fb_height);
if (fbiop == FBIO_NULL)
if (fbiop == FB_NULL)
return 0;
if (compute_fb_height || compute_fb_width) {
bu_log("fb_size requested: %d %d\n", fb_width, fb_height);
+2 -2
View File
@@ -91,7 +91,7 @@ main(int argc, char **argv)
ColorMap cm;
char usage[] = "Usage: cmap-fb [-H -o] [colormap]\n";
FBIO *fbp;
fb *fbp;
FILE *fp;
int fbsize = 512;
int overlay = 0;
@@ -124,7 +124,7 @@ main(int argc, char **argv)
fprintf(stderr, "%s Program continues running:\n", usage);
}
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FBIO_NULL)
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FB_NULL)
bu_exit(3, "Unable to open framebuffer\n");
if (overlay)
+1 -1
View File
@@ -113,7 +113,7 @@ get_args(int argc, char **argv)
int
main(int argc, char **argv)
{
FBIO *fbp;
fb *fbp;
int x, y;
int xin, yin; /* number of sceen output lines */
+2 -2
View File
@@ -40,7 +40,7 @@ Usage: fb-cmap [-H] [colormap]\n";
int
main(int argc, char **argv)
{
FBIO *fbp;
fb *fbp;
FILE *fp;
int fbsize = 512;
int i;
@@ -69,7 +69,7 @@ main(int argc, char **argv)
fprintf(stderr, "%s Program continues running:\n", usage);
}
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FBIO_NULL)
if ((fbp = fb_open(NULL, fbsize, fbsize)) == FB_NULL)
bu_exit(2, "Unable to open framebuffer\n");
i = fb_rmap(fbp, &cm);
+2 -2
View File
@@ -87,7 +87,7 @@ int
main(int argc, char **argv)
{
int y;
FBIO *in_fbp, *out_fbp;
fb *in_fbp, *out_fbp;
int n, m;
int height;
@@ -117,7 +117,7 @@ main(int argc, char **argv)
if (verbose)
fprintf(stderr, "fb-fb: width=%d height=%d\n", scr_width, scr_height);
if ((out_fbp = fb_open(out_fb_name, scr_width, scr_height)) == FBIO_NULL) {
if ((out_fbp = fb_open(out_fb_name, scr_width, scr_height)) == FB_NULL) {
if (out_fb_name)
fprintf(stderr, "fb-fb: unable to open output '%s'\n", out_fb_name);
bu_exit(12, NULL);
+1 -1
View File
@@ -114,7 +114,7 @@ get_args(int argc, char **argv)
int
main(int argc, char **argv)
{
FBIO *fbp;
fb *fbp;
int y;
unsigned char *scanline; /* 1 scanline pixel buffer */
+1 -1
View File
@@ -125,7 +125,7 @@ main(int argc, char **argv)
static int scanpix; /* # of pixels of scanline */
static ColorMap cmap; /* libfb color map */
FBIO *fbp;
fb *fbp;
int y;
int got;
png_structp png_p;
+3 -3
View File
@@ -159,7 +159,7 @@ get_args(int argc, char **argv)
int
main(int argc, char **argv)
{
FBIO *fbp;
fb *fbp;
unsigned char *scan_buf;
int y;
int cm_save_needed;
@@ -176,7 +176,7 @@ main(int argc, char **argv)
if (screen_height == 0 && file_height > 0)
screen_height = file_height;
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FBIO_NULL)
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FB_NULL)
bu_exit(12, NULL);
/* Honor original screen size desires, if set, unless they shrank */
@@ -256,7 +256,7 @@ main(int argc, char **argv)
/* Add comments to the header file, since we have one */
if (framebuffer == (char *)0)
framebuffer = fbp->if_name;
framebuffer = fb_get_name(fbp);
snprintf(comment, COMMENT_SIZE, "encoded_from=%s", framebuffer);
rle_putcom(bu_strdup(comment), &outrle);
now = time(0);
+1 -1
View File
@@ -45,7 +45,7 @@ int usec;
void newframe(int i);
FBIO *fbp;
fb *fbp;
int screen_width; /* Number of pixels/line in frame buffer */
int screen_height;
int verbose = 0;
+1 -1
View File
@@ -215,7 +215,7 @@ int
main(int argc, char **argv)
{
int x, y;
FBIO *fbp;
fb *fbp;
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
printusage();
+1 -1
View File
@@ -40,7 +40,7 @@
static char *framebuffer = NULL;
static FBIO *fbp;
static fb *fbp;
static int scr_width = 0; /* use default size */
static int scr_height = 0;
static int clear_and_reset = 0;
+1 -1
View File
@@ -651,7 +651,7 @@ main(int argc, char **argv)
int fudge;
ColorMap cmap;
ColorMap *cp = &cmap;
FBIO *fbp;
fb *fbp;
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
usage();
+2 -2
View File
@@ -47,7 +47,7 @@ double fps = 0.0; /* frames per second */
int increment = 1;
int onestep = 0;
FBIO *fbp;
fb *fbp;
static char usage[] = "\
Usage: fbcmrot [-H -i increment] steps_per_second\n";
@@ -113,7 +113,7 @@ main(int argc, char **argv)
tv.tv_usec = (long) (((1.0 / fps) - tv.tv_sec) * 1000000);
}
if ((fbp = fb_open(NULL, size, size)) == FBIO_NULL) {
if ((fbp = fb_open(NULL, size, size)) == FB_NULL) {
fprintf(stderr, "fbcmrot: fb_open failed\n");
return 1;
}
+2 -2
View File
@@ -47,7 +47,7 @@ ColorMap old_map;
ColorMap cm;
static char *framebuffer = NULL;
static FBIO *fbp;
static fb *fbp;
static int scr_height;
static int scr_width;
@@ -80,7 +80,7 @@ main(int argc, char **argv)
bu_exit(1, NULL);
}
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FBIO_NULL) {
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FB_NULL) {
fprintf(stderr, "fbcolor: fb_open(%s) failure\n", framebuffer);
return 1;
}
+6 -6
View File
@@ -75,7 +75,7 @@ typedef int bool_t;
static bool_t hires = 0; /* set for 1Kx1K; clear for 512x512 */
static char *in_fb_file = NULL; /* input image name */
static char *out_fb_file = NULL; /* output frame buffer name */
static FBIO *fbp = FBIO_NULL; /* libfb input/output handle */
static fb *fbp = FB_NULL; /* libfb input/output handle */
static int src_width = 0; /* input image width */
static int src_height = 0; /* input image height */
static int dst_width = 0; /* output frame buffer size */
@@ -85,7 +85,7 @@ static RGBpixel bg = { 0, 0, 0 }; /* background */
/* in ioutil.c */
extern void Message(const char *format, ...);
extern void Fatal(FBIO *fbiop, const char *format, ...);
extern void Fatal(fb *fbiop, const char *format, ...);
static void
@@ -215,7 +215,7 @@ main(int argc, char **argv)
if (in_fb_file != NULL) {
if ((fbp = fb_open(in_fb_file, src_width, src_height)) == FBIO_NULL)
if ((fbp = fb_open(in_fb_file, src_width, src_height)) == FB_NULL)
Fatal(fbp, "Couldn't open input frame buffer");
else {
int y;
@@ -239,7 +239,7 @@ main(int argc, char **argv)
}
if (fb_close(fbp) == -1) {
fbp = FBIO_NULL; /* avoid second try */
fbp = FB_NULL; /* avoid second try */
Fatal(fbp, "Error closing input frame buffer");
}
}
@@ -253,7 +253,7 @@ main(int argc, char **argv)
if (dst_height == 0)
dst_height = src_height; /* default */
if ((fbp = fb_open(out_fb_file, dst_width, dst_height)) == FBIO_NULL)
if ((fbp = fb_open(out_fb_file, dst_width, dst_height)) == FB_NULL)
Fatal(fbp, "Couldn't open output frame buffer");
else {
int wt = fb_getwidth(fbp);
@@ -316,7 +316,7 @@ main(int argc, char **argv)
/* Close the frame buffer. */
if (fb_close(fbp) == -1) {
fbp = FBIO_NULL; /* avoid second try */
fbp = FB_NULL; /* avoid second try */
Fatal(fbp, "Error closing output frame buffer");
}
+2 -2
View File
@@ -43,7 +43,7 @@ main(int argc, char **argv)
{
int c;
int x;
FBIO *fbp;
fb *fbp;
int xsize, ysize;
int len;
char *framebuffer = (char *)NULL;
@@ -90,7 +90,7 @@ main(int argc, char **argv)
if (argc == 1 && isatty(fileno(stdin)) && isatty(fileno(stdout)))
USAGE_EXIT(*argv);
if ((fbp = fb_open(framebuffer, xsize, ysize)) == FBIO_NULL)
if ((fbp = fb_open(framebuffer, xsize, ysize)) == FB_NULL)
bu_exit(1, NULL);
if (xsize <= 0)
+2 -2
View File
@@ -43,7 +43,7 @@ int
main(int argc, char **argv)
{
int c;
FBIO *fbp;
fb *fbp;
while ((c = bu_getopt(argc, argv, "F:h?")) != -1) {
switch (c) {
@@ -59,7 +59,7 @@ main(int argc, char **argv)
fprintf(stderr, "fbfree: excess argument(s) ignored\n");
}
if ((fbp = fb_open(framebuffer, 0, 0)) == FBIO_NULL) {
if ((fbp = fb_open(framebuffer, 0, 0)) == FB_NULL) {
fprintf(stderr, "fbfree: Can't open frame buffer\n");
return 1;
}
+16 -16
View File
@@ -49,7 +49,7 @@ int image = 0;
static char usage[] = "\
Usage: fbgamma [-H -o -i] [-F framebuffer] val [gval bval]\n";
void mk_ramp(FBIO *fb, int r, int g, int b, int n)
void mk_ramp(fb *fb_i, int r, int g, int b, int n)
{
/* grey ramp */
@@ -62,7 +62,7 @@ void mk_ramp(FBIO *fb, int r, int g, int b, int n)
else line[x*3+2] = 0;
}
for (y=patch_height*n; y < patch_height*(n+1) && y < scr_height; ++y) {
fb_write(fb, 0, y, line, scr_width);
fb_write(fb_i, 0, y, line, scr_width);
}
for (x=0; x < scr_width; ++x) {
@@ -74,17 +74,17 @@ void mk_ramp(FBIO *fb, int r, int g, int b, int n)
else line[x*3+2] = 0;
}
for (y=patch_height*(n+1); y < patch_height*(n+2) && y < scr_height; y += 2) {
fb_write(fb, 0, y, altline, scr_width);
fb_write(fb, 0, y+1, line, scr_width);
fb_write(fb_i, 0, y, altline, scr_width);
fb_write(fb_i, 0, y+1, line, scr_width);
}
}
void disp_image(FBIO *fb)
void disp_image(fb *fb_i)
{
scr_width = fb_getwidth(fb);
scr_height = fb_getheight(fb);
scr_width = fb_getwidth(fb_i);
scr_height = fb_getheight(fb_i);
patch_width = scr_width / 8;
patch_height = scr_height / 14;
@@ -92,13 +92,13 @@ void disp_image(FBIO *fb)
line = (unsigned char *) bu_malloc(scr_width*3, "line");
altline = (unsigned char *) bu_calloc(scr_width*3, sizeof(unsigned char), "altline");
mk_ramp(fb, 1, 1, 1, 0);
mk_ramp(fb, 1, 0, 0, 2);
mk_ramp(fb, 1, 1, 0, 4);
mk_ramp(fb, 0, 1, 0, 6);
mk_ramp(fb, 0, 1, 1, 8);
mk_ramp(fb, 0, 0, 1, 10);
mk_ramp(fb, 1, 0, 1, 12);
mk_ramp(fb_i, 1, 1, 1, 0);
mk_ramp(fb_i, 1, 0, 0, 2);
mk_ramp(fb_i, 1, 1, 0, 4);
mk_ramp(fb_i, 0, 1, 0, 6);
mk_ramp(fb_i, 0, 1, 1, 8);
mk_ramp(fb_i, 0, 0, 1, 10);
mk_ramp(fb_i, 1, 0, 1, 12);
(void)bu_free(line, "line");
(void)bu_free(altline, "altline");
@@ -115,7 +115,7 @@ main(int argc, char **argv)
double gamr = 0, gamg = 0, gamb = 0; /* gamma's */
double f;
ColorMap cm;
FBIO *fbp;
fb *fbp;
onegamma = 0;
@@ -152,7 +152,7 @@ main(int argc, char **argv)
bu_exit(1, "%s", usage);
}
if ((fbp = fb_open(framebuffer, fbsize, fbsize)) == FBIO_NULL) {
if ((fbp = fb_open(framebuffer, fbsize, fbsize)) == FB_NULL) {
bu_exit(2, "Unable to open framebuffer\n");
}
+2 -2
View File
@@ -101,9 +101,9 @@ do_file(void)
void
do_fb(void)
{
FBIO *fbp;
fb *fbp;
if ((fbp = fb_open(framebuffer, 0, 0)) == FBIO_NULL) {
if ((fbp = fb_open(framebuffer, 0, 0)) == FB_NULL) {
bu_exit(2, "Unable to open framebuffer\n");
}
if (fb_wmap(fbp, &map) < 0)
+4 -4
View File
@@ -31,7 +31,7 @@
#include "fb.h"
static unsigned char *white_line, *grey_line, *dark_line;
static FBIO *fbp;
static fb *fbp;
static char *framebuffer = NULL;
#define OLD 0
@@ -43,7 +43,7 @@ static int fbheight = 0;
static int flavor = DECIMAL;
static int clear = 0;
void grid(FBIO *fbiop, unsigned char *line, int spacing), oldflavor(void);
void grid(fb *fbiop, unsigned char *line, int spacing), oldflavor(void);
static char usage[] = "\
Usage: fbgrid [-c] [-b | -d | -o] [-F framebuffer]\n\
@@ -155,7 +155,7 @@ main(int argc, char **argv)
void
grid(FBIO *fbiop, unsigned char *line, int spacing)
grid(fb *fbiop, unsigned char *line, int spacing)
{
int x, y;
@@ -170,7 +170,7 @@ grid(FBIO *fbiop, unsigned char *line, int spacing)
void
oldflavor(void)
{
FBIO *fbiop;
fb *fbiop;
int x, y;
int middle;
int mask;
+2 -2
View File
@@ -43,7 +43,7 @@ int
main(int argc, char **argv)
{
int c;
FBIO *fbp;
fb *fbp;
while ((c = bu_getopt(argc, argv, "F:h?")) != -1) {
switch (c) {
@@ -71,7 +71,7 @@ Type \"man brlcad\" for more information.\n");
fb_genhelp();
printf("=============== Current Selection ================\n");
if ((fbp = fb_open(framebuffer, 0, 0)) == FBIO_NULL) {
if ((fbp = fb_open(framebuffer, 0, 0)) == FB_NULL) {
fprintf(stderr, "fbhelp: Can't open frame buffer\n");
return 1;
}
+1 -1
View File
@@ -41,7 +41,7 @@
static char *framebuffer = NULL;
static char *font1 = NULL;
FBIO *fbp;
fb *fbp;
static char usage[] = "\
Usage: fblabel [-c -a] [-F framebuffer] [-C r/g/b]\n\
+1 -1
View File
@@ -57,7 +57,7 @@ struct stroke {
}; /* rasterization descriptor */
static char *framebuffer = NULL;
FBIO *fbp; /* Current framebuffer */
fb *fbp; /* Current framebuffer */
static int screen_width = 512; /* default input width */
static int screen_height = 512; /* default input height */
+1 -1
View File
@@ -38,7 +38,7 @@
#include "fb.h"
#include "libtermio.h"
FBIO *fbp;
fb *fbp;
int JumpSpeed; /* # pixels skiped with fast commands. */
+1 -1
View File
@@ -45,7 +45,7 @@ int fb_overlay = 0; /* plot on background, else black with grid */
int cmap_crunch = 0; /* Plot values after passing through color map */
int reverse = 0; /* highlight chosen line by inverting it */
char *outframebuffer = NULL;
FBIO *fbp, *fboutp;
fb *fbp, *fboutp;
ColorMap map;
char usage[] = "\
+11 -11
View File
@@ -97,9 +97,9 @@ static float y_scale = -1.0; /* vertical scaling factor */
static bool_t x_compress; /* set if compressing horizontally */
static bool_t y_compress; /* set if compressing vertically */
static char *src_file = NULL; /* source frame buffer name */
static FBIO *src_fbp = FBIO_NULL; /* source frame buffer handle */
static fb *src_fbp = FB_NULL; /* source frame buffer handle */
static char *dst_file = NULL; /* destination frame buffer name */
static FBIO *dst_fbp = FBIO_NULL; /* destination frame buffer handle */
static fb *dst_fbp = FB_NULL; /* destination frame buffer handle */
static int src_width = 512;
static int src_height = 512; /* source image size */
static int dst_width = 0;
@@ -109,23 +109,23 @@ static unsigned char *dst_buf; /* calloc()ed output scan line buffer */
/* in ioutil.c */
extern void Message(const char *format, ...);
extern void Fatal(FBIO *fbiop, const char *format, ...);
extern void Fatal(fb *fbiop, const char *format, ...);
static void
Stretch_Fatal(const char *str)
{
if (src_fbp != FBIO_NULL && fb_close(src_fbp) == -1) {
if (src_fbp != FB_NULL && fb_close(src_fbp) == -1) {
Message("Error closing input frame buffer");
src_fbp = FBIO_NULL;
src_fbp = FB_NULL;
}
if (dst_fbp != FBIO_NULL && fb_close(dst_fbp) == -1) {
if (dst_fbp != FB_NULL && fb_close(dst_fbp) == -1) {
Message("Error closing output frame buffer");
src_fbp = FBIO_NULL;
src_fbp = FB_NULL;
}
Fatal(FBIO_NULL, "%s", str);
Fatal(FB_NULL, "%s", str);
/* NOT REACHED */
}
@@ -298,7 +298,7 @@ main(int argc, char **argv)
if ((src_fbp = fb_open(src_file == NULL ? dst_file : src_file,
src_width, src_height
)
) == FBIO_NULL
) == FB_NULL
)
Stretch_Fatal("Couldn't open input image");
else {
@@ -331,7 +331,7 @@ main(int argc, char **argv)
)
dst_fbp = src_fbp; /* No No No Not a Second Time */
else if ((dst_fbp = fb_open(dst_file, dst_width, dst_height))
== FBIO_NULL
== FB_NULL
)
Stretch_Fatal("Couldn't open output frame buffer");
@@ -791,7 +791,7 @@ main(int argc, char **argv)
done:
/* Close the frame buffers. */
assert(src_fbp != FBIO_NULL && dst_fbp != FBIO_NULL);
assert(src_fbp != FB_NULL && dst_fbp != FB_NULL);
if (fb_close(src_fbp) == -1)
Message("Error closing input frame buffer");
+1 -1
View File
@@ -59,7 +59,7 @@ static int scr_width = 512; /* screen size */
static int scr_height = 512;
static int toggle_pan = 0; /* Reverse sense of pan commands? */
static char *framebuffer = NULL;
static FBIO *fbp;
static fb *fbp;
static char usage[] = "\
Usage: fbzoom [-T] [-F framebuffer]\n\
+5 -5
View File
@@ -89,7 +89,7 @@ static int image = 0; /* # of image to display (0 => all) */
static char *gif_file = NULL; /* GIF file name */
static FILE *gfp = NULL; /* GIF input stream handle */
static char *fb_file = NULL; /* frame buffer name */
static FBIO *fbp = FBIO_NULL; /* frame buffer handle */
static fb *fbp = FB_NULL; /* frame buffer handle */
static int ht; /* virtual frame buffer height */
static int width, height; /* overall "screen" size */
static int write_width; /* used width of screen, <= width */
@@ -112,7 +112,7 @@ static RGBpixel *cmap; /* bu_malloc()ed local color map */
/* in ioutil.c */
void Message(const char *format, ...);
void Fatal(FBIO *fbiop, const char *format, ...);
void Fatal(fb *fbiop, const char *format, ...);
static void
@@ -670,7 +670,7 @@ main(int argc, char **argv)
pixbuf = (unsigned char *)bu_malloc(width * sizeof(RGBpixel), "pixbuf");
if ((fbp = fb_open(fb_file, width, height)) == FBIO_NULL) {
if ((fbp = fb_open(fb_file, width, height)) == FB_NULL) {
Fatal(fbp, "Couldn't open frame buffer");
}
@@ -738,11 +738,11 @@ main(int argc, char **argv)
also "screen clear", but they're impractical. */
if (fb_close(fbp) == -1) {
fbp = FBIO_NULL; /* avoid second try */
fbp = FB_NULL; /* avoid second try */
Fatal(fbp, "Error closing frame buffer");
}
fbp = FBIO_NULL;
fbp = FB_NULL;
if (image > 0)
Fatal(fbp, "Specified image not found");
+1 -1
View File
@@ -124,7 +124,7 @@ main(int argc, char **argv)
static int lace[4] = {8, 8, 4, 2};
static int offs[4] = {0, 4, 2, 1};
FBIO *fbp;
fb *fbp;
FILE *fp;
while ((code = bu_getopt(argc, argv, "HvFh?")) != -1) {
+3 -3
View File
@@ -61,7 +61,7 @@ Message(const char *format, ...)
void
Fatal(FBIO *fbp, const char *format, ...)
Fatal(fb *fbp, const char *format, ...)
{
va_list ap;
@@ -69,9 +69,9 @@ Fatal(FBIO *fbp, const char *format, ...)
VMessage(format, ap);
va_end(ap);
if (fbp != FBIO_NULL && fb_close(fbp) == -1) {
if (fbp != FB_NULL && fb_close(fbp) == -1) {
Message("Error closing frame buffer");
fbp = FBIO_NULL;
fbp = FB_NULL;
}
bu_exit(EXIT_FAILURE, NULL);
+1 -1
View File
@@ -206,7 +206,7 @@ int
main(int argc, char **argv)
{
int y;
FBIO *fbp;
fb *fbp;
int xout, yout, n, m, xstart, xskip;
if (!get_args(argc, argv)) {
+2 -2
View File
@@ -55,7 +55,7 @@ char *input_basename; /* basename of input file(s) */
int framenumber = 0; /* starting frame number (default is 0) */
int fps = 8; /* frames/second */
FBIO *fbp;
fb *fbp;
int verbose = 0;
int rocking = 0;
int passes = 100; /* limit on number of passes */
@@ -189,7 +189,7 @@ main(int argc, char **argv)
bu_exit(12, NULL);
}
if ((fbp = fb_open(NULL, screen_width, screen_height)) == FBIO_NULL) {
if ((fbp = fb_open(NULL, screen_width, screen_height)) == FB_NULL) {
fprintf(stderr, "pixflip-fb: fb_open failed\n");
bu_exit(12, NULL);
}
+2 -2
View File
@@ -310,7 +310,7 @@ static int sigs[] = {
static FILE *pfin; /* input file FIO block ptr */
FBIO *fbp; /* Current framebuffer */
fb *fbp; /* Current framebuffer */
/*
@@ -1362,7 +1362,7 @@ main(int argc, char **argv)
}
/* Open frame buffer, adapt to slightly smaller ones */
if ((fbp = fb_open(framebuffer, Npixels, Nscanlines)) == FBIO_NULL) {
if ((fbp = fb_open(framebuffer, Npixels, Nscanlines)) == FB_NULL) {
fprintf(stderr, "plot3-fb: fb_open failed\n");
bu_exit(1, NULL);
}
+1 -1
View File
@@ -161,7 +161,7 @@ int
main(int argc, char **argv)
{
int y;
FBIO *fbp;
fb *fbp;
int i;
int xout, yout, m, xstart;
png_structp png_p;
+2 -2
View File
@@ -382,7 +382,7 @@ main (int argc, char **argv)
int unit_r = -1; /* Radius of unit circle (in pixels) */
int x, y; /* Cartesian coordinates of current pixel */
int Xprime, Yprime; /* Translated pixel */
FBIO *fbPtr; /* Pointer to the frame-buffer file */
fb *fbPtr; /* Pointer to the frame-buffer file */
unsigned char *fbb; /* Buffer for current line of frame buffer */
unsigned char *fbbPtr; /* Pointer to within fbb */
@@ -723,7 +723,7 @@ main (int argc, char **argv)
arc_max *= Deg2Rad;
/* Prep the frame buffer */
if ((fbPtr = fb_open(FB_Name, fb_width, fb_height)) == FBIO_NULL)
if ((fbPtr = fb_open(FB_Name, fb_width, fb_height)) == FB_NULL)
(void) bu_exit (1, NULL);
fb_width = fb_getwidth(fbPtr);
fb_height = fb_getheight(fbPtr);
+1 -1
View File
@@ -73,7 +73,7 @@
#include "libtermio.h"
FBIO *fbp;
fb *fbp;
char ibuf[1024]; /* pp file buffer */
+2 -2
View File
@@ -139,7 +139,7 @@ get_args(int argc, char **argv)
int
main(int argc, char **argv)
{
FBIO *fbp;
fb *fbp;
int i;
int file_width; /* unclipped width of rectangle */
int file_skiplen; /* # of pixels to skip on l.h.s. */
@@ -218,7 +218,7 @@ main(int argc, char **argv)
rle_dflt_hdr.xmax -= screen_xbase;
rle_dflt_hdr.xmin = 0;
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FBIO_NULL)
if ((fbp = fb_open(framebuffer, screen_width, screen_height)) == FB_NULL)
bu_exit(12, NULL);
/* Honor original screen size desires, if set, unless they shrank */
+3 -3
View File
@@ -33,7 +33,7 @@
#include "spm.h"
static FBIO *fbp;
static fb *fbp;
static char *framebuffer = NULL;
static int scr_width = 0;
@@ -155,13 +155,13 @@ main(int argc, char **argv)
bu_exit(1, NULL);
}
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FBIO_NULL)
if ((fbp = fb_open(framebuffer, scr_width, scr_height)) == FB_NULL)
bu_exit(12, NULL);
scr_width = fb_getwidth(fbp);
scr_height = fb_getheight(fbp);
mp = bn_spm_init(vsize, sizeof(RGBpixel));
if (mp == BN_SPM_MAP_NULL || fbp == FBIO_NULL)
if (mp == BN_SPM_MAP_NULL || fbp == FB_NULL)
bu_exit(1, NULL);
bn_spm_load(mp, file_name);
+2 -2
View File
@@ -192,8 +192,8 @@ main(int argc, char **argv)
bu_exit(1, NULL);
}
FBIO *ifp;
ifp = (FBIO *) calloc(sizeof(FBIO), 1);
fb *ifp;
ifp = (fb *) calloc(sizeof(fb), 1);
ifp->if_name = "/dev/tk";
ifp->if_magic = FB_MAGIC;
char *fbname = "/dev/tk";
+1 -1
View File
@@ -64,7 +64,7 @@ typedef struct
}
Panel;
extern FBIO *fbp;
extern fb *fbp;
extern RGBpixel *menu_addr;
extern RGBpixel paint;
extern Point cursor_pos;
+4 -4
View File
@@ -324,7 +324,7 @@ Func_Tab func_tab[] = {
static Func_Tab *bindings[DEL+1];
static Func_Tab *macro_entry = FT_NULL; /* Last keyboard macro defined. */
FBIO *fbp; /* Current framebuffer */
fb *fbp; /* Current framebuffer */
static int cur_width = 512;
int
@@ -1721,13 +1721,13 @@ HIDDEN int
f_Rd_Fb() /* Read frame buffer image from file. */
{
static char image[MAX_LN];
static FBIO *imp;
static fb *imp;
if (!get_Input(image, MAX_LN, "Enter framebuffer name : "))
return 0;
if (image[0] == NUL) {
fb_log("No default.\n");
return 0;
} else if ((imp = fb_open(image, 512, 512)) == FBIO_NULL) {
} else if ((imp = fb_open(image, 512, 512)) == FB_NULL) {
/* XXX */
fb_log( "Can't open \"%s\" for reading.\n", image);
@@ -1873,7 +1873,7 @@ pars_Argv(int argc, char **argv)
HIDDEN int
fb_Setup(void)
{
if ((fbp = fb_open(NULL, cur_width, cur_width)) == FBIO_NULL) {
if ((fbp = fb_open(NULL, cur_width, cur_width)) == FB_NULL) {
fb_log("Could not open default frame buffer.\n");
return -1;
}
+6 -8
View File
@@ -80,6 +80,7 @@
#include "bio.h"
#include "bin.h"
#include "../libfb/fb_private.h" /* for _fb_disk_enable */
#include "fb.h"
#include "pkg.h"
#include "bu.h"
@@ -109,7 +110,7 @@ int verbose = 0;
/* from server.c */
extern const struct pkg_switch fb_server_pkg_switch[];
extern FBIO *fb_server_fbp;
extern fb *fb_server_fbp;
extern fd_set *fb_server_select_list;
extern int *fb_server_max_fd;
extern int fb_server_got_fb_free; /* !0 => we have received an fb_free */
@@ -199,7 +200,7 @@ static void
sigalarm(int UNUSED(code))
{
printf("alarm %s\n", fb_server_fbp ? "FBP" : "NULL");
if ( fb_server_fbp != FBIO_NULL ) {
if ( fb_server_fbp != FB_NULL ) {
fb_poll(fb_server_fbp);
}
#ifdef SIGALRM
@@ -341,7 +342,7 @@ main_loop(void)
continue;
}
/* Handle any events from the framebuffer */
if (fb_server_fbp && fb_server_fbp->if_selfd > 0 && FD_ISSET(fb_server_fbp->if_selfd, &infds)) {
if (fb_is_set_fd(fb_server_fbp, &infds)) {
fb_poll(fb_server_fbp);
}
@@ -445,12 +446,9 @@ main(int argc, char **argv)
fb_server_retain_on_close = 1; /* don't ever close the frame buffer */
/* open a frame buffer */
if ( (fb_server_fbp = fb_open(framebuffer, width, height)) == FBIO_NULL )
if ( (fb_server_fbp = fb_open(framebuffer, width, height)) == FB_NULL )
bu_exit(1, NULL);
if ( fb_server_fbp->if_selfd > 0 ) {
FD_SET(fb_server_fbp->if_selfd, &select_list);
max_fd = fb_server_fbp->if_selfd;
}
max_fd = fb_set_fd(fb_server_fbp, &select_list);
/* check/default port */
if ( port_set ) {
+14 -18
View File
@@ -49,7 +49,7 @@
* These are the only symbols intended for export to LIBFB users.
*/
FBIO *fb_server_fbp = FBIO_NULL;
fb *fb_server_fbp = FB_NULL;
fd_set *fb_server_select_list;
int *fb_server_max_fd = (int *)NULL;
int fb_server_got_fb_free = 0; /* !0 => we have received an fb_free */
@@ -92,7 +92,7 @@ fb_server_fb_open(struct pkg_conn *pcp, char *buf)
width = pkg_glong(&buf[0*NET_LONG_LEN]);
height = pkg_glong(&buf[1*NET_LONG_LEN]);
if (fb_server_fbp == FBIO_NULL) {
if (fb_server_fbp == FB_NULL) {
/* Attempt to open new framebuffer */
if (strlen(&buf[8]) == 0)
fb_server_fbp = fb_open(NULL, width, height);
@@ -102,24 +102,22 @@ fb_server_fb_open(struct pkg_conn *pcp, char *buf)
/* Use existing framebuffer */
}
if (fb_server_fbp == FBIO_NULL) {
if (fb_server_fbp == FB_NULL) {
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], -1); /* ret */
(void)pkg_plong(&rbuf[1*NET_LONG_LEN], 0);
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], 0);
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], 0);
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], 0);
} else {
int selfd = 0;
(void)pkg_plong(&rbuf[0*NET_LONG_LEN], 0); /* ret */
(void)pkg_plong(&rbuf[1*NET_LONG_LEN], fb_server_fbp->if_max_width);
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], fb_server_fbp->if_max_height);
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], fb_server_fbp->if_width);
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], fb_server_fbp->if_height);
if (fb_server_fbp->if_selfd > 0 && fb_server_select_list) {
FD_SET(fb_server_fbp->if_selfd, fb_server_select_list);
if (fb_server_max_fd != NULL &&
fb_server_fbp->if_selfd > *fb_server_max_fd)
*fb_server_max_fd = fb_server_fbp->if_selfd;
}
(void)pkg_plong(&rbuf[1*NET_LONG_LEN], fb_get_max_width(fb_server_fbp));
(void)pkg_plong(&rbuf[2*NET_LONG_LEN], fb_get_max_height(fb_server_fbp));
(void)pkg_plong(&rbuf[3*NET_LONG_LEN], fb_getwidth(fb_server_fbp));
(void)pkg_plong(&rbuf[4*NET_LONG_LEN], fb_getheight(fb_server_fbp));
selfd = fb_set_fd(fb_server_fbp, fb_server_select_list);
if (fb_server_max_fd != NULL && selfd > *fb_server_max_fd)
*fb_server_max_fd = selfd;
}
want = 5*NET_LONG_LEN;
@@ -142,11 +140,9 @@ fb_server_fb_close(struct pkg_conn *pcp, char *buf)
(void)fb_flush(fb_server_fbp);
(void)pkg_plong(&rbuf[0], 0); /* return success */
} else {
if (fb_server_fbp->if_selfd > 0 && fb_server_select_list) {
FD_CLR(fb_server_fbp->if_selfd, fb_server_select_list);
}
(void)fb_clear_fd(fb_server_fbp, fb_server_select_list);
(void)pkg_plong(&rbuf[0], fb_close(fb_server_fbp));
fb_server_fbp = FBIO_NULL;
fb_server_fbp = FB_NULL;
}
/* Don't check for errors, SGI linger mode or other events
* may have already closed down all the file descriptors.
@@ -176,7 +172,7 @@ fb_server_fb_free(struct pkg_conn *pcp, char *buf)
(void)pkg_plong(&rbuf[0], -1);
} else {
(void)pkg_plong(&rbuf[0], fb_free(fb_server_fbp));
fb_server_fbp = FBIO_NULL;
fb_server_fbp = FB_NULL;
}
if (pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp) != NET_LONG_LEN)
+7 -7
View File
@@ -987,7 +987,7 @@ f_Cursor_Module()
(void) fb_window(fbiop, cx, cy);
break;
case IN :
if (zoom <= fbiop->if_width/2) {
if (zoom <= fb_getwidth(fbiop)/2) {
zoom *= 2;
cx = x;
cy = y;
@@ -1207,14 +1207,14 @@ f_Animate()
return -1;
(void) signal(SIGINT, abort_RT);
for (frame_no = 0; ! user_interrupt; frame_no++) {
FBIO *movie_fbiop;
fb *movie_fbiop;
int y;
if (frame_no == noframes)
frame_no = 0;
(void) sprintf(suffixptr, ".%04d", frame_no);
if (!bu_file_exists(movie_file, NULL))
continue;
if ((movie_fbiop = fb_open(movie_file, grid_sz, grid_sz)) == FBIO_NULL) {
if ((movie_fbiop = fb_open(movie_file, grid_sz, grid_sz)) == FB_NULL) {
(void) signal(SIGINT, norml_sig);
close_Output_Device(0);
return -1;
@@ -1359,7 +1359,7 @@ f_Wrt_Fb(char **args)
{
int y;
static char save_fb_file[MAX_LN] = { 0 };
FBIO *save_fbiop;
fb *save_fbiop;
if (args != NULL && args[1] != NULL)
bu_strlcpy(save_fb_file, args[1], MAX_LN);
else
@@ -1382,7 +1382,7 @@ f_Wrt_Fb(char **args)
return -1;
prnt_Event("Saving image...");
if ((save_fbiop =
fb_open(save_fb_file, grid_sz, grid_sz))== FBIO_NULL) {
fb_open(save_fb_file, grid_sz, grid_sz))== FB_NULL) {
close_Output_Device(0);
return -1;
}
@@ -1421,7 +1421,7 @@ f_Rd_Fb(char **args)
{
int y;
static char save_fb_file[MAX_LN] = { 0 };
FBIO *save_fbiop;
fb *save_fbiop;
if (args != NULL && args[1] != NULL)
bu_strlcpy(save_fb_file, args[1], MAX_LN);
else
@@ -1443,7 +1443,7 @@ f_Rd_Fb(char **args)
return -1;
prnt_Event("Reading saved image...");
if ((save_fbiop =
fb_open(save_fb_file, grid_sz, grid_sz)) == FBIO_NULL) {
fb_open(save_fb_file, grid_sz, grid_sz)) == FB_NULL) {
close_Output_Device(0);
return -1;
}
+1 -1
View File
@@ -78,7 +78,7 @@ extern void update_Screen();
extern void user_Interaction();
/* variables */
extern FBIO *fbiop;
extern fb *fbiop;
extern RGBpixel bgpixel;
extern RGBpixel *ir_table;
+1 -1
View File
@@ -45,7 +45,7 @@ fb_Setup(char *file, int size)
file = "/dev/debug";
prnt_Event( "Opening device..." );
if (((fbiop = fb_open(file[0] == '\0' ? NULL : file, size, size)) == FBIO_NULL) ||
if (((fbiop = fb_open(file[0] == '\0' ? NULL : file, size, size)) == FB_NULL) ||
(fb_ioinit( fbiop ) == -1) ||
(fb_wmap( fbiop, COLORMAP_NULL ) == -1))
return 0;
+1 -1
View File
@@ -32,7 +32,7 @@
#include "./lgt.h"
#include "./extern.h"
#include "./tree.h"
FBIO *fbiop = FBIO_NULL; /* Framebuffer interface ptr. */
fb *fbiop = FB_NULL; /* Framebuffer interface ptr. */
/* Initialization for root of IR data base octree. */
PtList ir_ptlist = { {0.0, 0.0, 0.0}, PTLIST_NULL };
+1 -1
View File
@@ -82,7 +82,7 @@ ir_Chk_Table(void)
static int
adjust_Page(int y)
{
int scans_per_page = fbiop->if_ppixels/fbiop->if_width;
int scans_per_page = fb_get_pagebuffer_pixel_size(fbiop)/fb_getwidth(fbiop);
int newy = y - (y % scans_per_page);
return newy;
}
+1 -1
View File
@@ -223,7 +223,7 @@ close_Output_Device(int frame)
if ((movie.m_noframes > 1 && movie.m_fullscreen) ||
(frame == movie.m_endframe)) {
(void) fb_close(fbiop);
fbiop = FBIO_NULL;
fbiop = FB_NULL;
}
return;
}
+2 -2
View File
@@ -152,12 +152,12 @@ init_Icon_Texture(char *file, Mat_Db_Entry *entry)
static struct fb_texture *
init_Fb_Texture(char *file, Mat_Db_Entry *entry)
{
FBIO *txfbiop;
fb *txfbiop;
struct fb_texture *fbp;
RGBpixel *fbmap;
int wid = entry->df_rgb[0] << 3;
int hgt = entry->df_rgb[1] << 3;
if ( (txfbiop = fb_open( file, wid, hgt )) == FBIO_NULL )
if ( (txfbiop = fb_open( file, wid, hgt )) == FB_NULL )
return NULL;
fbmap = (RGBpixel *) bu_malloc( wid*hgt*sizeof(RGBpixel), "fbmap" );
#if DEBUG_TEXTURE
+1 -1
View File
@@ -109,7 +109,7 @@ set(LIBDM_SRCS
tcl.c
vers.c
)
set_property(SOURCE dm_obj.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
BRLCAD_ADDLIB(libdm "${LIBDM_SRCS}" "libged;librt;libfb;${DM_X_LIBS};${DM_TKLIB};${DM_EXTRA_LIBS}")
set_target_properties(libdm PROPERTIES VERSION 20.0.1 SOVERSION 20)
+4
View File
@@ -58,6 +58,10 @@ dm_draw_data_axes(struct dm *dmp,
DM_SET_FGCOLOR(dmp, gdasp->gdas_color[0], gdasp->gdas_color[1], gdasp->gdas_color[2], 1, 1.0);
#if defined(IF_OGL) || defined(IF_WGL)
# ifdef HAVE_GL_GL_H
# include <GL/gl.h>
# endif
if (gdasp->gdas_draw > 1) {
if (dmp->dm_light)
glDisable(GL_LIGHTING);
+1 -1
View File
@@ -278,7 +278,7 @@ null_makeCurrent(struct dm *UNUSED(dmp))
int
null_openFb(struct dm *UNUSED(dmp), FBIO *UNUSED(ifp))
null_openFb(struct dm *UNUSED(dmp), fb *UNUSED(ifp))
{
return 0;
}
+1 -1
View File
@@ -709,7 +709,7 @@ qt_processEvents(struct dm *dmp)
HIDDEN int
qt_openFb(struct dm *dmp, FBIO *ifp)
qt_openFb(struct dm *dmp, fb *ifp)
{
struct qt_vars *privars = (struct qt_vars *)dmp->dm_vars.priv_vars;
+1 -1
View File
@@ -333,7 +333,7 @@ txt_makeCurrent(struct dm *UNUSED(dmp))
HIDDEN int
txt_openFb(struct dm *UNUSED(dmp), FBIO *UNUSED(ifp))
txt_openFb(struct dm *UNUSED(dmp), fb *UNUSED(ifp))
{
bu_log("openFb called\n");
return 0;
+69 -78
View File
@@ -75,6 +75,8 @@
# include "fb.h"
#endif
/* Embedding windows requires platform specific information */
#include "fb/fb_platform_specific.h"
/**
*@brief
@@ -105,101 +107,76 @@ static struct dm_obj HeadDMObj; /* head of display manager object list */
HIDDEN int
dmo_openFb(struct dm_obj *dmop)
{
struct fb_platform_specific *fb_ps;
#ifdef DM_X
struct X24_fb_info *xfb_ps;
#endif
#ifdef DM_OGL
struct ogl_fb_info *ofb_ps;
#endif
#ifdef DM_WGL
struct wgl_fb_info *wfb_ps;
#endif
if (!dmop || !dmop->interp)
return TCL_ERROR;
/* already open */
if (dmop->dmo_fbs.fbs_fbp != FBIO_NULL)
if (dmop->dmo_fbs.fbs_fbp != FB_NULL)
return TCL_OK;
/* don't use bu_calloc so we can fail slightly more gracefully */
if ((dmop->dmo_fbs.fbs_fbp = (FBIO *)calloc(sizeof(FBIO), 1)) == FBIO_NULL) {
Tcl_Obj *obj;
obj = Tcl_GetObjResult(dmop->interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
Tcl_AppendStringsToObj(obj, "openfb: failed to allocate framebuffer memory\n",
(char *)NULL);
Tcl_SetObjResult(dmop->interp, obj);
return TCL_ERROR;
}
switch (dmop->dmo_dmp->dm_type) {
#ifdef DM_X
case DM_TYPE_X:
*dmop->dmo_fbs.fbs_fbp = X24_interface; /* struct copy */
dmop->dmo_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/X")+1, "if_name");
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/X", strlen("/dev/X")+1);
/* Mark OK by filling in magic number */
dmop->dmo_fbs.fbs_fbp->if_magic = FB_MAGIC;
_X24_open_existing(dmop->dmo_fbs.fbs_fbp,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->pix,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip,
dmop->dmo_dmp->dm_width,
dmop->dmo_dmp->dm_height,
((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->gc);
fb_ps = fb_get_platform_specific(FB_X24_MAGIC);
xfb_ps = (struct X24_fb_info *)fb_ps->data;
xfb_ps->dpy = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy;
xfb_ps->win = ((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->pix;
xfb_ps->cwinp = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.priv_vars)->win;
xfb_ps->cmap = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.priv_vars)->cmap;
xfb_ps->vip = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.priv_vars)->vip;
xfb_ps->gc = ((struct x_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->gc;
dmop->dmo_fbs.fbs_fbp = fb_open_existing("X", dmop->dmo_dmp->dm_width, dmop->dmo_dmp->dm_height, fb_ps);
fb_put_platform_specific(fb_ps);
break;
#endif
#ifdef DM_OGL
case DM_TYPE_OGL:
*dmop->dmo_fbs.fbs_fbp = ogl_interface; /* struct copy */
dmop->dmo_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/ogl")+1, "if_name");
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/ogl", strlen("/dev/ogl")+1);
/* Mark OK by filling in magic number */
dmop->dmo_fbs.fbs_fbp->if_magic = FB_MAGIC;
_ogl_open_existing(dmop->dmo_fbs.fbs_fbp,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip,
dmop->dmo_dmp->dm_width,
dmop->dmo_dmp->dm_height,
((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc,
((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
0);
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
ofb_ps->dpy = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy;
ofb_ps->win = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win;
ofb_ps->cmap = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap;
ofb_ps->vip = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip;
ofb_ps->glxc = ((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc;
ofb_ps->double_buffer = ((struct ogl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer;
ofb_ps->soft_cmap = 0;
dmop->dmo_fbs.fbs_fbp = fb_open_existing("ogl", dmop->dmo_dmp->dm_width, dmop->dmo_dmp->dm_height, fb_ps);
fb_put_platform_specific(fb_ps);
break;
#endif
#ifdef DM_WGL
case DM_TYPE_WGL:
*dmop->dmo_fbs.fbs_fbp = wgl_interface; /* struct copy */
dmop->dmo_fbs.fbs_fbp->if_name = bu_malloc((unsigned)strlen("/dev/wgl")+1, "if_name");
bu_strlcpy(dmop->dmo_fbs.fbs_fbp->if_name, "/dev/wgl", strlen("/dev/wgl")+1);
/* Mark OK by filling in magic number */
dmop->dmo_fbs.fbs_fbp->if_magic = FB_MAGIC;
_wgl_open_existing(dmop->dmo_fbs.fbs_fbp,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip,
((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->hdc,
dmop->dmo_dmp->dm_width,
dmop->dmo_dmp->dm_height,
((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc,
((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
0);
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
wfb_ps = (struct wgl_fb_info *)fb_ps->data;
wfb_ps->dpy = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->dpy;
wfb_ps->win = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->win;
wfb_ps->cmap = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->cmap;
wfb_ps->vip = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->vip;
wfb_ps->hdc = ((struct dm_xvars *)dmop->dmo_dmp->dm_vars.pub_vars)->hdc;
wfb_ps->glxc = ((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->glxc;
wfb_ps->double_buffer = ((struct wgl_vars *)dmop->dmo_dmp->dm_vars.priv_vars)->mvars.doublebuffer;
wfb_ps->soft_cmap = 0;
dmop->dmo_fbs.fbs_fbp = fb_open_existing("wgl", dmop->dmo_dmp->dm_width, dmop->dmo_dmp->dm_height, fb_ps);
fb_put_platform_specific(fb_ps);
break;
#endif
default: {
Tcl_Obj *obj;
free((void*)dmop->dmo_fbs.fbs_fbp);
dmop->dmo_fbs.fbs_fbp = FBIO_NULL;
dmop->dmo_fbs.fbs_fbp = FB_NULL;
obj = Tcl_GetObjResult(dmop->interp);
if (Tcl_IsShared(obj))
@@ -213,6 +190,20 @@ dmo_openFb(struct dm_obj *dmop)
}
}
if (dmop->dmo_fbs.fbs_fbp == FB_NULL) {
Tcl_Obj *obj;
obj = Tcl_GetObjResult(dmop->interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
Tcl_AppendStringsToObj(obj, "openfb: failed to allocate framebuffer memory\n",
(char *)NULL);
Tcl_SetObjResult(dmop->interp, obj);
return TCL_ERROR;
}
return TCL_OK;
}
@@ -227,13 +218,13 @@ dmo_openFb(struct dm_obj *dmop)
HIDDEN int
dmo_closeFb(struct dm_obj *dmop)
{
if (dmop->dmo_fbs.fbs_fbp == FBIO_NULL)
if (dmop->dmo_fbs.fbs_fbp == FB_NULL)
return TCL_OK;
fb_flush(dmop->dmo_fbs.fbs_fbp);
fb_close_existing(dmop->dmo_fbs.fbs_fbp);
dmop->dmo_fbs.fbs_fbp = FBIO_NULL;
dmop->dmo_fbs.fbs_fbp = FB_NULL;
return TCL_OK;
}
@@ -262,7 +253,7 @@ dmo_listen_tcl(void *clientData, int argc, const char **argv)
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
if (dmop->dmo_fbs.fbs_fbp == FBIO_NULL) {
if (dmop->dmo_fbs.fbs_fbp == FB_NULL) {
bu_vls_printf(&vls, "%s listen: framebuffer not open!\n", argv[0]);
Tcl_AppendStringsToObj(obj, bu_vls_addr(&vls), (char *)NULL);
bu_vls_free(&vls);
@@ -327,7 +318,7 @@ dmo_refreshFb_tcl(void *clientData, int argc, const char **argv)
if (!dmop || !dmop->interp || argc < 1 || !argv)
return TCL_ERROR;
if (dmop->dmo_fbs.fbs_fbp == FBIO_NULL) {
if (dmop->dmo_fbs.fbs_fbp == FB_NULL) {
Tcl_Obj *obj;
obj = Tcl_GetObjResult(dmop->interp);
@@ -1830,8 +1821,8 @@ dmo_configure_tcl(void *clientData, int argc, const char **argv)
#ifdef USE_FBSERV
/* configure the framebuffer window */
if (dmop->dmo_fbs.fbs_fbp != FBIO_NULL)
fb_configureWindow(dmop->dmo_fbs.fbs_fbp,
if (dmop->dmo_fbs.fbs_fbp != FB_NULL)
(void)fb_configure_window(dmop->dmo_fbs.fbs_fbp,
dmop->dmo_dmp->dm_width,
dmop->dmo_dmp->dm_height);
#endif
@@ -3210,7 +3201,7 @@ dmo_open_tcl(ClientData UNUSED(clientData), Tcl_Interp *interp, int argc, char *
dmop->dmo_fbs.fbs_listener.fbsl_fbsp = &dmop->dmo_fbs;
dmop->dmo_fbs.fbs_listener.fbsl_fd = -1;
dmop->dmo_fbs.fbs_listener.fbsl_port = -1;
dmop->dmo_fbs.fbs_fbp = FBIO_NULL;
dmop->dmo_fbs.fbs_fbp = FB_NULL;
dmop->dmo_fbs.fbs_callback = dmo_fbs_callback;
dmop->dmo_fbs.fbs_clientData = dmop;
dmop->dmo_fbs.fbs_interp = interp;
+4
View File
@@ -26,6 +26,10 @@
#include "./dm_util.h"
# ifdef HAVE_GL_GL_H
# include <GL/gl.h>
# endif
#if defined(DM_OGL) || defined(DM_WGL) || defined(DM_RTGL)
int
drawLine3D(struct dm *dmp, point_t pt1, point_t pt2, const char *log_bu, float *wireColor)
+7 -2
View File
@@ -17,12 +17,14 @@ set(LINKLIBS "")
if(BRLCAD_ENABLE_X11 AND X11_FOUND)
set(FBX11DEFS "-DIF_X")
set(LINKLIBS ${LINKLIBS} ${X11_LIBRARIES})
set(fbX11_srcs if_X.c if_X24.c)
set(fbX11_srcs if_X24.c)
set_property(SOURCE if_X24.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
endif()
if(BRLCAD_ENABLE_OPENGL AND OPENGL_FOUND AND NOT MSVC)
set(FBOGLDEFS "-DIF_OGL")
set(LINKLIBS ${LINKLIBS} ${OPENGL_LIBRARIES})
set(fbogl_srcs if_ogl.c)
set_property(SOURCE if_ogl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
endif()
if(WIN32)
add_definitions(
@@ -30,11 +32,13 @@ if(WIN32)
)
set(LINKLIBS ${LINKLIBS} opengl32.lib ${TCL_TK_LIBRARY})
set(fbwgl_srcs if_wgl.c)
set_property(SOURCE if_wgl.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
endif(WIN32)
if(BRLCAD_ENABLE_TK)
set(FBTKDEFS "-DIF_TK")
set(LINKLIBS ${LINKLIBS} ${TK_LIBRARY})
set(fbtk_srcs if_tk.c)
set_property(SOURCE if_tk.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
endif(BRLCAD_ENABLE_TK)
if(BRLCAD_ENABLE_QT)
CHECK_CXX_FLAG(Wno-float-equal)
@@ -45,6 +49,7 @@ if(BRLCAD_ENABLE_QT)
add_definitions(${Qt5Widgets_DEFINITIONS})
set(LINKLIBS ${LINKLIBS} ${Qt5Widgets_LIBRARIES})
set(fbqt_srcs if_qt.cpp)
set_property(SOURCE if_qt.cpp APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
endif(BRLCAD_ENABLE_QT)
set(LIBFB_SOURCES
@@ -89,12 +94,12 @@ endif(BRLCAD_BUILD_LOCAL_TK AND BRLCAD_ENABLE_TK)
set(libfb_ignore_files
if_TEMPLATE.c
if_X.c
if_X24.c
if_ogl.c
if_qt.cpp
if_tk.c
if_wgl.c
fb_private.h
)
CMAKEFILES(${libfb_ignore_files})
+299 -161
View File
@@ -1,4 +1,4 @@
/* F B _ `gG E N E R I C . C
/* F B _ G E N E R I C . C
* BRL-CAD
*
* Copyright (c) 1986-2014 United States Government as represented by
@@ -45,20 +45,281 @@
#include "bu/malloc.h"
#include "bu/str.h"
#include "fb_private.h"
#include "fb.h"
/**
* First element of list is default device when no name given
*/
static
fb *_if_list[] = {
#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
extern int X24_close_existing(FBIO *ifp);
extern int ogl_close_existing(FBIO *ifp);
extern int wgl_close_existing(FBIO *ifp);
extern int qt_close_existing(FBIO *ifp);
&debug_interface,
/* never get any of the following by default */
&stk_interface,
&memory_interface,
&null_interface,
(fb *) 0
};
fb *fb_get()
{
struct fb_internal *new_fb = FB_NULL;
BU_GET(new_fb, struct fb_internal);
new_fb->if_name = NULL;
return new_fb;
}
void fb_put(fb *ifp)
{
if (ifp != FB_NULL)
BU_PUT(ifp, struct fb_internal);
}
void fb_set_interface(fb *ifp, const char *interface)
{
int i = 0;
if (!ifp) return;
while (_if_list[i] != FB_NULL) {
if (bu_strncmp(interface, _if_list[i]->if_name+5,
strlen(_if_list[i]->if_name-5)) == 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]->type_magic) {
/* found it, get its specific struct */
return (*(_if_list[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]->type_magic) {
/* found it, clear its specific struct */
(*(_if_list[i])).if_existing_put(fb_p);
return;
} else {
i++;
}
}
return;
}
fb *
fb_open_existing(const char *file, int width, int height, struct fb_platform_specific *fb_p)
{
fb *ifp = (fb *) calloc(sizeof(fb), 1);
fb_set_interface(ifp, file);
fb_set_magic(ifp, FB_MAGIC);
ifp->if_open_existing(ifp, width, height, fb_p);
return ifp;
}
int
fb_refresh(fb *ifp, int x, int y, int w, int h)
{
return ifp->if_refresh(ifp, x, y, w, h);
}
int
fb_configure_window(fb *ifp, int width, int height)
{
/* unknown/unset framebuffer */
if (!ifp || !ifp->if_configure_window || width < 0 || height < 0) {
return 0;
}
return ifp->if_configure_window(ifp, width, height);
}
void fb_set_name(fb *ifp, const char *name)
{
if (!ifp) return;
/*if (ifp->if_name) bu_free(ifp->if_name, "free pre-existing fb name");*/
ifp->if_name = (char *)bu_malloc((unsigned)strlen(name)+1, "if_name");
bu_strlcpy(ifp->if_name, name, strlen(name)+1);
}
char *fb_get_name(fb *ifp)
{
if (!ifp) return NULL;
return ifp->if_name;
}
long fb_get_pagebuffer_pixel_size(fb *ifp)
{
if (!ifp) return 0;
return ifp->if_ppixels;
}
int fb_is_set_fd(fb *ifp, fd_set *infds)
{
if (!ifp) return 0;
if (!infds) return 0;
if (!ifp->if_selfd) return 0;
if (ifp->if_selfd <= 0) return 0;
return FD_ISSET(ifp->if_selfd, infds);
}
int fb_set_fd(fb *ifp, fd_set *select_list)
{
if (!ifp) return 0;
if (!select_list) return 0;
if (!ifp->if_selfd) return 0;
if (ifp->if_selfd <= 0) return 0;
FD_SET(ifp->if_selfd, select_list);
return ifp->if_selfd;
}
int fb_clear_fd(fb *ifp, fd_set *list)
{
if (!ifp) return 0;
if (!list) return 0;
if (!ifp->if_selfd) return 0;
if (ifp->if_selfd <= 0) return 0;
FD_CLR(ifp->if_selfd, list);
return ifp->if_selfd;
}
void fb_set_magic(fb *ifp, uint32_t magic)
{
ifp->if_magic = magic;
}
char *fb_gettype(fb *ifp)
{
return ifp->if_type;
}
int fb_getwidth(fb *ifp)
{
return ifp->if_width;
}
int fb_getheight(fb *ifp)
{
return ifp->if_height;
}
int fb_get_max_width(fb *ifp)
{
return ifp->if_max_width;
}
int fb_get_max_height(fb *ifp)
{
return ifp->if_max_height;
}
int fb_poll(fb *ifp)
{
return (*ifp->if_poll)(ifp);
}
int fb_help(fb *ifp)
{
return (*ifp->if_help)(ifp);
}
int fb_free(fb *ifp)
{
return (*ifp->if_free)(ifp);
}
int fb_clear(fb *ifp, unsigned char *pp)
{
return (*ifp->if_clear)(ifp, pp);
}
ssize_t fb_read(fb *ifp, int x, int y, unsigned char *pp, size_t count)
{
return (*ifp->if_read)(ifp, x, y, pp, count);
}
ssize_t fb_write(fb *ifp, int x, int y, const unsigned char *pp, size_t count)
{
return (*ifp->if_write)(ifp, x, y, pp, count);
}
int fb_rmap(fb *ifp, ColorMap *cmap)
{
return (*ifp->if_rmap)(ifp, cmap);
}
int fb_wmap(fb *ifp, const ColorMap *cmap)
{
return (*ifp->if_wmap)(ifp, cmap);
}
int fb_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
return (*ifp->if_view)(ifp, xcenter, ycenter, xzoom, yzoom);
}
int fb_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
return (*ifp->if_getview)(ifp, xcenter, ycenter, xzoom, yzoom);
}
int fb_setcursor(fb *ifp, const unsigned char *bits, int xb, int yb, int xo, int yo)
{
return (*ifp->if_setcursor)(ifp, bits, xb, yb, xo, yo);
}
int fb_cursor(fb *ifp, int mode, int x, int y)
{
return (*ifp->if_cursor)(ifp, mode, x, y);
}
int fb_getcursor(fb *ifp, int *mode, int *x, int *y)
{
return (*ifp->if_getcursor)(ifp, mode, x, y);
}
int fb_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
return (*ifp->if_readrect)(ifp, xmin, ymin, width, height, pp);
}
int fb_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
return (*ifp->if_writerect)(ifp, xmin, ymin, width, height, pp);
}
int fb_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
return (*ifp->if_bwreadrect)(ifp, xmin, ymin, width, height, pp);
}
int fb_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
return (*ifp->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
*/
@@ -86,12 +347,12 @@ int _fb_disk_enable = 1;
/**
* Filler for FBIO function slots not used by a particular device
* Filler for fb function slots not used by a particular device
*/
int fb_null(FBIO *ifp)
int fb_null(fb *ifp)
{
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
}
return 0;
@@ -101,60 +362,30 @@ int fb_null(FBIO *ifp)
/**
* Used by if_*.c routines that don't have programmable cursor patterns.
*/
int fb_null_setcursor(FBIO *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
int fb_null_setcursor(fb *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
{
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
}
return 0;
}
/**
* First element of list is default device when no name given
*/
static
FBIO *_if_list[] = {
#ifdef IF_WGL
&wgl_interface,
#endif
#ifdef IF_OGL
&ogl_interface,
#endif
#ifdef IF_X
&X24_interface,
&X_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,
&null_interface,
(FBIO *) 0
};
FBIO *
fb *
fb_open(const char *file, int width, int height)
{
register FBIO *ifp;
register fb *ifp;
int i;
if (width < 0 || height < 0)
return FBIO_NULL;
return FB_NULL;
ifp = (FBIO *) calloc(sizeof(FBIO), 1);
if (ifp == FBIO_NULL) {
Malloc_Bomb(sizeof(FBIO));
return FBIO_NULL;
ifp = (fb *) calloc(sizeof(fb), 1);
if (ifp == FB_NULL) {
Malloc_Bomb(sizeof(fb));
return FB_NULL;
}
if (file == NULL || *file == '\0') {
/* No name given, check environment variable first. */
@@ -176,7 +407,7 @@ fb_open(const char *file, int width, int height)
* device array. If we don't find it assume it's a file.
*/
i = 0;
while (_if_list[i] != (FBIO *)NULL) {
while (_if_list[i] != (fb *)NULL) {
if (bu_strncmp(file, _if_list[i]->if_name,
strlen(_if_list[i]->if_name)) == 0) {
/* found it, copy its struct in */
@@ -191,7 +422,7 @@ fb_open(const char *file, int width, int height)
if (bu_strncmp(file, "/dev/", 5) == 0) {
fb_log("fb_open: no such device \"%s\".\n", file);
free((void *) ifp);
return FBIO_NULL;
return FB_NULL;
}
#ifdef IF_REMOTE
@@ -208,7 +439,7 @@ fb_open(const char *file, int width, int height)
} else {
fb_log("fb_open: no such device \"%s\".\n", file);
free((void *) ifp);
return FBIO_NULL;
return FB_NULL;
}
found_interface:
@@ -217,7 +448,7 @@ found_interface:
if (ifp->if_name == (char *)NULL) {
Malloc_Bomb(strlen(file) + 1);
free((void *) ifp);
return FBIO_NULL;
return FB_NULL;
}
bu_strlcpy(ifp->if_name, file, strlen(file)+1);
@@ -230,18 +461,18 @@ found_interface:
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
return FBIO_NULL;
return FB_NULL;
}
return ifp;
}
int
fb_close(FBIO *ifp)
fb_close(fb *ifp)
{
int i;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_flush(ifp);
if ((i=(*ifp->if_close)(ifp)) <= -1) {
fb_log("fb_close: can not close device \"%s\", ret=%d.\n",
@@ -257,119 +488,26 @@ fb_close(FBIO *ifp)
int
fb_close_existing(FBIO *ifp)
fb_close_existing(fb *ifp)
{
int status = 0;
if (!ifp)
return 0;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_flush(ifp);
/* FIXME: these should be callbacks, not listed directly */
#ifdef IF_X
{
if (BU_STR_EQUIV(ifp->if_name, X24_interface.if_name)) {
int status = -1;
if ((status = X24_close_existing(ifp)) <= -1) {
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
return BRLCAD_ERROR;
}
if (ifp->if_pbase != PIXEL_NULL) {
free((void *)ifp->if_pbase);
}
free((void *)ifp->if_name);
free((void *)ifp);
return BRLCAD_OK;
}
status = ifp->if_close_existing(ifp);
if (status <= -1) {
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
return BRLCAD_ERROR;
}
#endif /* IF_X */
#ifdef IF_WGL
{
if (BU_STR_EQUIV(ifp->if_name, wgl_interface.if_name)) {
int status = -1;
if ((status = wgl_close_existing(ifp)) <= -1) {
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
return BRLCAD_ERROR;
}
if (ifp->if_pbase != PIXEL_NULL)
free((void *)ifp->if_pbase);
free((void *)ifp->if_name);
free((void *)ifp);
return BRLCAD_OK;
}
}
#endif /* IF_WGL */
#ifdef IF_OGL
{
if (BU_STR_EQUIV(ifp->if_name, ogl_interface.if_name)) {
int status = -1;
if ((status = ogl_close_existing(ifp)) <= -1) {
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
return BRLCAD_ERROR;
}
if (ifp->if_pbase != PIXEL_NULL)
free((void *)ifp->if_pbase);
free((void *)ifp->if_name);
free((void *)ifp);
return BRLCAD_OK;
}
}
#endif /* IF_OGL */
#ifdef IF_RTGL
{
if (BU_STR_EQUIV(ifp->if_name, ogl_interface.if_name)) {
int status = -1;
if ((status = ogl_close_existing(ifp)) <= -1) {
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
return BRLCAD_ERROR;
}
if (ifp->if_pbase != PIXEL_NULL)
free((void *)ifp->if_pbase);
free((void *)ifp->if_name);
free((void *)ifp);
return BRLCAD_OK;
}
}
#endif /* IF_RTGL */
#ifdef IF_TK
{
if (BU_STR_EQUIV(ifp->if_name, tk_interface.if_name)) {
/* may need to close_existing here at some point */
if (ifp->if_pbase != PIXEL_NULL)
free((void *)ifp->if_pbase);
free((void *)ifp->if_name);
free((void *)ifp);
return BRLCAD_OK;
}
}
#endif /* IF_TK */
#ifdef IF_QT
{
if (BU_STR_EQUIV(ifp->if_name, qt_interface.if_name)) {
int status = -1;
if ((status = qt_close_existing(ifp)) <= -1) {
fb_log("fb_close_existing: cannot close device \"%s\", ret=%d.\n", ifp->if_name, status);
return BRLCAD_ERROR;
}
if (ifp->if_pbase != PIXEL_NULL)
free((void *)ifp->if_pbase);
free((void *)ifp->if_name);
free((void *)ifp);
return BRLCAD_OK;
}
}
#endif /* IF_QT */
fb_log("fb_close_existing: cannot close device\nifp: %s\n", ifp->if_name);
return BRLCAD_ERROR;
fb_put(ifp);
return BRLCAD_OK;
}
@@ -383,7 +521,7 @@ fb_genhelp(void)
int i;
i = 0;
while (_if_list[i] != (FBIO *)NULL) {
while (_if_list[i] != (fb *)NULL) {
fb_log("%-12s %s\n",
_if_list[i]->if_name,
_if_list[i]->if_type);
@@ -453,7 +591,7 @@ fb_cmap_crunch(RGBpixel (*scan_buf), int pixel_ct, ColorMap *cmap)
}
int
fb_write_fp(FBIO *ifp, FILE *fp, int req_width, int req_height, int crunch, int inverse, struct bu_vls *result)
fb_write_fp(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 */
@@ -538,7 +676,7 @@ fb_skip_bytes(int fd, off_t num, int fileinput, int scanbytes, unsigned char *sc
int
fb_read_fd(FBIO *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))
fb_read_fd(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;
+8 -7
View File
@@ -38,12 +38,13 @@
#include "bio.h"
#include "tcl.h"
#include "bu/cmd.h"
#include "fb_private.h"
#include "fb.h"
#include "fbserv_obj.h"
/* defined in libfb/tcl.c */
extern int fb_refresh(FBIO *ifp, int x, int y, int w, int h);
extern int fb_refresh(fb *ifp, int x, int y, int w, int h);
#define FBO_CONSTRAIN(_v, _a, _b) \
@@ -61,7 +62,7 @@ static struct fb_obj HeadFBObj; /* head of display manager object list */
HIDDEN int
fbo_coords_ok(FBIO *fbp, int x, int y)
fbo_coords_ok(fb *fbp, int x, int y)
{
int width;
int height;
@@ -323,7 +324,7 @@ fbo_listen_tcl(void *clientData, int argc, const char **argv)
struct fb_obj *fbop = (struct fb_obj *)clientData;
struct bu_vls vls = BU_VLS_INIT_ZERO;
if (fbop->fbo_fbs.fbs_fbp == FBIO_NULL) {
if (fbop->fbo_fbs.fbs_fbp == FB_NULL) {
bu_log("%s listen: framebuffer not open!\n", argv[0]);
return BRLCAD_ERROR;
}
@@ -720,8 +721,8 @@ fbo_configure_tcl(void *clientData, int argc, const char **argv)
}
/* configure the framebuffer window */
if (fbop->fbo_fbs.fbs_fbp != FBIO_NULL)
fb_configureWindow(fbop->fbo_fbs.fbs_fbp, width, height);
if (fbop->fbo_fbs.fbs_fbp != FB_NULL)
(void)fb_configure_window(fbop->fbo_fbs.fbs_fbp, width, height);
return BRLCAD_OK;
}
@@ -775,7 +776,7 @@ HIDDEN int
fbo_open_tcl(void *UNUSED(clientData), Tcl_Interp *interp, int argc, const char **argv)
{
struct fb_obj *fbop;
FBIO *ifp;
fb *ifp;
int width = 512;
int height = 512;
register int c;
@@ -821,7 +822,7 @@ fbo_open_tcl(void *UNUSED(clientData), Tcl_Interp *interp, int argc, const char
}
}
if ((ifp = fb_open(argv[2], width, height)) == FBIO_NULL) {
if ((ifp = fb_open(argv[2], width, height)) == FB_NULL) {
bu_log("fb_open: bad device - %s", argv[2]);
return BRLCAD_ERROR;
}
+10 -9
View File
@@ -33,6 +33,7 @@
#include "bu/color.h"
#include "bu/log.h"
#include "fb_private.h"
#include "fb.h"
@@ -46,7 +47,7 @@
static int
_fb_pgout(register FBIO *ifp)
_fb_pgout(register fb *ifp)
{
size_t scans, first_scan;
@@ -71,7 +72,7 @@ _fb_pgout(register FBIO *ifp)
static int
_fb_pgin(register FBIO *ifp, int pageno)
_fb_pgin(register fb *ifp, int pageno)
{
size_t scans, first_scan;
@@ -98,7 +99,7 @@ _fb_pgin(register FBIO *ifp, int pageno)
static int
_fb_pgflush(register FBIO *ifp)
_fb_pgflush(register fb *ifp)
{
if (ifp->if_debug & FB_DEBUG_BIO) {
fb_log("_fb_pgflush(%p)\n", (void *)ifp);
@@ -119,7 +120,7 @@ _fb_pgflush(register FBIO *ifp)
* routines in this file are used.
*/
int
fb_ioinit(register FBIO *ifp)
fb_ioinit(register fb *ifp)
{
if (ifp->if_debug & FB_DEBUG_BIO) {
fb_log("fb_ioinit(%p)\n", (void *)ifp);
@@ -145,7 +146,7 @@ fb_ioinit(register FBIO *ifp)
int
fb_seek(register FBIO *ifp, int x, int y)
fb_seek(register fb *ifp, int x, int y)
{
long pixelnum;
long pagepixel;
@@ -177,7 +178,7 @@ fb_seek(register FBIO *ifp, int x, int y)
int
fb_tell(register FBIO *ifp, int *xp, int *yp)
fb_tell(register fb *ifp, int *xp, int *yp)
{
*yp = (int) (ifp->if_pixcur / ifp->if_width);
*xp = (int) (ifp->if_pixcur % ifp->if_width);
@@ -192,7 +193,7 @@ fb_tell(register FBIO *ifp, int *xp, int *yp)
int
fb_wpixel(register FBIO *ifp, unsigned char *pixelp)
fb_wpixel(register fb *ifp, unsigned char *pixelp)
{
if (ifp->if_pno == -1)
if (_fb_pgin(ifp, ifp->if_pixcur / ifp->if_ppixels) <= -1)
@@ -212,7 +213,7 @@ fb_wpixel(register FBIO *ifp, unsigned char *pixelp)
int
fb_rpixel(register FBIO *ifp, unsigned char *pixelp)
fb_rpixel(register fb *ifp, unsigned char *pixelp)
{
if (ifp->if_pno == -1)
if (_fb_pgin(ifp, ifp->if_pixcur / ifp->if_ppixels) <= -1)
@@ -232,7 +233,7 @@ fb_rpixel(register FBIO *ifp, unsigned char *pixelp)
int
fb_flush(register FBIO *ifp)
fb_flush(register fb *ifp)
{
_fb_pgflush(ifp);
+161
View File
@@ -0,0 +1,161 @@
/* F B _ P R I V A T E . H
* BRL-CAD
*
* Copyright (c) 2008-2014 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.
*/
/** @file fb_private.h
*
* Private header for libfb.
*
*/
#ifndef LIBFB_FB_PRIVATE_H
#define LIBFB_FB_PRIVATE_H
#include "common.h"
#include <limits.h> /* For INT_MAX */
#include <stdlib.h>
#include "fb.h"
/* declare all the possible interfaces */
#ifdef IF_X
FB_EXPORT extern fb X24_interface;
#endif
#ifdef IF_OGL
FB_EXPORT extern fb ogl_interface;
#endif
#ifdef IF_WGL
FB_EXPORT extern fb wgl_interface;
#endif
#ifdef IF_TK
FB_EXPORT extern fb tk_interface;
#endif
#ifdef IF_QT
FB_EXPORT extern fb qt_interface;
#endif
#ifdef IF_REMOTE
FB_EXPORT extern fb remote_interface; /* not in list[] */
#endif
/* Always included */
FB_EXPORT extern fb debug_interface, disk_interface, stk_interface;
FB_EXPORT extern fb memory_interface, null_interface;
__BEGIN_DECLS
/**
*@brief
* A frame-buffer IO structure.
*
* One of these is allocated for each active framebuffer. A pointer
* to this structure is the first argument to all the library
* routines. The details of the structure are hidden behind function
* calls in the fb.h API - no code external to libfb should work
* directly with structure members.
*/
struct fb_internal {
uint32_t if_magic;
uint32_t type_magic;
/* Static information: per device TYPE. */
int (*if_open)(struct fb_internal *ifp, const char *file, int _width, int _height); /**< @brief open device */
int (*if_open_existing)(struct fb_internal *ifp, int width, int height, struct fb_platform_specific *fb_p); /**< @brief open device */
int (*if_close_existing)(struct fb_internal *ifp); /**< @brief close embedded 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_internal *ifp); /**< @brief close device */
int (*if_clear)(struct fb_internal *ifp, unsigned char *pp); /**< @brief clear device */
ssize_t (*if_read)(struct fb_internal *ifp, int x, int y, unsigned char *pp, size_t count); /**< @brief read pixels */
ssize_t (*if_write)(struct fb_internal *ifp, int x, int y, const unsigned char *pp, size_t count); /**< @brief write pixels */
int (*if_rmap)(struct fb_internal *ifp, ColorMap *cmap); /**< @brief read colormap */
int (*if_wmap)(struct fb_internal *ifp, const ColorMap *cmap); /**< @brief write colormap */
int (*if_view)(struct fb_internal *ifp, int xcent, int ycent, int xzoom, int yzoom); /**< @brief set view */
int (*if_getview)(struct fb_internal *ifp, int *xcent, int *ycent, int *xzoom, int *yzoom); /**< @brief get view */
int (*if_setcursor)(struct fb_internal *ifp, const unsigned char *bits, int xb, int yb, int xo, int yo); /**< @brief define cursor */
int (*if_cursor)(struct fb_internal *ifp, int mode, int x, int y); /**< @brief set cursor */
int (*if_getcursor)(struct fb_internal *ifp, int *mode, int *x, int *y); /**< @brief get cursor */
int (*if_readrect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read rectangle */
int (*if_writerect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
int (*if_bwreadrect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp); /**< @brief read monochrome rectangle */
int (*if_bwwriterect)(struct fb_internal *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp); /**< @brief write rectangle */
int (*if_configure_window)(struct fb_internal *ifp, int width, int height); /**< @brief configure window */
int (*if_refresh)(struct fb_internal *ifp, int x, int y, int w, int h); /**< @brief refresh window */
int (*if_poll)(struct fb_internal *ifp); /**< @brief handle events */
int (*if_flush)(struct fb_internal *ifp); /**< @brief flush output */
int (*if_free)(struct fb_internal *ifp); /**< @brief free resources */
int (*if_help)(struct fb_internal *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. */
/* State variables for individual interface modules */
union {
char *p;
size_t l;
} u1, u2, u3, u4, u5, u6;
};
/*
* Some functions and variables we couldn't hide.
* Not for general consumption.
*/
FB_EXPORT extern int _fb_disk_enable;
FB_EXPORT extern int fb_sim_readrect(fb *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp);
FB_EXPORT extern int fb_sim_writerect(fb *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp);
FB_EXPORT extern int fb_sim_bwreadrect(fb *ifp, int xmin, int ymin, int _width, int _height, unsigned char *pp);
FB_EXPORT extern int fb_sim_bwwriterect(fb *ifp, int xmin, int ymin, int _width, int _height, const unsigned char *pp);
FB_EXPORT extern int fb_sim_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom);
FB_EXPORT extern int fb_sim_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom);
FB_EXPORT extern int fb_sim_cursor(fb *ifp, int mode, int x, int y);
FB_EXPORT extern int fb_sim_getcursor(fb *ifp, int *mode, int *x, int *y);
__END_DECLS
#endif /* LIBFB_FB_PRIVATE_H */
/** @} */
/*
* Local Variables:
* mode: C
* tab-width: 8
* indent-tabs-mode: t
* c-file-style: "stroustrup"
* End:
* ex: shiftwidth=4 tabstop=8
*/
+5 -4
View File
@@ -33,6 +33,7 @@
#include "bu/color.h"
#include "bu/log.h"
#include "fb_private.h"
#include "fb.h"
@@ -41,7 +42,7 @@
* particular display does not handle it.
*/
int
fb_sim_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
fb_sim_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
register int y;
register int tot;
@@ -74,7 +75,7 @@ fb_sim_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned c
* Clipping to the screen may reduce the total if caller was sloppy.
*/
int
fb_sim_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
fb_sim_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
register int y;
register int tot;
@@ -98,7 +99,7 @@ fb_sim_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const uns
#define SIMBUF_SIZE (24*1024)
int
fb_sim_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
fb_sim_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
register int y;
register int tot;
@@ -128,7 +129,7 @@ fb_sim_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned
int
fb_sim_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
fb_sim_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
register int y;
register int tot;
+23 -22
View File
@@ -31,17 +31,18 @@
#include <stdio.h>
#include "fb_private.h"
#include "fb.h"
/*
* A routine to simulate the effect of fb_view() by simply
* storing this information into the FBIO structure.
* storing this information into the fb structure.
*/
int
fb_sim_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
fb_sim_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
ifp->if_xcenter = xcenter;
ifp->if_ycenter = ycenter;
@@ -54,12 +55,12 @@ fb_sim_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
/*
* A routine to simulate the effect of fb_getview() by simply
* reading this information from the FBIO structure.
* reading this information from the fb structure.
*/
int
fb_sim_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
fb_sim_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
*xcenter = ifp->if_xcenter;
*ycenter = ifp->if_ycenter;
@@ -72,12 +73,12 @@ fb_sim_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
/*
* A routine to simulate the effect of fb_cursor() by simply
* storing this information into the FBIO structure.
* storing this information into the fb structure.
*/
int
fb_sim_cursor(FBIO *ifp, int mode, int x, int y)
fb_sim_cursor(fb *ifp, int mode, int x, int y)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
ifp->if_cursmode = mode;
ifp->if_xcurs = x;
@@ -89,12 +90,12 @@ fb_sim_cursor(FBIO *ifp, int mode, int x, int y)
/*
* A routine to simulate the effect of fb_getcursor() by simply
* reading this information from the FBIO structure.
* reading this information from the fb structure.
*/
int
fb_sim_getcursor(FBIO *ifp, int *mode, int *x, int *y)
fb_sim_getcursor(fb *ifp, int *mode, int *x, int *y)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
*mode = ifp->if_cursmode;
*x = ifp->if_xcurs;
@@ -107,10 +108,10 @@ fb_sim_getcursor(FBIO *ifp, int *mode, int *x, int *y)
/* Backward Compatibility Routines */
int
fb_reset(FBIO *ifp)
fb_reset(fb *ifp)
{
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
}
return 0;
@@ -118,10 +119,10 @@ fb_reset(FBIO *ifp)
int
fb_viewport(FBIO *ifp, int UNUSED(left), int UNUSED(top), int UNUSED(right), int UNUSED(bottom))
fb_viewport(fb *ifp, int UNUSED(left), int UNUSED(top), int UNUSED(right), int UNUSED(bottom))
{
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
}
return 0;
@@ -129,13 +130,13 @@ fb_viewport(FBIO *ifp, int UNUSED(left), int UNUSED(top), int UNUSED(right), int
int
fb_window(FBIO *ifp, int x, int y)
fb_window(fb *ifp, int x, int y)
{
int xcenter, ycenter;
int xzoom, yzoom;
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_getview(ifp, &xcenter, &ycenter, &xzoom, &yzoom);
xcenter = x;
ycenter = y;
@@ -147,13 +148,13 @@ fb_window(FBIO *ifp, int x, int y)
int
fb_zoom(FBIO *ifp, int x, int y)
fb_zoom(fb *ifp, int x, int y)
{
int xcenter, ycenter;
int xzoom, yzoom;
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_getview(ifp, &xcenter, &ycenter, &xzoom, &yzoom);
xzoom = x;
@@ -166,10 +167,10 @@ fb_zoom(FBIO *ifp, int x, int y)
int
fb_scursor(FBIO *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
fb_scursor(fb *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
{
if (ifp) {
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
}
/* We could actually implement this but it
+2 -1
View File
@@ -51,9 +51,10 @@
#include "fbmsg.h"
#include "fbserv_obj.h"
#include "fb_private.h"
static FBIO *curr_fbp; /* current framebuffer pointer */
static fb *curr_fbp; /* current framebuffer pointer */
/*
+20 -20
View File
@@ -56,127 +56,127 @@
HIDDEN int
DEVNAME_open(FBIO *ifp, const char *file, int width, int height)
DEVNAME_open(fb *ifp, const char *file, int width, int height)
{
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
return 0;
}
HIDDEN int
DEVNAME_close(FBIO *ifp)
DEVNAME_close(fb *ifp)
{
return 0;
}
HIDDEN int
DEVNAME_clear(FBIO *ifp, unsigned char *pp)
DEVNAME_clear(fb *ifp, unsigned char *pp)
{
return 0;
}
HIDDEN int
DEVNAME_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
DEVNAME_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
return (int)count;
}
HIDDEN int
DEVNAME_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
DEVNAME_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
return (int)count;
}
HIDDEN int
DEVNAME_rmap(FBIO *ifp, ColorMap *cmp)
DEVNAME_rmap(fb *ifp, ColorMap *cmp)
{
return 0;
}
HIDDEN int
DEVNAME_wmap(FBIO *ifp, const ColorMap *cmp)
DEVNAME_wmap(fb *ifp, const ColorMap *cmp)
{
return 0;
}
HIDDEN int
DEVNAME_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
DEVNAME_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
return 0;
}
HIDDEN int
DEVNAME_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
DEVNAME_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
return 0;
}
HIDDEN int
DEVNAME_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
DEVNAME_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
{
return 0;
}
HIDDEN int
DEVNAME_cursor(FBIO *ifp, int mode, int x, int y)
DEVNAME_cursor(fb *ifp, int mode, int x, int y)
{
return 0;
}
HIDDEN int
DEVNAME_getcursor(FBIO *ifp, int *mode, int *x, int *y)
DEVNAME_getcursor(fb *ifp, int *mode, int *x, int *y)
{
return 0;
}
HIDDEN int
DEVNAME_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
DEVNAME_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
return width*height;
}
HIDDEN int
DEVNAME_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
DEVNAME_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
return width*height;
}
HIDDEN int
DEVNAME_poll(FBIO *ifp)
DEVNAME_poll(fb *ifp)
{
return 0;
}
HIDDEN int
DEVNAME_flush(FBIO *ifp)
DEVNAME_flush(fb *ifp)
{
return 0;
}
HIDDEN int
DEVNAME_free(FBIO *ifp)
DEVNAME_free(fb *ifp)
{
return 0;
}
HIDDEN int
DEVNAME_help(FBIO *ifp)
DEVNAME_help(fb *ifp)
{
fb_log("Description: %s\n", DEVNAME_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
@@ -191,7 +191,7 @@ DEVNAME_help(FBIO *ifp)
/* This is the ONLY thing that we normally "export" */
FBIO DEVNAME_interface = {
fb DEVNAME_interface = {
0, /* magic number slot */
DEVNAME_open, /* open device */
DEVNAME_close, /* close device */
-1766
View File
File diff suppressed because it is too large Load Diff
+98 -98
View File
@@ -76,8 +76,10 @@
#include "bu/color.h"
#include "bu/file.h"
#include "bu/malloc.h"
#include "bu/str.h"
#include "fb.h"
#include "fb_private.h"
#include "fb/fb_platform_specific.h"
#define SHMEM_KEY 42
@@ -530,7 +532,7 @@ X24_createColorTables(struct xinfo *xi)
HIDDEN int
x24_setup(FBIO *ifp, int width, int height)
x24_setup(fb *ifp, int width, int height)
{
struct xinfo *xi = XI(ifp);
@@ -541,7 +543,7 @@ x24_setup(FBIO *ifp, int width, int height)
XRectangle rect;
char *xname;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Save these in state structure */
@@ -1011,7 +1013,7 @@ x24_setup(FBIO *ifp, int width, int height)
* x1, y1->w, h describes a Rectangle of changed bits (image space coord.)
*/
HIDDEN void
X24_blit(FBIO *ifp, int x1, int y1, int w, int h, int flags /* BLIT_xxx flags */)
X24_blit(fb *ifp, int x1, int y1, int w, int h, int flags /* BLIT_xxx flags */)
{
struct xinfo *xi = XI(ifp);
@@ -1042,7 +1044,7 @@ X24_blit(FBIO *ifp, int x1, int y1, int w, int h, int flags /* BLIT_xxx flags */
unsigned int mask_blue = xi->xi_image->blue_mask << 6;
size_t i;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*
* Now that we know the mask, we shift a bit left, one bit at a
@@ -1867,10 +1869,10 @@ X24_blit(FBIO *ifp, int x1, int y1, int w, int h, int flags /* BLIT_xxx flags */
HIDDEN int
X24_rmap(FBIO *ifp, ColorMap *cmp)
X24_rmap(fb *ifp, ColorMap *cmp)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
memcpy(cmp, xi->xi_rgb_cmap, sizeof (ColorMap));
@@ -1879,12 +1881,12 @@ X24_rmap(FBIO *ifp, ColorMap *cmp)
HIDDEN int
X24_wmap(FBIO *ifp, const ColorMap *cmp)
X24_wmap(fb *ifp, const ColorMap *cmp)
{
struct xinfo *xi = XI(ifp);
ColorMap *map = xi->xi_rgb_cmap;
int waslincmap;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Did we have a linear colormap before this call? */
@@ -1987,7 +1989,7 @@ X24_wmap(FBIO *ifp, const ColorMap *cmp)
* accessed again, even though the windows are transient, per-process.
*/
HIDDEN int
X24_getmem(FBIO *ifp)
X24_getmem(fb *ifp)
{
struct xinfo *xi = XI(ifp);
@@ -1996,7 +1998,7 @@ X24_getmem(FBIO *ifp)
off_t size;
int isnew = 0;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
pixsize = ifp->if_max_height * ifp->if_max_width * sizeof(RGBpixel);
size = pixsize + sizeof (*xi->xi_rgb_cmap);
@@ -2084,7 +2086,7 @@ store\n Run shell command 'limit datasize unlimited' and try again.\n", size);
HIDDEN void
X24_updstate(FBIO *ifp)
X24_updstate(fb *ifp)
{
struct xinfo *xi = XI(ifp);
@@ -2096,7 +2098,7 @@ X24_updstate(FBIO *ifp)
int want, avail; /* Wanted/available image pixels */
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*
* Set ?wp to the number of whole zoomed image pixels we could display
@@ -2419,14 +2421,14 @@ X24_destroy(struct xinfo *xi)
HIDDEN int
X24_open(FBIO *ifp, const char *file, int width, int height)
X24_open(fb *ifp, const char *file, int width, int height)
{
struct xinfo *xi;
unsigned long mode; /* local copy */
int getmem_stat;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*
* First, attempt to determine operating mode for this open,
@@ -2548,21 +2550,20 @@ X24_open(FBIO *ifp, const char *file, int width, int height)
return 0;
}
void
X24_configureWindow(FBIO *ifp, int width, int height)
int
X24_configureWindow(fb *ifp, int width, int height)
{
struct xinfo *xi = XI(ifp);
XRectangle rect;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (!xi) {
return;
return 1;
}
if (width == xi->xi_xwidth && height == xi->xi_xheight) {
return;
return 1;
}
ifp->if_width = ifp->if_max_width = width;
@@ -2597,7 +2598,7 @@ X24_configureWindow(FBIO *ifp, int width, int height)
if ((xi->xi_pix = (unsigned char *)calloc(sizeof(unsigned int),
xi->xi_xwidth*xi->xi_xheight)) == NULL) {
fb_log("X24: pix32 malloc failed in resize!\n");
return;
return 1;
}
xi->xi_image = XCreateImage(xi->xi_dpy, xi->xi_visual,
@@ -2614,7 +2615,7 @@ X24_configureWindow(FBIO *ifp, int width, int height)
/* Make new buffer and new image */
if ((xi->xi_pix = (unsigned char *)calloc(2, xi->xi_xwidth*xi->xi_xheight)) == NULL) {
fb_log("X24: pix32 malloc failed in resize!\n");
return;
return 1;
}
xi->xi_image = XCreateImage(xi->xi_dpy, xi->xi_visual,
@@ -2633,7 +2634,7 @@ X24_configureWindow(FBIO *ifp, int width, int height)
if ((xi->xi_pix = (unsigned char *)calloc(sizeof(char),
xi->xi_xwidth * xi->xi_xheight)) == NULL) {
fb_log("X24: pix8 malloc failed in resize!\n");
return;
return 1;
}
xi->xi_image = XCreateImage(xi->xi_dpy, xi->xi_visual,
@@ -2652,7 +2653,7 @@ X24_configureWindow(FBIO *ifp, int width, int height)
if ((xi->xi_pix = (unsigned char *)calloc(sizeof(char),
xi->xi_image->bytes_per_line * xi->xi_xheight)) == NULL) {
fb_log("X24: pix1 malloc failed in resize!\n");
return;
return 1;
}
xi->xi_image->data = (char *) xi->xi_pix;
@@ -2662,11 +2663,14 @@ X24_configureWindow(FBIO *ifp, int width, int height)
break;
}
return 0;
}
int
_X24_open_existing(FBIO *ifp, Display *dpy, Window win, Window cwinp, Colormap cmap, XVisualInfo *vip, int width, int height, GC gc)
_X24_open_existing(fb *ifp, Display *dpy, Window win, Window cwinp, Colormap cmap, XVisualInfo *vip, int width, int height, GC gc)
{
struct xinfo *xi;
int getmem_stat;
@@ -2831,57 +2835,46 @@ _X24_open_existing(FBIO *ifp, Display *dpy, Window win, Window cwinp, Colormap c
return 0;
}
int
X24_open_existing(FBIO *ifp, int argc, const char **argv)
HIDDEN struct fb_platform_specific *
X24_get_fbps(uint32_t magic)
{
Display *dpy;
Window win;
Window cwinp;
Colormap cmap;
XVisualInfo *vip;
int width;
int height;
GC gc;
struct fb_platform_specific *fb_ps = NULL;
struct X24_fb_info *data = NULL;
BU_GET(fb_ps, struct fb_platform_specific);
BU_GET(data, struct X24_fb_info);
fb_ps->magic = magic;
fb_ps->data = data;
return fb_ps;
}
if (argc != 9)
return -1;
if (sscanf(argv[1], "%p", (void **)&dpy) != 1)
return -1;
HIDDEN void
X24_put_fbps(struct fb_platform_specific *fbps)
{
BU_CKMAG(fbps, FB_X24_MAGIC, "X24 framebuffer");
BU_PUT(fbps->data, struct X24_fb_info);
BU_PUT(fbps, struct fb_platform_specific);
return;
}
if (sscanf(argv[2], "%p", (void **)&win) != 1)
return -1;
if (sscanf(argv[3], "%p", (void **)&cwinp) != 1)
return -1;
if (sscanf(argv[4], "%p", (void **)&cmap) != 1)
return -1;
if (sscanf(argv[5], "%p", (void **)&vip) != 1)
return -1;
if (sscanf(argv[6], "%d", &width) != 1)
return -1;
if (sscanf(argv[7], "%d", &height) != 1)
return -1;
if (sscanf(argv[8], "%p", (void **)&gc) != 1)
return -1;
return _X24_open_existing(ifp, dpy, win, cwinp, cmap, vip, width, height, gc);
HIDDEN int
X24_open_existing(fb *ifp, int width, int height, struct fb_platform_specific *fb_p)
{
struct X24_fb_info *x24_internal = (struct X24_fb_info *)fb_p->data;
BU_CKMAG(fb_p, FB_X24_MAGIC, "X24 framebuffer");
return _X24_open_existing(ifp, x24_internal->dpy, x24_internal->win,
x24_internal->cwinp, x24_internal->cmap, x24_internal->vip,
width, height, x24_internal->gc);
}
static int alive = 1;
HIDDEN void
X24_handle_event(FBIO *ifp, XEvent *event)
X24_handle_event(fb *ifp, XEvent *event)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
switch ((int)event->type) {
case Expose:
@@ -3003,11 +2996,11 @@ X24_handle_event(FBIO *ifp, XEvent *event)
HIDDEN int
x24_linger(FBIO *ifp)
x24_linger(fb *ifp)
{
struct xinfo *xi = XI(ifp);
XEvent event;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (fork() != 0)
return 1; /* release the parent */
@@ -3021,10 +3014,10 @@ x24_linger(FBIO *ifp)
HIDDEN int
X24_close(FBIO *ifp)
X24_close(fb *ifp)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
XFlush(xi->xi_dpy);
if ((xi->xi_mode & MODE1_MASK) == MODE1_LINGERING) {
@@ -3039,10 +3032,10 @@ X24_close(FBIO *ifp)
int
X24_close_existing(FBIO *ifp)
X24_close_existing(fb *ifp)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (xi->xi_image)
XDestroyImage(xi->xi_image);
@@ -3064,7 +3057,7 @@ X24_close_existing(FBIO *ifp)
HIDDEN int
X24_clear(FBIO *ifp, unsigned char *pp)
X24_clear(fb *ifp, unsigned char *pp)
{
struct xinfo *xi = XI(ifp);
@@ -3073,7 +3066,7 @@ X24_clear(FBIO *ifp, unsigned char *pp)
int n;
unsigned char *cp;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (pp == (unsigned char *)NULL) {
red = grn = blu = 0;
@@ -3106,11 +3099,11 @@ X24_clear(FBIO *ifp, unsigned char *pp)
HIDDEN ssize_t
X24_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
X24_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
struct xinfo *xi = XI(ifp);
size_t maxcount;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* check origin bounds */
if (x < 0 || x >= xi->xi_iwidth || y < 0 || y >= xi->xi_iheight)
@@ -3127,12 +3120,12 @@ X24_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
X24_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
X24_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
struct xinfo *xi = XI(ifp);
size_t maxcount;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Check origin bounds */
if (x < 0 || x >= xi->xi_iwidth || y < 0 || y >= xi->xi_iheight)
@@ -3167,10 +3160,10 @@ X24_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
HIDDEN int
X24_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
X24_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* bypass if no change */
if (ifp->if_xcenter == xcenter && ifp->if_ycenter == ycenter
@@ -3198,7 +3191,7 @@ X24_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
X24_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
X24_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
*xcenter = ifp->if_xcenter;
@@ -3212,16 +3205,16 @@ X24_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
/*ARGSUSED*/
HIDDEN int
X24_setcursor(FBIO *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
X24_setcursor(fb *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
X24_cursor(FBIO *ifp, int mode, int x, int y)
X24_cursor(fb *ifp, int mode, int x, int y)
{
struct xinfo *xi = XI(ifp);
@@ -3279,7 +3272,7 @@ X24_cursor(FBIO *ifp, int mode, int x, int y)
HIDDEN int
X24_getcursor(FBIO *ifp, int *mode, int *x, int *y)
X24_getcursor(fb *ifp, int *mode, int *x, int *y)
{
fb_sim_getcursor(ifp, mode, x, y);
@@ -3288,10 +3281,10 @@ X24_getcursor(FBIO *ifp, int *mode, int *x, int *y)
HIDDEN int
X24_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
X24_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Clip arguments */
@@ -3331,10 +3324,10 @@ X24_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char
HIDDEN int
X24_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
X24_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Clip arguments */
@@ -3377,12 +3370,12 @@ X24_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsign
HIDDEN int
X24_poll(FBIO *ifp)
X24_poll(fb *ifp)
{
struct xinfo *xi = XI(ifp);
XEvent event;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Check for and dispatch event */
while (XCheckMaskEvent(xi->xi_dpy, ~NoEventMask, &event))
@@ -3393,10 +3386,10 @@ X24_poll(FBIO *ifp)
HIDDEN int
X24_flush(FBIO *ifp)
X24_flush(fb *ifp)
{
struct xinfo *xi = XI(ifp);
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
XFlush(xi->xi_dpy);
return 0;
@@ -3404,20 +3397,20 @@ X24_flush(FBIO *ifp)
HIDDEN int
X24_free(FBIO *ifp)
X24_free(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
X24_help(FBIO *ifp)
X24_help(fb *ifp)
{
struct xinfo *xi = XI(ifp);
struct modeflags *mfp;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("Description: %s\n", X24_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
@@ -3481,7 +3474,7 @@ X24_help(FBIO *ifp)
int
X24_refresh(FBIO *ifp, int x, int y, int w, int h)
X24_refresh(fb *ifp, int x, int y, int w, int h)
{
if (w < 0) {
w = -w;
@@ -3500,9 +3493,14 @@ X24_refresh(FBIO *ifp, int x, int y, int w, int h)
/* This is the ONLY thing that we normally "export" */
FBIO X24_interface = {
fb X24_interface = {
0, /* magic number slot */
FB_X24_MAGIC,
X24_open, /* open device */
X24_open_existing, /* existing device_open */
X24_close_existing, /* existing device_close */
X24_get_fbps, /* get platform specific memory */
X24_put_fbps, /* free platform specific memory */
X24_close, /* close device */
X24_clear, /* clear device */
X24_read, /* read pixels */
@@ -3518,6 +3516,8 @@ FBIO X24_interface = {
X24_writerect, /* write rectangle */
fb_sim_bwreadrect,
fb_sim_bwwriterect,
X24_configureWindow,
X24_refresh,
X24_poll, /* process events */
X24_flush, /* flush output */
X24_free, /* free resources */
+83 -40
View File
@@ -33,12 +33,13 @@
#include "bu/color.h"
#include "bu/log.h"
#include "fb_private.h"
#include "fb.h"
HIDDEN int
deb_open(FBIO *ifp, const char *file, int width, int height)
deb_open(fb *ifp, const char *file, int width, int height)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (file == (char *)NULL)
fb_log("fb_open(%p, NULL, %d, %d)\n",
(void *)ifp, width, height);
@@ -69,20 +70,55 @@ deb_open(FBIO *ifp, const char *file, int width, int height)
return 0;
}
HIDDEN struct fb_platform_specific *
deb_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
deb_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
deb_close(FBIO *ifp)
deb_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
FB_CK_FBIO(ifp);
return 0;
}
HIDDEN int
deb_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
deb_close(fb *ifp)
{
FB_CK_FB(ifp);
fb_log("fb_close(%p)\n", (void *)ifp);
return 0;
}
HIDDEN int
deb_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
deb_clear(FBIO *ifp, unsigned char *pp)
deb_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
FB_CK_FBIO(ifp);
return 0;
}
HIDDEN int
deb_clear(fb *ifp, unsigned char *pp)
{
FB_CK_FB(ifp);
if (pp == 0)
fb_log("fb_clear(%p, NULL)\n", (void *)ifp);
else
@@ -95,9 +131,9 @@ deb_clear(FBIO *ifp, unsigned char *pp)
HIDDEN ssize_t
deb_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
deb_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_read(%p, %4d, %4d, %p, %lu)\n",
(void *)ifp, x, y,
(void *)pixelp, count);
@@ -106,11 +142,11 @@ deb_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
deb_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
deb_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
size_t i;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_write(%p, %4d, %4d, %p, %ld)\n",
(void *)ifp, x, y,
(void *)pixelp, (long)count);
@@ -134,9 +170,9 @@ deb_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
HIDDEN int
deb_rmap(FBIO *ifp, ColorMap *cmp)
deb_rmap(fb *ifp, ColorMap *cmp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_rmap(%p, %p)\n",
(void *)ifp, (void *)cmp);
return 0;
@@ -144,11 +180,11 @@ deb_rmap(FBIO *ifp, ColorMap *cmp)
HIDDEN int
deb_wmap(FBIO *ifp, const ColorMap *cmp)
deb_wmap(fb *ifp, const ColorMap *cmp)
{
int i;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (cmp == NULL)
fb_log("fb_wmap(%p, NULL)\n",
(void *)ifp);
@@ -171,9 +207,9 @@ deb_wmap(FBIO *ifp, const ColorMap *cmp)
HIDDEN int
deb_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
deb_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_view(%p, %4d, %4d, %4d, %4d)\n",
(void *)ifp, xcenter, ycenter, xzoom, yzoom);
fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);
@@ -182,9 +218,9 @@ deb_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
deb_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
deb_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_getview(%p, %p, %p, %p, %p)\n",
(void *)ifp, (void *)xcenter, (void *)ycenter, (void *)xzoom, (void *)yzoom);
fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);
@@ -195,9 +231,9 @@ deb_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
HIDDEN int
deb_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
deb_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_setcursor(%p, %p, %d, %d, %d, %d)\n",
(void *)ifp, (void *)bits, xbits, ybits, xorig, yorig);
return 0;
@@ -205,7 +241,7 @@ deb_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xo
HIDDEN int
deb_cursor(FBIO *ifp, int mode, int x, int y)
deb_cursor(fb *ifp, int mode, int x, int y)
{
fb_log("fb_cursor(%p, %d, %4d, %4d)\n",
(void *)ifp, mode, x, y);
@@ -215,9 +251,9 @@ deb_cursor(FBIO *ifp, int mode, int x, int y)
HIDDEN int
deb_getcursor(FBIO *ifp, int *mode, int *x, int *y)
deb_getcursor(fb *ifp, int *mode, int *x, int *y)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_getcursor(%p, %p, %p, %p)\n",
(void *)ifp, (void *)mode, (void *)x, (void *)y);
fb_sim_getcursor(ifp, mode, x, y);
@@ -227,9 +263,9 @@ deb_getcursor(FBIO *ifp, int *mode, int *x, int *y)
HIDDEN int
deb_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
deb_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_readrect(%p, (%4d, %4d), %4d, %4d, %p)\n",
(void *)ifp, xmin, ymin, width, height,
(void *)pp);
@@ -238,9 +274,9 @@ deb_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char
HIDDEN int
deb_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
deb_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_writerect(%p, %4d, %4d, %4d, %4d, %p)\n",
(void *)ifp, xmin, ymin, width, height,
(void *)pp);
@@ -249,9 +285,9 @@ deb_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsign
HIDDEN int
deb_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
deb_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_bwreadrect(%p, (%4d, %4d), %4d, %4d, %p)\n",
(void *)ifp, xmin, ymin, width, height,
(void *)pp);
@@ -260,9 +296,9 @@ deb_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned ch
HIDDEN int
deb_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
deb_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_bwwriterect(%p, %4d, %4d, %4d, %4d, %p)\n",
(void *)ifp, xmin, ymin, width, height,
(void *)pp);
@@ -271,27 +307,27 @@ deb_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsi
HIDDEN int
deb_poll(FBIO *ifp)
deb_poll(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_poll(%p)\n", (void *)ifp);
return 0;
}
HIDDEN int
deb_flush(FBIO *ifp)
deb_flush(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("if_flush(%p)\n", (void *)ifp);
return 0;
}
HIDDEN int
deb_free(FBIO *ifp)
deb_free(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_free(%p)\n", (void *)ifp);
return 0;
}
@@ -299,9 +335,9 @@ deb_free(FBIO *ifp)
/*ARGSUSED*/
HIDDEN int
deb_help(FBIO *ifp)
deb_help(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("Description: %s\n", debug_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
fb_log("Max width/height: %d %d\n",
@@ -323,9 +359,14 @@ Usage: /dev/debug[#]\n\
/* This is the ONLY thing that we "export" */
FBIO debug_interface = {
fb debug_interface = {
0,
FB_DEBUG_MAGIC,
deb_open,
deb_open_existing,
deb_close_existing,
deb_get_fbps,
deb_put_fbps,
deb_close,
deb_clear,
deb_read,
@@ -341,6 +382,8 @@ FBIO debug_interface = {
deb_writerect,
deb_bwreadrect,
deb_bwwriterect,
deb_configure_window,
deb_refresh,
deb_poll,
deb_flush,
deb_free,
+56 -12
View File
@@ -32,6 +32,7 @@
#include "bu/file.h"
#include "bu/log.h"
#include "bu/str.h"
#include "fb_private.h"
#include "fb.h"
@@ -46,11 +47,11 @@
HIDDEN int
dsk_open(FBIO *ifp, const char *file, int width, int height)
dsk_open(fb *ifp, const char *file, int width, int height)
{
static char zero = 0;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* check for default size */
if (width == 0)
@@ -99,16 +100,52 @@ dsk_open(FBIO *ifp, const char *file, int width, int height)
return 0;
}
HIDDEN struct fb_platform_specific *
dsk_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
dsk_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
dsk_close(FBIO *ifp)
dsk_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
return 0;
}
HIDDEN int
dsk_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
dsk_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
dsk_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
dsk_close(fb *ifp)
{
return close(ifp->if_fd);
}
HIDDEN int
dsk_free(FBIO *ifp)
dsk_free(fb *ifp)
{
close(ifp->if_fd);
if (bu_file_delete(ifp->if_name)) {
@@ -123,7 +160,7 @@ dsk_free(FBIO *ifp)
* Clear the disk file to the given color.
*/
HIDDEN int
disk_color_clear(FBIO *ifp, register unsigned char *bpp)
disk_color_clear(fb *ifp, register unsigned char *bpp)
{
static unsigned char pix_buf[DISK_DMA_BYTES] = {0};
register unsigned char *pix_to;
@@ -159,7 +196,7 @@ disk_color_clear(FBIO *ifp, register unsigned char *bpp)
HIDDEN int
dsk_clear(FBIO *ifp, unsigned char *bgpp)
dsk_clear(fb *ifp, unsigned char *bgpp)
{
static RGBpixel black = { 0, 0, 0 };
@@ -171,7 +208,7 @@ dsk_clear(FBIO *ifp, unsigned char *bgpp)
HIDDEN ssize_t
dsk_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
dsk_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
size_t bytes = count * sizeof(RGBpixel);
size_t todo;
@@ -219,7 +256,7 @@ dsk_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
dsk_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
dsk_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
register ssize_t bytes = count * sizeof(RGBpixel);
ssize_t todo;
@@ -250,7 +287,7 @@ dsk_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
HIDDEN int
dsk_rmap(FBIO *ifp, ColorMap *cmap)
dsk_rmap(fb *ifp, ColorMap *cmap)
{
int fd = ifp->if_fd;
@@ -275,7 +312,7 @@ dsk_rmap(FBIO *ifp, ColorMap *cmap)
HIDDEN int
dsk_wmap(FBIO *ifp, const ColorMap *cmap)
dsk_wmap(fb *ifp, const ColorMap *cmap)
{
if (cmap == (ColorMap *) NULL)
/* Do not write default map to file. */
@@ -297,7 +334,7 @@ dsk_wmap(FBIO *ifp, const ColorMap *cmap)
HIDDEN int
dsk_help(FBIO *ifp)
dsk_help(fb *ifp)
{
fb_log("Description: %s\n", disk_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
@@ -318,9 +355,14 @@ dsk_help(FBIO *ifp)
}
FBIO disk_interface = {
fb disk_interface = {
0,
FB_DISK_MAGIC,
dsk_open,
dsk_open_existing,
dsk_close_existing,
dsk_get_fbps,
dsk_put_fbps,
dsk_close,
dsk_clear,
dsk_read,
@@ -336,6 +378,8 @@ FBIO disk_interface = {
fb_sim_writerect,
fb_sim_bwreadrect,
fb_sim_bwwriterect,
dsk_configure_window,
dsk_refresh,
fb_null, /* poll */
fb_null, /* flush */
dsk_free,
+68 -24
View File
@@ -36,12 +36,13 @@
#include "bu/color.h"
#include "bu/log.h"
#include "bu/str.h"
#include "fb_private.h"
#include "fb.h"
/* Per connection private info */
struct mem_info {
FBIO *fbp; /* attached frame buffer (if any) */
fb *fbp; /* attached frame buffer (if any) */
unsigned char *mem; /* memory frame buffer */
ColorMap cmap; /* color map buffer */
int mem_dirty; /* !0 implies unflushed written data */
@@ -74,17 +75,17 @@ static struct modeflags {
HIDDEN int
mem_open(FBIO *ifp, const char *file, int width, int height)
mem_open(fb *ifp, const char *file, int width, int height)
{
int mode;
const char *cp;
FBIO *fbp;
fb *fbp;
char modebuf[80];
char *mp;
int alpha;
struct modeflags *mfp;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* This function doesn't look like it will work if file
* is NULL - stop before we start, if that's the case.*/
@@ -142,7 +143,7 @@ mem_open(FBIO *ifp, const char *file, int width, int height)
if (*cp) {
/* frame buffer device specified */
if ((fbp = fb_open(cp, width, height)) == FBIO_NULL) {
if ((fbp = fb_open(cp, width, height)) == FB_NULL) {
free(MIL(ifp));
return -1;
}
@@ -164,7 +165,7 @@ mem_open(FBIO *ifp, const char *file, int width, int height)
(void)free(MIL(ifp));
return -1;
}
if ((MI(ifp)->fbp != FBIO_NULL)
if ((MI(ifp)->fbp != FB_NULL)
&& (mode & MODE_2MASK) == MODE_2PREREAD) {
/* Pre read all of the image data and cmap */
int got;
@@ -185,14 +186,50 @@ mem_open(FBIO *ifp, const char *file, int width, int height)
return 0;
}
HIDDEN struct fb_platform_specific *
mem_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
mem_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
mem_close(FBIO *ifp)
mem_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
return 0;
}
HIDDEN int
mem_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
mem_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
mem_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
mem_close(fb *ifp)
{
/*
* Flush memory/cmap to attached frame buffer if any
*/
if (MI(ifp)->fbp != FBIO_NULL) {
if (MI(ifp)->fbp != FB_NULL) {
if (MI(ifp)->cmap_dirty) {
fb_wmap(MI(ifp)->fbp, &(MI(ifp)->cmap));
}
@@ -201,7 +238,7 @@ mem_close(FBIO *ifp)
ifp->if_width, ifp->if_height, (unsigned char *)MI(ifp)->mem);
}
fb_close(MI(ifp)->fbp);
MI(ifp)->fbp = FBIO_NULL;
MI(ifp)->fbp = FB_NULL;
}
(void)free((char *)MI(ifp)->mem);
(void)free((char *)MIL(ifp));
@@ -211,7 +248,7 @@ mem_close(FBIO *ifp)
HIDDEN int
mem_clear(FBIO *ifp, unsigned char *pp)
mem_clear(fb *ifp, unsigned char *pp)
{
RGBpixel v;
register int n;
@@ -249,7 +286,7 @@ mem_clear(FBIO *ifp, unsigned char *pp)
HIDDEN ssize_t
mem_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
mem_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
size_t pixels_to_end;
@@ -268,7 +305,7 @@ mem_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
mem_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
mem_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
size_t pixels_to_end;
@@ -292,7 +329,7 @@ mem_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
HIDDEN int
mem_rmap(FBIO *ifp, ColorMap *cmp)
mem_rmap(fb *ifp, ColorMap *cmp)
{
*cmp = MI(ifp)->cmap; /* struct copy */
return 0;
@@ -300,7 +337,7 @@ mem_rmap(FBIO *ifp, ColorMap *cmp)
HIDDEN int
mem_wmap(FBIO *ifp, const ColorMap *cmp)
mem_wmap(fb *ifp, const ColorMap *cmp)
{
if (cmp == COLORMAP_NULL) {
fb_make_linear_cmap(&(MI(ifp)->cmap));
@@ -318,7 +355,7 @@ mem_wmap(FBIO *ifp, const ColorMap *cmp)
HIDDEN int
mem_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
mem_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);
if (MI(ifp)->write_thru) {
@@ -330,7 +367,7 @@ mem_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
mem_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
mem_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
if (MI(ifp)->write_thru) {
return fb_getview(MI(ifp)->fbp, xcenter, ycenter,
@@ -342,7 +379,7 @@ mem_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
HIDDEN int
mem_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
mem_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
{
if (MI(ifp)->write_thru) {
return fb_setcursor(MI(ifp)->fbp,
@@ -353,7 +390,7 @@ mem_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xo
HIDDEN int
mem_cursor(FBIO *ifp, int mode, int x, int y)
mem_cursor(fb *ifp, int mode, int x, int y)
{
fb_sim_cursor(ifp, mode, x, y);
if (MI(ifp)->write_thru) {
@@ -364,7 +401,7 @@ mem_cursor(FBIO *ifp, int mode, int x, int y)
HIDDEN int
mem_getcursor(FBIO *ifp, int *mode, int *x, int *y)
mem_getcursor(fb *ifp, int *mode, int *x, int *y)
{
if (MI(ifp)->write_thru) {
return fb_getcursor(MI(ifp)->fbp, mode, x, y);
@@ -375,7 +412,7 @@ mem_getcursor(FBIO *ifp, int *mode, int *x, int *y)
HIDDEN int
mem_poll(FBIO *ifp)
mem_poll(fb *ifp)
{
if (MI(ifp)->write_thru) {
return fb_poll(MI(ifp)->fbp);
@@ -385,12 +422,12 @@ mem_poll(FBIO *ifp)
HIDDEN int
mem_flush(FBIO *ifp)
mem_flush(fb *ifp)
{
/*
* Flush memory/cmap to attached frame buffer if any
*/
if (MI(ifp)->fbp != FBIO_NULL) {
if (MI(ifp)->fbp != FB_NULL) {
if (MI(ifp)->cmap_dirty) {
fb_wmap(MI(ifp)->fbp, &(MI(ifp)->cmap));
MI(ifp)->cmap_dirty = 0;
@@ -410,7 +447,7 @@ mem_flush(FBIO *ifp)
HIDDEN int
mem_help(FBIO *ifp)
mem_help(fb *ifp)
{
struct modeflags *mfp;
@@ -431,9 +468,14 @@ mem_help(FBIO *ifp)
/* This is the ONLY thing that we normally "export" */
FBIO memory_interface = {
fb memory_interface = {
0,
FB_MEMORY_MAGIC,
mem_open, /* device_open */
mem_open_existing, /* existing device_open */
mem_close_existing, /* existing device_close */
mem_get_fbps,
mem_put_fbps,
mem_close, /* device_close */
mem_clear, /* device_clear */
mem_read, /* buffer_read */
@@ -449,6 +491,8 @@ FBIO memory_interface = {
fb_sim_writerect, /* rectangle write */
fb_sim_bwreadrect,
fb_sim_bwwriterect,
mem_configure_window,
mem_refresh,
mem_poll, /* poll */
mem_flush, /* flush */
mem_close, /* free */
+81 -37
View File
@@ -33,13 +33,14 @@
#include <stdio.h>
#include "bu/log.h"
#include "fb_private.h"
#include "fb.h"
HIDDEN int
null_open(FBIO *ifp, const char *UNUSED(file), int width, int height)
null_open(fb *ifp, const char *UNUSED(file), int width, int height)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (width > 0)
ifp->if_width = width;
@@ -49,65 +50,101 @@ null_open(FBIO *ifp, const char *UNUSED(file), int width, int height)
return 0;
}
HIDDEN struct fb_platform_specific *
null_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
null_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
null_close(FBIO *ifp)
null_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
FB_CK_FBIO(ifp);
return 0;
}
HIDDEN int
null_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
null_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
null_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
null_close(fb *ifp)
{
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_clear(FBIO *ifp, unsigned char *UNUSED(pp))
null_clear(fb *ifp, unsigned char *UNUSED(pp))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN ssize_t
null_read(FBIO *ifp, int UNUSED(x), int UNUSED(y), unsigned char *UNUSED(pixelp), size_t count)
null_read(fb *ifp, int UNUSED(x), int UNUSED(y), unsigned char *UNUSED(pixelp), size_t count)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return count;
}
HIDDEN ssize_t
null_write(FBIO *ifp, int UNUSED(x), int UNUSED(y), const unsigned char *UNUSED(pixelp), size_t count)
null_write(fb *ifp, int UNUSED(x), int UNUSED(y), const unsigned char *UNUSED(pixelp), size_t count)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return count;
}
HIDDEN int
null_rmap(FBIO *ifp, ColorMap *UNUSED(cmp))
null_rmap(fb *ifp, ColorMap *UNUSED(cmp))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_wmap(FBIO *ifp, const ColorMap *UNUSED(cmp))
null_wmap(fb *ifp, const ColorMap *UNUSED(cmp))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_view(FBIO *ifp, int UNUSED(xcenter), int UNUSED(ycenter), int UNUSED(xzoom), int UNUSED(yzoom))
null_view(fb *ifp, int UNUSED(xcenter), int UNUSED(ycenter), int UNUSED(xzoom), int UNUSED(yzoom))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);*/
return 0;
@@ -115,9 +152,9 @@ null_view(FBIO *ifp, int UNUSED(xcenter), int UNUSED(ycenter), int UNUSED(xzoom)
HIDDEN int
null_getview(FBIO *ifp, int *UNUSED(xcenter), int *UNUSED(ycenter), int *UNUSED(xzoom), int *UNUSED(yzoom))
null_getview(fb *ifp, int *UNUSED(xcenter), int *UNUSED(ycenter), int *UNUSED(xzoom), int *UNUSED(yzoom))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);*/
return 0;
@@ -125,18 +162,18 @@ null_getview(FBIO *ifp, int *UNUSED(xcenter), int *UNUSED(ycenter), int *UNUSED(
HIDDEN int
null_setcursor(FBIO *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
null_setcursor(fb *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_cursor(FBIO *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
null_cursor(fb *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*fb_sim_cursor(ifp, mode, x, y);*/
return 0;
@@ -144,9 +181,9 @@ null_cursor(FBIO *ifp, int UNUSED(mode), int UNUSED(x), int UNUSED(y))
HIDDEN int
null_getcursor(FBIO *ifp, int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
null_getcursor(fb *ifp, int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*fb_sim_getcursor(ifp, mode, x, y);*/
return 0;
@@ -154,54 +191,54 @@ null_getcursor(FBIO *ifp, int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
HIDDEN int
null_readrect(FBIO *ifp, int UNUSED(xmin), int UNUSED(ymin), int width, int height, unsigned char *UNUSED(pp))
null_readrect(fb *ifp, int UNUSED(xmin), int UNUSED(ymin), int width, int height, unsigned char *UNUSED(pp))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return width*height;
}
HIDDEN int
null_writerect(FBIO *ifp, int UNUSED(xmin), int UNUSED(ymin), int width, int height, const unsigned char *UNUSED(pp))
null_writerect(fb *ifp, int UNUSED(xmin), int UNUSED(ymin), int width, int height, const unsigned char *UNUSED(pp))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return width*height;
}
HIDDEN int
null_poll(FBIO *ifp)
null_poll(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_flush(FBIO *ifp)
null_flush(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_free(FBIO *ifp)
null_free(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
null_help(FBIO *ifp)
null_help(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("Description: %s\n", null_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
@@ -217,9 +254,14 @@ null_help(FBIO *ifp)
/* This is the ONLY thing that we normally "export" */
FBIO null_interface = {
fb null_interface = {
0,
FB_NULL_MAGIC,
null_open, /* device_open */
null_open_existing, /* existing device_open */
null_close_existing,/* existing device_close */
null_get_fbps,
null_put_fbps,
null_close, /* device_close */
null_clear, /* device_clear */
null_read, /* buffer_read */
@@ -235,6 +277,8 @@ FBIO null_interface = {
null_writerect, /* rectangle write */
null_readrect, /* bw rectangle read */
null_writerect, /* bw rectangle write */
null_configure_window,
null_refresh,
null_poll, /* handle events */
null_flush, /* flush output */
null_free, /* free resources */
+74 -77
View File
@@ -84,6 +84,8 @@
#include "bio.h"
#include "bu.h"
#include "fb_private.h"
#include "fb/fb_platform_specific.h"
#include "fb.h"
@@ -285,7 +287,7 @@ sigkid(int UNUSED(pid))
* screen if one_y equals -1.
*/
HIDDEN void
backbuffer_to_screen(register FBIO *ifp, int one_y)
backbuffer_to_screen(register fb *ifp, int one_y)
{
struct ogl_clip *clp;
@@ -360,7 +362,7 @@ backbuffer_to_screen(register FBIO *ifp, int one_y)
* rectangle of the frame buffer
*/
HIDDEN void
ogl_xmit_scanlines(register FBIO *ifp, int ybase, int nlines, int xbase, int npix)
ogl_xmit_scanlines(register fb *ifp, int ybase, int nlines, int xbase, int npix)
{
register int y;
register int n;
@@ -480,7 +482,7 @@ ogl_xmit_scanlines(register FBIO *ifp, int ybase, int nlines, int xbase, int npi
HIDDEN void
ogl_cminit(register FBIO *ifp)
ogl_cminit(register fb *ifp)
{
register int i;
@@ -524,7 +526,7 @@ ogl_cminit(register FBIO *ifp)
* might need to be increased.
*/
HIDDEN int
ogl_getmem(FBIO *ifp)
ogl_getmem(fb *ifp)
{
#define SHMEM_KEY 42
int pixsize;
@@ -643,7 +645,7 @@ ogl_zapmem(void)
* (xpixmin, xpixmax, ypixmin, ypixmax)
*/
void
ogl_clipper(register FBIO *ifp)
ogl_clipper(register fb *ifp)
{
register struct ogl_clip *clp;
register int i;
@@ -704,7 +706,7 @@ ogl_clipper(register FBIO *ifp)
HIDDEN void
expose_callback(FBIO *ifp)
expose_callback(fb *ifp)
{
XWindowAttributes xwa;
struct ogl_clip *clp;
@@ -830,12 +832,12 @@ expose_callback(FBIO *ifp)
}
void
ogl_configureWindow(FBIO *ifp, int width, int height)
int
ogl_configureWindow(fb *ifp, int width, int height)
{
if (width == OGL(ifp)->win_width &&
height == OGL(ifp)->win_height)
return;
return 1;
ifp->if_width = ifp->if_max_width = width;
ifp->if_height = ifp->if_max_height = height;
@@ -851,11 +853,12 @@ ogl_configureWindow(FBIO *ifp, int width, int height)
ogl_getmem(ifp);
ogl_clipper(ifp);
return 0;
}
HIDDEN void
ogl_do_event(FBIO *ifp)
ogl_do_event(fb *ifp)
{
XEvent event;
@@ -959,7 +962,7 @@ ogl_do_event(FBIO *ifp)
* Return NULL on failure.
*/
HIDDEN XVisualInfo *
fb_ogl_choose_visual(FBIO *ifp)
fb_ogl_choose_visual(fb *ifp)
{
XVisualInfo *vip, *vibase, *maxvip, _template;
@@ -1071,7 +1074,7 @@ fb_ogl_choose_visual(FBIO *ifp)
* linear map, 0 for non-linear map (i.e., non-identity map).
*/
HIDDEN int
is_linear_cmap(register FBIO *ifp)
is_linear_cmap(register fb *ifp)
{
register int i;
@@ -1085,14 +1088,14 @@ is_linear_cmap(register FBIO *ifp)
HIDDEN int
fb_ogl_open(FBIO *ifp, const char *file, int width, int height)
fb_ogl_open(fb *ifp, const char *file, int width, int height)
{
static char title[128];
int mode, i, direct;
long valuemask;
XSetWindowAttributes swa;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/*
* First, attempt to determine operating mode for this open,
@@ -1358,8 +1361,9 @@ fb_ogl_open(FBIO *ifp, const char *file, int width, int height)
}
int
_ogl_open_existing(FBIO *ifp, Display *dpy, Window win, Colormap cmap, XVisualInfo *vip, int width, int height, GLXContext glxc, int double_buffer, int soft_cmap)
_ogl_open_existing(fb *ifp, Display *dpy, Window win, Colormap cmap, XVisualInfo *vip, int width, int height, GLXContext glxc, int double_buffer, int soft_cmap)
{
/*XXX for now use private memory */
@@ -1423,57 +1427,43 @@ _ogl_open_existing(FBIO *ifp, Display *dpy, Window win, Colormap cmap, XVisualIn
return 0;
}
int
ogl_open_existing(FBIO *ifp, int argc, const char **argv)
HIDDEN struct fb_platform_specific *
ogl_get_fbps(uint32_t magic)
{
Display *dpy;
Window win;
Colormap cmap;
XVisualInfo *vip;
int width;
int height;
GLXContext glxc;
int double_buffer;
int soft_cmap;
struct fb_platform_specific *fb_ps = NULL;
struct ogl_fb_info *data = NULL;
BU_GET(fb_ps, struct fb_platform_specific);
BU_GET(data, struct ogl_fb_info);
fb_ps->magic = magic;
fb_ps->data = data;
return fb_ps;
}
if (argc != 10)
return -1;
if (sscanf(argv[1], "%p", (void **)&dpy) != 1)
return -1;
HIDDEN void
ogl_put_fbps(struct fb_platform_specific *fbps)
{
BU_CKMAG(fbps, FB_OGL_MAGIC, "ogl framebuffer");
BU_PUT(fbps->data, struct ogl_fb_info);
BU_PUT(fbps, struct fb_platform_specific);
return;
}
if (sscanf(argv[2], "%p", (void **)&win) != 1)
return -1;
HIDDEN int
ogl_open_existing(fb *ifp, int width, int height, struct fb_platform_specific *fb_p)
{
struct ogl_fb_info *ogl_internal = (struct ogl_fb_info *)fb_p->data;
BU_CKMAG(fb_p, FB_OGL_MAGIC, "ogl framebuffer");
return _ogl_open_existing(ifp, ogl_internal->dpy, ogl_internal->win,
ogl_internal->cmap, ogl_internal->vip, width, height, ogl_internal->glxc,
ogl_internal->double_buffer, ogl_internal->soft_cmap);
if (sscanf(argv[3], "%p", (void **)&cmap) != 1)
return -1;
if (sscanf(argv[4], "%p", (void **)&vip) != 1)
return -1;
if (sscanf(argv[5], "%d", &width) != 1)
return -1;
if (sscanf(argv[6], "%d", &height) != 1)
return -1;
if (sscanf(argv[7], "%p", (void **)&glxc) != 1)
return -1;
if (sscanf(argv[8], "%d", &double_buffer) != 1)
return -1;
if (sscanf(argv[9], "%d", &soft_cmap) != 1)
return -1;
return _ogl_open_existing(ifp, dpy, win, cmap, vip, width, height,
glxc, double_buffer, soft_cmap);
return 0;
}
HIDDEN int
ogl_final_close(FBIO *ifp)
ogl_final_close(fb *ifp)
{
if (CJDEBUG) {
@@ -1515,7 +1505,7 @@ ogl_final_close(FBIO *ifp)
HIDDEN int
ogl_flush(FBIO *ifp)
ogl_flush(fb *ifp)
{
if ((ifp->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH) {
if (glXMakeCurrent(OGL(ifp)->dispp, OGL(ifp)->wind, OGL(ifp)->glxc)==False) {
@@ -1540,7 +1530,7 @@ ogl_flush(FBIO *ifp)
HIDDEN int
fb_ogl_close(FBIO *ifp)
fb_ogl_close(fb *ifp)
{
ogl_flush(ifp);
@@ -1587,7 +1577,7 @@ fb_ogl_close(FBIO *ifp)
int
ogl_close_existing(FBIO *ifp)
ogl_close_existing(fb *ifp)
{
if (OGL(ifp)->cursor)
XDestroyWindow(OGL(ifp)->dispp, OGL(ifp)->cursor);
@@ -1623,7 +1613,7 @@ ogl_close_existing(FBIO *ifp)
* Handle any pending input events
*/
HIDDEN int
ogl_poll(FBIO *ifp)
ogl_poll(fb *ifp)
{
ogl_do_event(ifp);
@@ -1638,7 +1628,7 @@ ogl_poll(FBIO *ifp)
* Free shared memory resources, and close.
*/
HIDDEN int
ogl_free(FBIO *ifp)
ogl_free(fb *ifp)
{
int ret;
@@ -1655,7 +1645,7 @@ ogl_free(FBIO *ifp)
HIDDEN int
ogl_clear(FBIO *ifp, unsigned char *pp)
ogl_clear(fb *ifp, unsigned char *pp)
/* pointer to beginning of memory segment*/
{
@@ -1729,7 +1719,7 @@ ogl_clear(FBIO *ifp, unsigned char *pp)
HIDDEN int
ogl_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
ogl_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
struct ogl_clip *clp;
@@ -1801,7 +1791,7 @@ ogl_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
ogl_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
ogl_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
if (CJDEBUG) printf("entering ogl_getview\n");
@@ -1816,7 +1806,7 @@ ogl_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
/* read count pixels into pixelp starting at x, y */
HIDDEN ssize_t
ogl_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
ogl_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
size_t n;
size_t scan_count; /* # pix on this scanline */
@@ -1867,7 +1857,7 @@ ogl_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
/* write count pixels from pixelp starting at xstart, ystart */
HIDDEN ssize_t
ogl_write(FBIO *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t count)
ogl_write(fb *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t count)
{
size_t scan_count; /* # pix on this scanline */
register unsigned char *cp;
@@ -1996,7 +1986,7 @@ ogl_write(FBIO *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t
* separately.
*/
HIDDEN int
ogl_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
ogl_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
register int x;
register int y;
@@ -2060,7 +2050,7 @@ ogl_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsign
* separately.
*/
HIDDEN int
ogl_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
ogl_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
register int x;
register int y;
@@ -2119,7 +2109,7 @@ ogl_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsi
HIDDEN int
ogl_rmap(register FBIO *ifp, register ColorMap *cmp)
ogl_rmap(register fb *ifp, register ColorMap *cmp)
{
register int i;
@@ -2136,7 +2126,7 @@ ogl_rmap(register FBIO *ifp, register ColorMap *cmp)
HIDDEN int
ogl_wmap(register FBIO *ifp, register const ColorMap *cmp)
ogl_wmap(register fb *ifp, register const ColorMap *cmp)
{
register int i;
int prev; /* !0 = previous cmap was non-linear */
@@ -2196,7 +2186,7 @@ ogl_wmap(register FBIO *ifp, register const ColorMap *cmp)
HIDDEN int
ogl_help(FBIO *ifp)
ogl_help(fb *ifp)
{
struct modeflags *mfp;
XVisualInfo *visual = OGL(ifp)->vip;
@@ -2260,16 +2250,16 @@ ogl_help(FBIO *ifp)
HIDDEN int
ogl_setcursor(FBIO *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
ogl_setcursor(fb *ifp, const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
return 0;
}
HIDDEN int
ogl_cursor(FBIO *ifp, int mode, int x, int y)
ogl_cursor(fb *ifp, int mode, int x, int y)
{
if (mode) {
register int xx, xy;
@@ -2332,7 +2322,7 @@ ogl_cursor(FBIO *ifp, int mode, int x, int y)
int
ogl_refresh(FBIO *ifp, int x, int y, int w, int h)
ogl_refresh(fb *ifp, int x, int y, int w, int h)
{
int mm;
struct ogl_clip *clp;
@@ -2376,10 +2366,15 @@ ogl_refresh(FBIO *ifp, int x, int y, int w, int h)
/* This is the ONLY thing that we normally "export" */
FBIO ogl_interface =
fb ogl_interface =
{
0, /* magic number slot */
FB_OGL_MAGIC,
fb_ogl_open, /* open device */
ogl_open_existing, /* existing device_open */
ogl_close_existing, /* existing device_close */
ogl_get_fbps, /* get platform specific memory */
ogl_put_fbps, /* free platform specific memory */
fb_ogl_close, /* close device */
ogl_clear, /* clear device */
ogl_read, /* read pixels */
@@ -2395,6 +2390,8 @@ FBIO ogl_interface =
ogl_writerect, /* write rectangle */
fb_sim_bwreadrect,
ogl_bwwriterect, /* write rectangle */
ogl_configureWindow,
ogl_refresh,
ogl_poll, /* process events */
ogl_flush, /* flush output */
ogl_free, /* free resources */
+62 -46
View File
@@ -48,7 +48,7 @@
class QMainWindow: public QWindow {
public:
QMainWindow(FBIO *ifp, QImage *image, QWindow *parent = 0);
QMainWindow(fb *ifp, QImage *image, QWindow *parent = 0);
~QMainWindow();
virtual void render(QPainter *painter);
@@ -62,7 +62,7 @@ protected:
void exposeEvent(QExposeEvent *event);
private:
FBIO *ifp;
fb *ifp;
QImage *image;
QBackingStore *m_backingStore;
bool m_update_pending;
@@ -150,7 +150,7 @@ static struct modeflags {
HIDDEN void
qt_updstate(FBIO *ifp)
qt_updstate(fb *ifp)
{
struct qtinfo *qi = QI(ifp);
@@ -162,7 +162,7 @@ qt_updstate(FBIO *ifp)
int want, avail; /* Wanted/available image pixels */
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/*
* Set ?wp to the number of whole zoomed image pixels we could display
@@ -410,11 +410,11 @@ qt_updstate(FBIO *ifp)
__BEGIN_DECLS
void
qt_configureWindow(FBIO *ifp, int width, int height)
qt_configureWindow(fb *ifp, int width, int height)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
if (!qi) {
return;
@@ -451,10 +451,10 @@ qt_configureWindow(FBIO *ifp, int width, int height)
}
int
qt_close_existing(FBIO *ifp)
qt_close_existing(fb *ifp)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
if (qi->qi_image)
delete qi->qi_image;
@@ -468,7 +468,7 @@ __END_DECLS
HIDDEN void
qt_update(FBIO *ifp, int x1, int y1, int w, int h)
qt_update(fb *ifp, int x1, int y1, int w, int h)
{
struct qtinfo *qi = QI(ifp);
@@ -491,7 +491,7 @@ qt_update(FBIO *ifp, int x1, int y1, int w, int h)
unsigned char *grn = qi->qi_grnmap;
unsigned char *blu = qi->qi_blumap;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/*
* Figure out sizes of outermost image pixels
@@ -605,10 +605,10 @@ qt_update(FBIO *ifp, int x1, int y1, int w, int h)
HIDDEN int
qt_rmap(FBIO *ifp, ColorMap *cmp)
qt_rmap(fb *ifp, ColorMap *cmp)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
memcpy(cmp, qi->qi_rgb_cmap, sizeof (ColorMap));
@@ -619,7 +619,7 @@ qt_rmap(FBIO *ifp, ColorMap *cmp)
HIDDEN int
qt_wmap(FBIO *ifp, const ColorMap *cmp)
qt_wmap(fb *ifp, const ColorMap *cmp)
{
struct qtinfo *qi = QI(ifp);
ColorMap *map = qi->qi_rgb_cmap;
@@ -629,7 +629,7 @@ qt_wmap(FBIO *ifp, const ColorMap *cmp)
unsigned char *grn = qi->qi_grnmap;
unsigned char *blu = qi->qi_blumap;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/* Did we have a linear colormap before this call? */
waslincmap = qi->qi_flags & FLG_LINCMAP;
@@ -690,12 +690,12 @@ qt_wmap(FBIO *ifp, const ColorMap *cmp)
}
HIDDEN int
qt_setup(FBIO *ifp, int width, int height)
qt_setup(fb *ifp, int width, int height)
{
struct qtinfo *qi = QI(ifp);
int argc = 1;
char *argv[] = {(char *)"Frame buffer"};
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
qi->qi_qwidth = width;
qi->qi_qheight = height;
@@ -730,7 +730,7 @@ qt_destroy(struct qtinfo *qi)
}
HIDDEN int
qt_open(FBIO *ifp, const char *file, int width, int height)
qt_open(fb *ifp, const char *file, int width, int height)
{
struct qtinfo *qi;
@@ -738,7 +738,7 @@ qt_open(FBIO *ifp, const char *file, int width, int height)
size_t size;
unsigned char *mem = NULL;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
mode = MODE1_LINGERING;
if (file != NULL) {
@@ -846,7 +846,7 @@ qt_open(FBIO *ifp, const char *file, int width, int height)
}
int
_qt_open_existing(FBIO *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg)
_qt_open_existing(fb *ifp, int width, int height, void *qapp, void *qwin, void *qpainter, void *draw, void **qimg)
{
struct qtinfo *qi;
@@ -854,7 +854,7 @@ _qt_open_existing(FBIO *ifp, int width, int height, void *qapp, void *qwin, void
size_t size;
unsigned char *mem = NULL;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
mode = MODE1_LINGERING;
@@ -937,9 +937,20 @@ _qt_open_existing(FBIO *ifp, int width, int height, void *qapp, void *qwin, void
return 0;
}
HIDDEN int
qt_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
qt_close(FBIO *ifp)
qt_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
qt_close(fb *ifp)
{
struct qtinfo *qi = QI(ifp);
@@ -957,7 +968,7 @@ qt_close(FBIO *ifp)
HIDDEN int
qt_clear(FBIO *ifp, unsigned char *pp)
qt_clear(fb *ifp, unsigned char *pp)
{
struct qtinfo *qi = QI(ifp);
@@ -966,7 +977,7 @@ qt_clear(FBIO *ifp, unsigned char *pp)
int n;
unsigned char *cp;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
if (pp == (unsigned char *)NULL) {
red = grn = blu = 0;
@@ -1000,12 +1011,12 @@ qt_clear(FBIO *ifp, unsigned char *pp)
HIDDEN ssize_t
qt_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
qt_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
struct qtinfo *qi = QI(ifp);
size_t maxcount;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/* check origin bounds */
if (x < 0 || x >= qi->qi_iwidth || y < 0 || y >= qi->qi_iheight)
@@ -1025,12 +1036,12 @@ qt_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
qt_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
qt_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
struct qtinfo *qi = QI(ifp);
size_t maxcount;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/* Check origin bounds */
if (x < 0 || x >= qi->qi_iwidth || y < 0 || y >= qi->qi_iheight)
@@ -1065,11 +1076,11 @@ qt_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
HIDDEN int
qt_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
qt_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/* bypass if no change */
if (ifp->if_xcenter == xcenter && ifp->if_ycenter == ycenter
@@ -1099,9 +1110,9 @@ qt_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
qt_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
qt_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
*xcenter = ifp->if_xcenter;
*ycenter = ifp->if_ycenter;
@@ -1113,7 +1124,7 @@ qt_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
HIDDEN int
qt_setcursor(FBIO *UNUSED(ifp), const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
qt_setcursor(fb *UNUSED(ifp), const unsigned char *UNUSED(bits), int UNUSED(xbits), int UNUSED(ybits), int UNUSED(xorig), int UNUSED(yorig))
{
fb_log("qt_setcursor\n");
@@ -1122,7 +1133,7 @@ qt_setcursor(FBIO *UNUSED(ifp), const unsigned char *UNUSED(bits), int UNUSED(xb
HIDDEN int
qt_cursor(FBIO *UNUSED(ifp), int UNUSED(mode), int UNUSED(x), int UNUSED(y))
qt_cursor(fb *UNUSED(ifp), int UNUSED(mode), int UNUSED(x), int UNUSED(y))
{
fb_log("qt_cursor\n");
@@ -1131,7 +1142,7 @@ qt_cursor(FBIO *UNUSED(ifp), int UNUSED(mode), int UNUSED(x), int UNUSED(y))
HIDDEN int
qt_getcursor(FBIO *UNUSED(ifp), int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
qt_getcursor(fb *UNUSED(ifp), int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y))
{
fb_log("qt_getcursor\n");
@@ -1140,10 +1151,10 @@ qt_getcursor(FBIO *UNUSED(ifp), int *UNUSED(mode), int *UNUSED(x), int *UNUSED(y
HIDDEN int
qt_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
qt_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/* Clip arguments */
if (xmin < 0)
@@ -1181,10 +1192,10 @@ qt_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char
HIDDEN int
qt_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
qt_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
/* Clip arguments */
if (xmin < 0)
@@ -1224,10 +1235,10 @@ qt_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigne
HIDDEN void
qt_handle_event(FBIO *ifp, QEvent *event)
qt_handle_event(fb *ifp, QEvent *event)
{
struct qtinfo *qi = QI(ifp);
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
switch (event->type()) {
case QEvent::MouseButtonPress:
@@ -1290,7 +1301,7 @@ qt_handle_event(FBIO *ifp, QEvent *event)
HIDDEN int
qt_poll(FBIO *UNUSED(ifp))
qt_poll(fb *UNUSED(ifp))
{
fb_log("qt_poll\n");
@@ -1299,7 +1310,7 @@ qt_poll(FBIO *UNUSED(ifp))
HIDDEN int
qt_flush(FBIO *ifp)
qt_flush(fb *ifp)
{
struct qtinfo *qi = QI(ifp);
@@ -1312,7 +1323,7 @@ qt_flush(FBIO *ifp)
HIDDEN int
qt_free(FBIO *UNUSED(ifp))
qt_free(fb *UNUSED(ifp))
{
fb_log("qt_free\n");
@@ -1321,7 +1332,7 @@ qt_free(FBIO *UNUSED(ifp))
HIDDEN int
qt_help(FBIO *ifp)
qt_help(fb *ifp)
{
fb_log("Description: %s\n", qt_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
@@ -1336,9 +1347,12 @@ qt_help(FBIO *ifp)
}
FBIO qt_interface = {
fb qt_interface = {
0,
FB_QT_MAGIC,
qt_open, /* device_open */
qt_open_existing,
qt_close_existing,
qt_close, /* device_close */
qt_clear, /* device_clear */
qt_read, /* buffer_read */
@@ -1354,6 +1368,8 @@ FBIO qt_interface = {
qt_writerect, /* rectangle write */
qt_readrect, /* bw rectangle read */
qt_writerect, /* bw rectangle write */
qt_configure_window,
qt_refresh,
qt_poll, /* handle events */
qt_flush, /* flush output */
qt_free, /* free resources */
@@ -1390,7 +1406,7 @@ FBIO qt_interface = {
* ===================================================== Main window class ===============================================
*/
QMainWindow::QMainWindow(FBIO *fb, QImage *img, QWindow *win)
QMainWindow::QMainWindow(fb *fb, QImage *img, QWindow *win)
: QWindow(win)
, m_update_pending(false)
{
+67 -22
View File
@@ -54,6 +54,7 @@
#include "bu.h"
#include "pkg.h"
#include "fb_private.h"
#include "fb.h"
#include "fbmsg.h"
@@ -207,7 +208,7 @@ rem_log(const char *msg)
* then the devname (or NULL if default).
*/
HIDDEN int
rem_open(register FBIO *ifp, const char *file, int width, int height)
rem_open(register fb *ifp, const char *file, int width, int height)
{
size_t i;
struct pkg_conn *pc;
@@ -217,7 +218,7 @@ rem_open(register FBIO *ifp, const char *file, int width, int height)
char device[MAX_HOSTNAME] = {0};
int port = 0;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (file == NULL || parse_file(file, hostname, &port, device, MAX_HOSTNAME) < 0) {
/* too wild for our tastes */
@@ -284,9 +285,46 @@ rem_open(register FBIO *ifp, const char *file, int width, int height)
return 0; /* OK */
}
HIDDEN struct fb_platform_specific *
rem_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
rem_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
rem_close(FBIO *ifp)
rem_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
return 0;
}
HIDDEN int
rem_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
rem_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
rem_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
rem_close(fb *ifp)
{
unsigned char buf[NET_LONG_LEN+1];
@@ -311,7 +349,7 @@ rem_close(FBIO *ifp)
HIDDEN int
rem_free(FBIO *ifp)
rem_free(fb *ifp)
{
unsigned char buf[NET_LONG_LEN+1];
@@ -326,7 +364,7 @@ rem_free(FBIO *ifp)
HIDDEN int
rem_clear(FBIO *ifp, unsigned char *bgpp)
rem_clear(fb *ifp, unsigned char *bgpp)
{
unsigned char buf[NET_LONG_LEN+1];
@@ -350,7 +388,7 @@ rem_clear(FBIO *ifp, unsigned char *bgpp)
* Send as longs: x, y, num
*/
HIDDEN ssize_t
rem_read(register FBIO *ifp, int x, int y, unsigned char *pixelp, size_t num)
rem_read(register fb *ifp, int x, int y, unsigned char *pixelp, size_t num)
{
ssize_t ret;
unsigned char buf[3*NET_LONG_LEN+1];
@@ -379,7 +417,7 @@ rem_read(register FBIO *ifp, int x, int y, unsigned char *pixelp, size_t num)
* As longs, x, y, num
*/
HIDDEN ssize_t
rem_write(register FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t num)
rem_write(register fb *ifp, int x, int y, const unsigned char *pixelp, size_t num)
{
ssize_t ret;
unsigned char buf[3*NET_LONG_LEN+1];
@@ -403,7 +441,7 @@ rem_write(register FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t
HIDDEN int
rem_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
rem_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
int num;
int ret;
@@ -433,7 +471,7 @@ rem_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char
HIDDEN int
rem_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
rem_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
int num;
int ret;
@@ -464,7 +502,7 @@ rem_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsign
* Issue: Determining if other end has support for this yet.
*/
HIDDEN int
rem_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
rem_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
int num;
int ret;
@@ -493,7 +531,7 @@ rem_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned ch
HIDDEN int
rem_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
rem_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
int num;
int ret;
@@ -524,7 +562,7 @@ rem_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsi
* 32-bit longs: mode, x, y
*/
HIDDEN int
rem_cursor(FBIO *ifp, int mode, int x, int y)
rem_cursor(fb *ifp, int mode, int x, int y)
{
unsigned char buf[3*NET_LONG_LEN+1];
@@ -541,7 +579,7 @@ rem_cursor(FBIO *ifp, int mode, int x, int y)
HIDDEN int
rem_getcursor(FBIO *ifp, int *mode, int *x, int *y)
rem_getcursor(fb *ifp, int *mode, int *x, int *y)
{
unsigned char buf[4*NET_LONG_LEN+1];
@@ -569,7 +607,7 @@ rem_getcursor(FBIO *ifp, int *mode, int *x, int *y)
* Do not confuse this routine with the old fb_scursor() call.
*/
HIDDEN int
rem_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
rem_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
{
unsigned char buf[4*NET_LONG_LEN+1];
int ret;
@@ -598,7 +636,7 @@ rem_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xo
HIDDEN int
rem_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
rem_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
unsigned char buf[4*NET_LONG_LEN+1];
@@ -616,7 +654,7 @@ rem_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
rem_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
rem_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
unsigned char buf[5*NET_LONG_LEN+1];
@@ -640,7 +678,7 @@ rem_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
#define REM_CMAP_BYTES (256*3*2)
HIDDEN int
rem_rmap(register FBIO *ifp, register ColorMap *cmap)
rem_rmap(register fb *ifp, register ColorMap *cmap)
{
register int i;
unsigned char buf[NET_LONG_LEN+1];
@@ -662,7 +700,7 @@ rem_rmap(register FBIO *ifp, register ColorMap *cmap)
HIDDEN int
rem_wmap(register FBIO *ifp, const ColorMap *cmap)
rem_wmap(register fb *ifp, const ColorMap *cmap)
{
register int i;
unsigned char buf[NET_LONG_LEN+1];
@@ -692,7 +730,7 @@ rem_wmap(register FBIO *ifp, const ColorMap *cmap)
* fact, we may not want to send polls at all....
*/
HIDDEN int
rem_poll(FBIO *ifp)
rem_poll(fb *ifp)
{
/* send a poll package to remote */
if (pkg_send(MSG_FBPOLL, (char *)0, 0, PCP(ifp)) < 0)
@@ -702,7 +740,7 @@ rem_poll(FBIO *ifp)
HIDDEN int
rem_flush(FBIO *ifp)
rem_flush(fb *ifp)
{
unsigned char buf[NET_LONG_LEN+1];
@@ -716,7 +754,7 @@ rem_flush(FBIO *ifp)
HIDDEN int
rem_help(FBIO *ifp)
rem_help(fb *ifp)
{
unsigned char buf[1*NET_LONG_LEN+1];
@@ -745,9 +783,14 @@ pkgerror(struct pkg_conn *UNUSED(pcpp), char *buf)
}
FBIO remote_interface = {
fb remote_interface = {
0,
FB_REMOTE_MAGIC,
rem_open,
rem_open_existing,
rem_close_existing,
rem_get_fbps,
rem_put_fbps,
rem_close,
rem_clear,
rem_read,
@@ -763,6 +806,8 @@ FBIO remote_interface = {
rem_writerect,
rem_bwreadrect,
rem_bwwriterect,
rem_configure_window,
rem_refresh,
rem_poll,
rem_flush,
rem_free,
+112 -66
View File
@@ -34,25 +34,26 @@
#include "bu/log.h"
#include "bu/str.h"
#include "fb_private.h"
#include "fb.h"
/* List of interface struct pointers, one per dev */
#define MAXIF 32
struct stkinfo {
FBIO *if_list[MAXIF];
fb *if_list[MAXIF];
};
#define SI(ptr) ((struct stkinfo *)((ptr)->u1.p))
#define SIL(ptr) ((ptr)->u1.p) /* left hand side version */
HIDDEN int
stk_open(FBIO *ifp, const char *file, int width, int height)
stk_open(fb *ifp, const char *file, int width, int height)
{
int i;
const char *cp;
char devbuf[80];
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Check for /dev/stack */
if (bu_strncmp(file, ifp->if_name, strlen("/dev/stack")) != 0) {
@@ -81,7 +82,7 @@ stk_open(FBIO *ifp, const char *file, int width, int height)
i = 0;
while (i < MAXIF && *cp != '\0') {
register char *dp;
register FBIO *fbp;
register fb *fbp;
while (*cp != '\0' && (*cp == ' ' || *cp == '\t' || *cp == ';'))
cp++; /* skip blanks and separators */
@@ -91,8 +92,8 @@ stk_open(FBIO *ifp, const char *file, int width, int height)
while (*cp != '\0' && *cp != ';')
*dp++ = *cp++;
*dp = '\0';
if ((fbp = fb_open(devbuf, width, height)) != FBIO_NULL) {
FB_CK_FBIO(fbp);
if ((fbp = fb_open(devbuf, width, height)) != FB_NULL) {
FB_CK_FB(fbp);
/* Track the minimum of all the actual sizes */
if (fbp->if_width < ifp->if_width)
ifp->if_width = fbp->if_width;
@@ -111,15 +112,53 @@ stk_open(FBIO *ifp, const char *file, int width, int height)
return -1;
}
HIDDEN struct fb_platform_specific *
stk_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
stk_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
stk_close(FBIO *ifp)
stk_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
register FBIO **ip = SI(ifp)->if_list;
return 0;
}
FB_CK_FBIO(ifp);
while (*ip != (FBIO *)NULL) {
FB_CK_FBIO((*ip));
HIDDEN int
stk_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
stk_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
stk_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
stk_close(fb *ifp)
{
register fb **ip = SI(ifp)->if_list;
FB_CK_FB(ifp);
while (*ip != (fb *)NULL) {
FB_CK_FB((*ip));
fb_close((*ip));
ip++;
}
@@ -129,11 +168,11 @@ stk_close(FBIO *ifp)
HIDDEN int
stk_clear(FBIO *ifp, unsigned char *pp)
stk_clear(fb *ifp, unsigned char *pp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_clear((*ip), pp);
ip++;
}
@@ -143,11 +182,11 @@ stk_clear(FBIO *ifp, unsigned char *pp)
HIDDEN ssize_t
stk_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
stk_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
if (*ip != (FBIO *)NULL) {
if (*ip != (fb *)NULL) {
fb_read((*ip), x, y, pixelp, count);
}
@@ -156,11 +195,11 @@ stk_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
stk_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
stk_write(fb *ifp, int x, int y, const unsigned char *pixelp, size_t count)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_write((*ip), x, y, pixelp, count);
ip++;
}
@@ -173,11 +212,11 @@ stk_write(FBIO *ifp, int x, int y, const unsigned char *pixelp, size_t count)
* Read only from the first source on the stack.
*/
HIDDEN int
stk_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
stk_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
if (*ip != (FBIO *)NULL) {
if (*ip != (fb *)NULL) {
(void)fb_readrect((*ip), xmin, ymin, width, height, pp);
}
@@ -189,11 +228,11 @@ stk_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char
* Write to all destinations on the stack
*/
HIDDEN int
stk_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
stk_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
(void)fb_writerect((*ip), xmin, ymin, width, height, pp);
ip++;
}
@@ -206,11 +245,11 @@ stk_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsign
* Read only from the first source on the stack.
*/
HIDDEN int
stk_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
stk_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
if (*ip != (FBIO *)NULL) {
if (*ip != (fb *)NULL) {
(void)fb_bwreadrect((*ip), xmin, ymin, width, height, pp);
}
@@ -222,11 +261,11 @@ stk_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned ch
* Write to all destinations on the stack
*/
HIDDEN int
stk_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
stk_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
(void)fb_bwwriterect((*ip), xmin, ymin, width, height, pp);
ip++;
}
@@ -236,11 +275,11 @@ stk_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsi
HIDDEN int
stk_rmap(FBIO *ifp, ColorMap *cmp)
stk_rmap(fb *ifp, ColorMap *cmp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
if (*ip != (FBIO *)NULL) {
if (*ip != (fb *)NULL) {
fb_rmap((*ip), cmp);
}
@@ -249,11 +288,11 @@ stk_rmap(FBIO *ifp, ColorMap *cmp)
HIDDEN int
stk_wmap(FBIO *ifp, const ColorMap *cmp)
stk_wmap(fb *ifp, const ColorMap *cmp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_wmap((*ip), cmp);
ip++;
}
@@ -263,11 +302,11 @@ stk_wmap(FBIO *ifp, const ColorMap *cmp)
HIDDEN int
stk_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
stk_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_view((*ip), xcenter, ycenter, xzoom, yzoom);
ip++;
}
@@ -277,11 +316,11 @@ stk_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
stk_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
stk_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
if (*ip != (FBIO *)NULL) {
if (*ip != (fb *)NULL) {
fb_getview((*ip), xcenter, ycenter, xzoom, yzoom);
}
@@ -290,11 +329,11 @@ stk_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
HIDDEN int
stk_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
stk_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_setcursor((*ip), bits, xbits, ybits, xorig, yorig);
ip++;
}
@@ -304,11 +343,11 @@ stk_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xo
HIDDEN int
stk_cursor(FBIO *ifp, int mode, int x, int y)
stk_cursor(fb *ifp, int mode, int x, int y)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_cursor((*ip), mode, x, y);
ip++;
}
@@ -318,11 +357,11 @@ stk_cursor(FBIO *ifp, int mode, int x, int y)
HIDDEN int
stk_getcursor(FBIO *ifp, int *mode, int *x, int *y)
stk_getcursor(fb *ifp, int *mode, int *x, int *y)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
if (*ip != (FBIO *)NULL) {
if (*ip != (fb *)NULL) {
fb_getcursor((*ip), mode, x, y);
}
@@ -331,11 +370,11 @@ stk_getcursor(FBIO *ifp, int *mode, int *x, int *y)
HIDDEN int
stk_poll(FBIO *ifp)
stk_poll(fb *ifp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_poll((*ip));
ip++;
}
@@ -345,11 +384,11 @@ stk_poll(FBIO *ifp)
HIDDEN int
stk_flush(FBIO *ifp)
stk_flush(fb *ifp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_flush((*ip));
ip++;
}
@@ -359,11 +398,11 @@ stk_flush(FBIO *ifp)
HIDDEN int
stk_free(FBIO *ifp)
stk_free(fb *ifp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_free((*ip));
ip++;
}
@@ -373,16 +412,16 @@ stk_free(FBIO *ifp)
HIDDEN int
stk_help(FBIO *ifp)
stk_help(fb *ifp)
{
register FBIO **ip = SI(ifp)->if_list;
register fb **ip = SI(ifp)->if_list;
int i;
fb_log("Device: /dev/stack\n");
fb_log("Usage: /dev/stack device_one; device_two; ...\n");
i = 0;
while (*ip != (FBIO *)NULL) {
while (*ip != (fb *)NULL) {
fb_log("=== Current stack device #%d ===\n", i++);
fb_help((*ip));
ip++;
@@ -393,9 +432,14 @@ stk_help(FBIO *ifp)
/* This is the ONLY thing that we normally "export" */
FBIO stk_interface = {
fb stk_interface = {
0,
FB_STK_MAGIC,
stk_open, /* device_open */
stk_open_existing, /* device_open */
stk_close_existing,
stk_get_fbps,
stk_put_fbps,
stk_close, /* device_close */
stk_clear, /* device_clear */
stk_read, /* buffer_read */
@@ -411,6 +455,8 @@ FBIO stk_interface = {
stk_writerect, /* write rectangle */
stk_bwreadrect, /* read bw rectangle */
stk_bwwriterect, /* write bw rectangle */
stk_configure_window,
stk_refresh,
stk_poll, /* handle events */
stk_flush, /* flush output */
stk_free, /* free resources */
+84 -40
View File
@@ -44,6 +44,7 @@
#include "bu/log.h"
#include "bu/str.h"
#include "fb_private.h"
#include "fb.h"
@@ -79,7 +80,7 @@ char *tkwrite_buffer;
HIDDEN int
fb_tk_open(FBIO *ifp, const char *file, int width, int height)
fb_tk_open(fb *ifp, const char *file, int width, int height)
{
int pid = -1;
const char *cmd = "package require Tk";
@@ -96,7 +97,7 @@ fb_tk_open(FBIO *ifp, const char *file, int width, int height)
char *buffer;
char *linebuffer;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (file == (char *)NULL)
fb_log("fb_open(0x%lx, NULL, %d, %d)\n",
(unsigned long)ifp, width, height);
@@ -279,16 +280,52 @@ fb_tk_open(FBIO *ifp, const char *file, int width, int height)
return 0;
}
HIDDEN struct fb_platform_specific *
tk_get_fbps(uint32_t UNUSED(magic))
{
return NULL;
}
HIDDEN void
tk_put_fbps(struct fb_platform_specific *UNUSED(fbps))
{
return;
}
HIDDEN int
fb_tk_close(FBIO *ifp)
tk_open_existing(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height), struct fb_platform_specific *UNUSED(fb_p))
{
return 0;
}
HIDDEN int
tk_close_existing(fb *UNUSED(ifp))
{
return 0;
}
HIDDEN int
tk_configure_window(fb *UNUSED(ifp), int UNUSED(width), int UNUSED(height))
{
return 0;
}
HIDDEN int
tk_refresh(fb *UNUSED(ifp), int UNUSED(x), int UNUSED(y), int UNUSED(w), int UNUSED(h))
{
return 0;
}
HIDDEN int
fb_tk_close(fb *ifp)
{
int y[2];
int ret;
y[0] = -1;
y[1] = 0;
printf("Entering fb_tk_close\n");
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
ret = write(p[1], y, sizeof(y));
close(p[1]);
printf("Sent write (ret=%d) from fb_tk_close\n", ret);
@@ -297,9 +334,9 @@ fb_tk_close(FBIO *ifp)
HIDDEN int
tk_clear(FBIO *ifp, unsigned char *pp)
tk_clear(fb *ifp, unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (pp == 0)
fb_log("fb_clear(0x%lx, NULL)\n", (unsigned long)ifp);
else
@@ -312,9 +349,9 @@ tk_clear(FBIO *ifp, unsigned char *pp)
HIDDEN ssize_t
tk_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
tk_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_read(0x%lx, %4d, %4d, 0x%lx, %ld)\n",
(unsigned long)ifp, x, y,
(unsigned long)pixelp, (long)count);
@@ -323,11 +360,11 @@ tk_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
HIDDEN ssize_t
tk_write(FBIO *ifp, int UNUSED(x), int y, const unsigned char *pixelp, size_t count)
tk_write(fb *ifp, int UNUSED(x), int y, const unsigned char *pixelp, size_t count)
{
uint32_t line[3];
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
/* Set local values of Tk_PhotoImageBlock */
block.pixelPtr = (unsigned char *)pixelp;
block.width = count;
@@ -352,9 +389,9 @@ tk_write(FBIO *ifp, int UNUSED(x), int y, const unsigned char *pixelp, size_t co
HIDDEN int
tk_rmap(FBIO *ifp, ColorMap *cmp)
tk_rmap(fb *ifp, ColorMap *cmp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_rmap(0x%lx, 0x%lx)\n",
(unsigned long)ifp, (unsigned long)cmp);
return 0;
@@ -362,11 +399,11 @@ tk_rmap(FBIO *ifp, ColorMap *cmp)
HIDDEN int
tk_wmap(FBIO *ifp, const ColorMap *cmp)
tk_wmap(fb *ifp, const ColorMap *cmp)
{
int i;
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
if (cmp == NULL)
fb_log("fb_wmap(0x%lx, NULL)\n",
(unsigned long)ifp);
@@ -389,9 +426,9 @@ tk_wmap(FBIO *ifp, const ColorMap *cmp)
HIDDEN int
tk_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
tk_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_view(0x%lx, %4d, %4d, %4d, %4d)\n",
(unsigned long)ifp, xcenter, ycenter, xzoom, yzoom);
fb_sim_view(ifp, xcenter, ycenter, xzoom, yzoom);
@@ -400,9 +437,9 @@ tk_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
tk_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
tk_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_getview(0x%lx, 0x%x, 0x%x, 0x%x, 0x%x)\n",
(unsigned long)ifp, xcenter, ycenter, xzoom, yzoom);
fb_sim_getview(ifp, xcenter, ycenter, xzoom, yzoom);
@@ -413,9 +450,9 @@ tk_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
HIDDEN int
tk_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
tk_setcursor(fb *ifp, const unsigned char *bits, int xbits, int ybits, int xorig, int yorig)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_setcursor(0x%lx, 0x%lx, %d, %d, %d, %d)\n",
(unsigned long)ifp, bits, xbits, ybits, xorig, yorig);
return 0;
@@ -423,7 +460,7 @@ tk_setcursor(FBIO *ifp, const unsigned char *bits, int xbits, int ybits, int xor
HIDDEN int
tk_cursor(FBIO *ifp, int mode, int x, int y)
tk_cursor(fb *ifp, int mode, int x, int y)
{
fb_log("fb_cursor(0x%lx, %d, %4d, %4d)\n",
(unsigned long)ifp, mode, x, y);
@@ -433,9 +470,9 @@ tk_cursor(FBIO *ifp, int mode, int x, int y)
HIDDEN int
tk_getcursor(FBIO *ifp, int *mode, int *x, int *y)
tk_getcursor(fb *ifp, int *mode, int *x, int *y)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_getcursor(0x%lx, 0x%x, 0x%x, 0x%x)\n",
(unsigned long)ifp, mode, x, y);
fb_sim_getcursor(ifp, mode, x, y);
@@ -445,9 +482,9 @@ tk_getcursor(FBIO *ifp, int *mode, int *x, int *y)
HIDDEN int
tk_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
tk_readrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_readrect(0x%lx, (%4d, %4d), %4d, %4d, 0x%lx)\n",
(unsigned long)ifp, xmin, ymin, width, height,
(unsigned long)pp);
@@ -456,9 +493,9 @@ tk_readrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char
HIDDEN int
tk_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
tk_writerect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_writerect(0x%lx, %4d, %4d, %4d, %4d, 0x%lx)\n",
(unsigned long)ifp, xmin, ymin, width, height,
(unsigned long)pp);
@@ -467,9 +504,9 @@ tk_writerect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigne
HIDDEN int
tk_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
tk_bwreadrect(fb *ifp, int xmin, int ymin, int width, int height, unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_bwreadrect(0x%lx, (%4d, %4d), %4d, %4d, 0x%lx)\n",
(unsigned long)ifp, xmin, ymin, width, height,
(unsigned long)pp);
@@ -478,9 +515,9 @@ tk_bwreadrect(FBIO *ifp, int xmin, int ymin, int width, int height, unsigned cha
HIDDEN int
tk_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
tk_bwwriterect(fb *ifp, int xmin, int ymin, int width, int height, const unsigned char *pp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_bwwriterect(0x%lx, %4d, %4d, %4d, %4d, 0x%lx)\n",
(unsigned long)ifp, xmin, ymin, width, height,
(unsigned long)pp);
@@ -489,9 +526,9 @@ tk_bwwriterect(FBIO *ifp, int xmin, int ymin, int width, int height, const unsig
HIDDEN int
tk_poll(FBIO *ifp)
tk_poll(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
while (Tcl_DoOneEvent(TCL_ALL_EVENTS|TCL_DONT_WAIT));
fb_log("fb_poll(0x%lx)\n", (unsigned long)ifp);
return 0;
@@ -499,18 +536,18 @@ tk_poll(FBIO *ifp)
HIDDEN int
tk_flush(FBIO *ifp)
tk_flush(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("if_flush(0x%lx)\n", (unsigned long)ifp);
return 0;
}
HIDDEN int
tk_free(FBIO *ifp)
tk_free(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("fb_free(0x%lx)\n", (unsigned long)ifp);
return 0;
}
@@ -518,9 +555,9 @@ tk_free(FBIO *ifp)
/*ARGSUSED*/
HIDDEN int
tk_help(FBIO *ifp)
tk_help(fb *ifp)
{
FB_CK_FBIO(ifp);
FB_CK_FB(ifp);
fb_log("Description: %s\n", tk_interface.if_type);
fb_log("Device: %s\n", ifp->if_name);
fb_log("Max width/height: %d %d\n",
@@ -541,9 +578,14 @@ Usage: /dev/tk[#]\n\
}
/* This is the ONLY thing that we "export" */
FBIO tk_interface = {
fb tk_interface = {
0,
FB_TK_MAGIC,
fb_tk_open,
tk_open_existing,
tk_close_existing,
tk_get_fbps,
tk_put_fbps,
fb_tk_close,
tk_clear,
tk_read,
@@ -559,6 +601,8 @@ FBIO tk_interface = {
tk_writerect,
tk_bwreadrect,
tk_bwwriterect,
tk_configure_window,
tk_refresh,
tk_poll,
tk_flush,
tk_free,
+51 -44
View File
@@ -66,22 +66,22 @@
#define YMAXSCREEN 16383
/* Internal callbacks etc.*/
HIDDEN void wgl_do_event(FBIO *ifp);
HIDDEN void expose_callback(FBIO *ifp, int eventPtr);
void wgl_configureWindow(FBIO *ifp, int width, int height);
HIDDEN void wgl_do_event(fb *ifp);
HIDDEN void expose_callback(fb *ifp, int eventPtr);
void wgl_configureWindow(fb *ifp, int width, int height);
/* Other Internal routines */
HIDDEN void wgl_clipper(FBIO *ifp);
HIDDEN int wgl_getmem(FBIO *ifp);
HIDDEN void backbuffer_to_screen(FBIO *ifp, int one_y);
HIDDEN void wgl_cminit(FBIO *ifp);
HIDDEN PIXELFORMATDESCRIPTOR * wgl_choose_visual(FBIO *ifp);
HIDDEN int is_linear_cmap(FBIO *ifp);
HIDDEN void wgl_clipper(fb *ifp);
HIDDEN int wgl_getmem(fb *ifp);
HIDDEN void backbuffer_to_screen(fb *ifp, int one_y);
HIDDEN void wgl_cminit(fb *ifp);
HIDDEN PIXELFORMATDESCRIPTOR * wgl_choose_visual(fb *ifp);
HIDDEN int is_linear_cmap(fb *ifp);
HIDDEN int wgl_nwindows = 0; /* number of open windows */
FBIO *saveifp;
fb *saveifp;
int titleBarHeight = 0;
int borderWidth = 0;
@@ -291,7 +291,7 @@ HIDDEN struct modeflags {
* might need to be increased.
*/
HIDDEN int
wgl_getmem(FBIO *ifp)
wgl_getmem(fb *ifp)
{
int pixsize;
int size;
@@ -355,7 +355,7 @@ sigkid(int UNUSED(pid))
* rectangle of the frame buffer
*/
HIDDEN void
wgl_xmit_scanlines(FBIO *ifp, int ybase, int nlines, int xbase, int npix)
wgl_xmit_scanlines(fb *ifp, int ybase, int nlines, int xbase, int npix)
{
int y;
int n;
@@ -542,7 +542,7 @@ MainWndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
HIDDEN int
wgl_open(FBIO *ifp, const char *file, int width, int height)
wgl_open(fb *ifp, const char *file, int width, int height)
{
static char title[128];
int mode, ret;
@@ -553,7 +553,7 @@ wgl_open(FBIO *ifp, const char *file, int width, int height)
DWORD Dword;
WNDCLASS wndclass;
FB_CK_FBIO(ifp);
FB_CK_fb(ifp);
saveifp = ifp;
@@ -739,7 +739,7 @@ wgl_open(FBIO *ifp, const char *file, int width, int height)
int
_wgl_open_existing(FBIO *ifp,
_wgl_open_existing(fb *ifp,
Display *dpy,
Window win,
Colormap cmap,
@@ -816,7 +816,7 @@ _wgl_open_existing(FBIO *ifp,
int
wgl_open_existing(FBIO *ifp, int argc, const char **argv)
wgl_open_existing(fb *ifp, int argc, const char **argv)
{
Display *dpy;
Window win;
@@ -868,7 +868,7 @@ wgl_open_existing(FBIO *ifp, int argc, const char **argv)
HIDDEN int
wgl_final_close(FBIO *ifp)
wgl_final_close(fb *ifp)
{
if (CJDEBUG) {
@@ -904,7 +904,7 @@ wgl_final_close(FBIO *ifp)
HIDDEN int
wgl_flush(FBIO *ifp)
wgl_flush(fb *ifp)
{
if ((ifp->if_mode & MODE_12MASK) == MODE_12DELAY_WRITES_TILL_FLUSH) {
@@ -932,7 +932,7 @@ wgl_flush(FBIO *ifp)
HIDDEN int
wgl_close(FBIO *ifp)
wgl_close(fb *ifp)
{
wgl_flush(ifp);
@@ -975,7 +975,7 @@ wgl_close(FBIO *ifp)
int
wgl_close_existing(FBIO *ifp)
wgl_close_existing(fb *ifp)
{
/*
if (WGL(ifp)->cursor)
@@ -1004,7 +1004,7 @@ wgl_close_existing(FBIO *ifp)
* Handle any pending input events
*/
HIDDEN int
wgl_poll(FBIO *ifp)
wgl_poll(fb *ifp)
{
wgl_do_event(ifp);
@@ -1019,7 +1019,7 @@ wgl_poll(FBIO *ifp)
* Free shared memory resources, and close.
*/
HIDDEN int
wgl_free(FBIO *ifp)
wgl_free(fb *ifp)
{
int ret;
@@ -1039,7 +1039,7 @@ wgl_free(FBIO *ifp)
* pp is a pointer to beginning of memory segment
*/
HIDDEN int
wgl_clear(FBIO *ifp, unsigned char *pp)
wgl_clear(fb *ifp, unsigned char *pp)
{
struct wgl_pixel bg;
struct wgl_pixel *wglp;
@@ -1111,7 +1111,7 @@ wgl_clear(FBIO *ifp, unsigned char *pp)
HIDDEN int
wgl_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
wgl_view(fb *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
{
struct wgl_clip *clp;
@@ -1182,7 +1182,7 @@ wgl_view(FBIO *ifp, int xcenter, int ycenter, int xzoom, int yzoom)
HIDDEN int
wgl_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
wgl_getview(fb *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
{
if (CJDEBUG) printf("entering wgl_getview\n");
@@ -1199,7 +1199,7 @@ wgl_getview(FBIO *ifp, int *xcenter, int *ycenter, int *xzoom, int *yzoom)
* read count pixels into pixelp starting at x, y
*/
HIDDEN int
wgl_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
wgl_read(fb *ifp, int x, int y, unsigned char *pixelp, size_t count)
{
size_t n;
size_t scan_count; /* # pix on this scanline */
@@ -1252,7 +1252,7 @@ wgl_read(FBIO *ifp, int x, int y, unsigned char *pixelp, size_t count)
* write count pixels from pixelp starting at xstart, ystart
*/
HIDDEN int
wgl_write(FBIO *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t count)
wgl_write(fb *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t count)
{
size_t scan_count; /* # pix on this scanline */
size_t pix_count; /* # pixels to send */
@@ -1380,7 +1380,7 @@ wgl_write(FBIO *ifp, int xstart, int ystart, const unsigned char *pixelp, size_t
* separately.
*/
HIDDEN int
wgl_writerect(FBIO *ifp,
wgl_writerect(fb *ifp,
int xmin,
int ymin,
int width,
@@ -1449,7 +1449,7 @@ wgl_writerect(FBIO *ifp,
* separately.
*/
HIDDEN int
wgl_bwwriterect(FBIO *ifp,
wgl_bwwriterect(fb *ifp,
int xmin,
int ymin,
int width,
@@ -1513,7 +1513,7 @@ wgl_bwwriterect(FBIO *ifp,
HIDDEN int
wgl_rmap(FBIO *ifp, ColorMap *cmp)
wgl_rmap(fb *ifp, ColorMap *cmp)
{
int i;
@@ -1534,7 +1534,7 @@ wgl_rmap(FBIO *ifp, ColorMap *cmp)
* linear map, 0 for non-linear map (i.e., non-identity map).
*/
HIDDEN int
is_linear_cmap(FBIO *ifp)
is_linear_cmap(fb *ifp)
{
int i;
@@ -1548,7 +1548,7 @@ is_linear_cmap(FBIO *ifp)
HIDDEN void
wgl_cminit(FBIO *ifp)
wgl_cminit(fb *ifp)
{
int i;
@@ -1561,7 +1561,7 @@ wgl_cminit(FBIO *ifp)
HIDDEN int
wgl_wmap(FBIO *ifp, const ColorMap *cmp)
wgl_wmap(fb *ifp, const ColorMap *cmp)
{
int i;
int prev; /* !0 = previous cmap was non-linear */
@@ -1611,7 +1611,7 @@ wgl_wmap(FBIO *ifp, const ColorMap *cmp)
HIDDEN int
wgl_help(FBIO *ifp)
wgl_help(fb *ifp)
{
struct modeflags *mfp;
@@ -1638,7 +1638,7 @@ wgl_help(FBIO *ifp)
HIDDEN int
wgl_setcursor(FBIO *ifp,
wgl_setcursor(fb *ifp,
const unsigned char *bits,
int xbits,
int ybits,
@@ -1650,7 +1650,7 @@ wgl_setcursor(FBIO *ifp,
HIDDEN int
wgl_cursor(FBIO *ifp, int mode, int x, int y)
wgl_cursor(fb *ifp, int mode, int x, int y)
{
return 0;
}
@@ -1670,7 +1670,7 @@ wgl_cursor(FBIO *ifp, int mode, int x, int y)
* (xpixmin, xpixmax, ypixmin, ypixmax)
*/
HIDDEN void
wgl_clipper(FBIO *ifp)
wgl_clipper(fb *ifp)
{
struct wgl_clip *clp;
int i;
@@ -1735,7 +1735,7 @@ wgl_clipper(FBIO *ifp)
/********************************/
HIDDEN void
wgl_do_event(FBIO *ifp)
wgl_do_event(fb *ifp)
{
MSG msg;
BOOL bRet;
@@ -1753,7 +1753,7 @@ wgl_do_event(FBIO *ifp)
HIDDEN void
expose_callback(FBIO *ifp, int eventPtr)
expose_callback(fb *ifp, int eventPtr)
{
/* XWindowAttributes xwa; */
struct wgl_clip *clp;
@@ -1877,7 +1877,7 @@ expose_callback(FBIO *ifp, int eventPtr)
void
wgl_configureWindow(FBIO *ifp, int width, int height)
wgl_configureWindow(fb *ifp, int width, int height)
{
if (width == WGL(ifp)->win_width &&
height == WGL(ifp)->win_height)
@@ -1905,7 +1905,7 @@ wgl_configureWindow(FBIO *ifp, int width, int height)
* screen if one_y equals -1.
*/
HIDDEN void
backbuffer_to_screen(FBIO *ifp, int one_y)
backbuffer_to_screen(fb *ifp, int one_y)
{
struct wgl_clip *clp;
@@ -2003,7 +2003,7 @@ backbuffer_to_screen(FBIO *ifp, int one_y)
* Return NULL on failure.
*/
HIDDEN PIXELFORMATDESCRIPTOR *
wgl_choose_visual(FBIO *ifp)
wgl_choose_visual(fb *ifp)
{
int iPixelFormat;
PIXELFORMATDESCRIPTOR pfd, *ppfd;
@@ -2052,7 +2052,7 @@ wgl_choose_visual(FBIO *ifp)
int
wgl_refresh(FBIO *ifp,
wgl_refresh(fb *ifp,
int x,
int y,
int w,
@@ -2099,10 +2099,15 @@ wgl_refresh(FBIO *ifp,
/* This is the ONLY thing that we normally "export" */
FBIO wgl_interface =
fb wgl_interface =
{
0, /* magic number slot */
FB_WGL_MAGIC,
wgl_open, /* open device */
wgl_open_existing,
wgl_close_existing,
wgl_get_fbps,
wgl_put_fbps,
wgl_close, /* close device */
wgl_clear, /* clear device */
wgl_read, /* read pixels */
@@ -2118,6 +2123,8 @@ FBIO wgl_interface =
wgl_writerect, /* write rectangle */
fb_sim_bwreadrect,
wgl_bwwriterect, /* write rectangle */
wgl_configureWindow,
wgl_refresh,
wgl_poll, /* process events */
wgl_flush, /* flush output */
wgl_free, /* free resources */
+1 -339
View File
@@ -40,352 +40,16 @@
#include "bio.h"
#include "tcl.h"
#include "bu/cmd.h"
#include "fb_private.h"
#include "fb.h"
#include "bu.h"
/* private headers */
#include "brlcad_version.h"
#define FB_TCL_CKMAG(_ptr, _magic, _str) { \
struct bu_vls _fb_vls = BU_VLS_INIT_ZERO; \
\
if (!(_ptr)) { \
bu_vls_printf(&_fb_vls, "ERROR: null %s ptr, file %s, line %d\n", \
_str, __FILE__, __LINE__); \
Tcl_AppendResult(interp, bu_vls_addr(&_fb_vls), (char *)NULL); \
bu_vls_free(&_fb_vls); \
\
return TCL_ERROR; \
} else if (*((uint32_t *)(_ptr)) != (_magic)) { \
bu_vls_printf(&_fb_vls, "ERROR: bad %s ptr %p, s/b x%x, was x%lx, file %s, line %d\n", \
_str, (void *)_ptr, _magic, (unsigned long)*((uint32_t *)(_ptr)), __FILE__, __LINE__); \
Tcl_AppendResult(interp, bu_vls_addr(&_fb_vls), (char *)NULL); \
bu_vls_free(&_fb_vls); \
\
return TCL_ERROR; \
} \
}
#define FB_TCL_CK_FBIO(_p) FB_TCL_CKMAG(_p, FB_MAGIC, "FBIO")
/* from libfb/fb_obj.c */
extern int Fbo_Init(Tcl_Interp *interp);
/* XXX -- At some point these routines should be moved to FBIO */
#ifdef IF_WGL
extern FBIO wgl_interface;
static const char *wgl_device_name = "/dev/wgl";
extern void wgl_configureWindow(FBIO *ifp, int width, int height);
extern int wgl_open_existing(FBIO *ifp, int argc, const char **argv);
extern int wgl_refresh(FBIO *ifp, int x, int y, int w, int h);
#endif
#ifdef IF_OGL
extern FBIO ogl_interface;
static const char *ogl_device_name = "/dev/ogl";
extern void ogl_configureWindow(FBIO *ifp, int width, int height);
extern int ogl_open_existing(FBIO *ifp, int argc, const char **argv);
extern int ogl_refresh(FBIO *ifp, int x, int y, int w, int h);
#endif
#ifdef IF_X
extern FBIO X24_interface;
static const char *X_device_name = "/dev/X";
extern void X24_configureWindow(FBIO *ifp, int width, int height);
extern int X24_open_existing(FBIO *ifp, int argc, const char **argv);
extern int X24_refresh(FBIO *ifp, int x, int y, int w, int h);
#endif
#ifdef IF_TK
extern FBIO tk_interface;
static const char *tk_device_name = "/dev/tk";
#if 0
/*XXX TJM implement this interface */
extern void tk_configureWindow(FBIO *ifp, int width, int height);
extern int tk_open_existing(FBIO *ifp, int argc, const char **argv);
extern int tk_refresh(FBIO *ifp, int x, int y, int w, int h);
#endif
#endif
#ifdef IF_QT
extern FBIO qt_interface;
static const char *qt_device_name = "/dev/Qt";
extern void qt_configureWindow(FBIO *ifp, int width, int height);
#endif
int
#if !defined(IF_X) && !defined(IF_WGL) && !defined(IF_OGL) && !defined(IF_TK)
fb_cmd_open_existing(void *clientData, int argc, const char **UNUSED(argv))
#else
fb_cmd_open_existing(void *clientData, int argc, const char **argv)
#endif
{
Tcl_Interp *interp = (Tcl_Interp *)clientData;
register FBIO *ifp;
struct bu_vls vls = BU_VLS_INIT_ZERO;
int found = 0;
if (argc < 2) {
bu_log("fb_open_existing: wrong number of args\n");
return TCL_ERROR;
}
if ((ifp = (FBIO *)calloc(sizeof(FBIO), 1)) == FBIO_NULL) {
bu_log("fb_open_existing: failed to allocate ifp memory\n");
return TCL_ERROR;
}
#ifdef IF_X
if (BU_STR_EQUIV(argv[1], X_device_name)) {
found=1;
*ifp = X24_interface; /* struct copy */
ifp->if_name = (char *)malloc((unsigned)strlen(X_device_name) + 1);
bu_strlcpy(ifp->if_name, X_device_name, strlen(X_device_name)+1);
/* Mark OK by filling in magic number */
ifp->if_magic = FB_MAGIC;
if ((X24_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
bu_log("fb_open_existing: failed to open X framebuffer\n");
return TCL_ERROR;
}
}
#endif /* IF_X */
#ifdef IF_TK
#if 0
/* XXX TJM implement tk_open_existing */
if (BU_STR_EQUIV(argv[1], tk_device_name)) {
found=1;
*ifp = tk_interface; /* struct copy */
ifp->if_name = malloc((unsigned)strlen(tk_device_name) + 1);
bu_strlcpy(ifp->if_name, tk_device_name, strlen(tk_device_name)+1);
/* Mark OK by filling in magic number */
ifp->if_magic = FB_MAGIC;
if ((tk_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
bu_log("fb_open_existing: failed to open tk framebuffer\n");
return TCL_ERROR;
}
}
#endif
#endif /* IF_TK */
#ifdef IF_WGL
if (BU_STR_EQUIV(argv[1], wgl_device_name)) {
found=1;
*ifp = wgl_interface; /* struct copy */
ifp->if_name = malloc((unsigned)strlen(wgl_device_name) + 1);
bu_strlcpy(ifp->if_name, wgl_device_name, strlen(wgl_device_name)+1);
/* Mark OK by filling in magic number */
ifp->if_magic = FB_MAGIC;
if ((wgl_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
bu_log("fb_open_existing: failed to open wgl framebuffer\n");
return TCL_ERROR;
}
}
#endif /* IF_WGL */
#ifdef IF_OGL
if (BU_STR_EQUIV(argv[1], ogl_device_name)) {
found=1;
*ifp = ogl_interface; /* struct copy */
ifp->if_name = (char *)malloc((unsigned)strlen(ogl_device_name) + 1);
bu_strlcpy(ifp->if_name, ogl_device_name, strlen(ogl_device_name)+1);
/* Mark OK by filling in magic number */
ifp->if_magic = FB_MAGIC;
if ((ogl_open_existing(ifp, argc - 1, argv + 1)) <= -1) {
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
bu_log("fb_open_existing: failed to open ogl framebuffer\n");
return TCL_ERROR;
}
}
#endif /* IF_OGL */
/* FIXME: a printed pointer address string is a blatant security
* and integrity violation worst practice. do not use, do not
* pass go, find a better data-based approach.
*/
if (found) {
bu_vls_printf(&vls, "%p", (void *)ifp);
Tcl_AppendResult(interp, bu_vls_addr(&vls), (char *)NULL);
bu_vls_free(&vls);
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
return TCL_OK;
}
ifp->if_magic = 0; /* sanity */
free((void *) ifp->if_name);
free((void *) ifp);
bu_vls_printf(&vls, "fb_open_existing: supports only the following device types\n");
#ifdef IF_X
bu_vls_strcat(&vls, X_device_name);
bu_vls_strcat(&vls, "\n");
#endif /* IF_X */
#ifdef IF_WGL
bu_vls_strcat(&vls, wgl_device_name);
bu_vls_strcat(&vls, "\n");
#endif /* IF_WGL */
#ifdef IF_OGL
bu_vls_strcat(&vls, ogl_device_name);
bu_vls_strcat(&vls, "\n");
#endif /* IF_OGL */
#ifdef IF_TK
bu_vls_strcat(&vls, tk_device_name);
bu_vls_strcat(&vls, "\n");
#endif /* IF_TK */
Tcl_AppendResult(interp, bu_vls_addr(&vls), (char *)NULL);
bu_vls_free(&vls);
return TCL_ERROR;
}
int
fb_cmd_close_existing(ClientData UNUSED(clientData), int argc, const char **argv)
{
FBIO *ifp;
if (argc != 2) {
/* XXX need help message */
return TCL_ERROR;
}
if (sscanf(argv[1], "%lu", (unsigned long *)&ifp) != 1) {
bu_log("fb_close_existing: failed to provide ifp\n");
return TCL_ERROR;
}
/* FB_TCL_CK_FBIO(ifp); */
return fb_close_existing(ifp);
}
void
fb_configureWindow(FBIO *ifp, int width, int height)
{
/* unknown/unset framebuffer */
if (!ifp || !ifp->if_name || width < 0 || height < 0) {
return;
}
#ifdef IF_X
if (!bu_strncmp(ifp->if_name, X_device_name, strlen(X_device_name))) {
X24_configureWindow(ifp, width, height);
}
#endif /* IF_X */
#ifdef IF_WGL
if (!bu_strncmp(ifp->if_name, wgl_device_name, strlen(wgl_device_name))) {
wgl_configureWindow(ifp, width, height);
}
#endif /* IF_WGL */
#ifdef IF_OGL
if (!bu_strncmp(ifp->if_name, ogl_device_name, strlen(ogl_device_name))) {
ogl_configureWindow(ifp, width, height);
}
#endif /* IF_OGL */
#ifdef IF_TK
#if 0
/* XXX TJM implement tk_configureWindow */
if (!bu_strncmp(ifp->if_name, tk_device_name, strlen(tk_device_name))) {
tk_configureWindow(ifp, width, height);
}
#endif
#endif /* IF_TK */
#ifdef IF_QT
if (!bu_strncmp(ifp->if_name, qt_device_name, strlen(qt_device_name))) {
qt_configureWindow(ifp, width, height);
}
#endif
}
int
fb_refresh(FBIO *ifp, int x, int y, int w, int h)
{
int status=0;
/* what does negative mean? */
if (x < 0)
x = 0;
if (y < 0)
y = 0;
if (w < 0)
w = 0;
if (h < 0)
h = 0;
if (w == 0 || h == 0) {
/* nothing to refresh */
return TCL_OK;
}
if (!ifp || !ifp->if_name) {
/* unset/unknown framebuffer */
return TCL_OK;
}
#ifdef IF_X
status = -1;
if (!bu_strncmp(ifp->if_name, X_device_name, strlen(X_device_name))) {
status = X24_refresh(ifp, x, y, w, h);
}
#endif /* IF_X */
#ifdef IF_WGL
status = -1;
if (!bu_strncmp(ifp->if_name, wgl_device_name, strlen(wgl_device_name))) {
status = wgl_refresh(ifp, x, y, w, h);
}
#endif /* IF_WGL */
#ifdef IF_OGL
status = -1;
if (!bu_strncmp(ifp->if_name, ogl_device_name, strlen(ogl_device_name))) {
status = ogl_refresh(ifp, x, y, w, h);
}
#endif /* IF_OGL */
#ifdef IF_TK
#if 0
/* XXX TJM implement tk_refresh */
status = -1;
if (!bu_strncmp(ifp->if_name, tk_device_name, strlen(tk_device_name))) {
status = tk_refresh(ifp, x, y, w, h);
}
#endif
#endif /* IF_TK */
if (status < 0) {
return TCL_ERROR;
}
return TCL_OK;
}
/**
* Hook function wrapper to the fb_common_file_size Tcl command
*/
@@ -450,8 +114,6 @@ int
Fb_Init(Tcl_Interp *interp)
{
static struct bu_cmdtab cmdtab[] = {
{"fb_open_existing", fb_cmd_open_existing},
{"fb_close_existing", fb_cmd_close_existing},
{"fb_common_file_size", fb_cmd_common_file_size},
{(const char *)NULL, BU_CMD_NULL}
};
+7 -7
View File
@@ -42,7 +42,7 @@ ged_arb(struct ged *gedp, int argc, const char *argv[])
struct rt_db_internal internal;
struct rt_arb_internal *arb;
int i, j;
double rota, fb;
double rota, fb_a;
vect_t norm1, norm2, norm3;
static const char *usage = "name rot fb";
@@ -73,13 +73,13 @@ ged_arb(struct ged *gedp, int argc, const char *argv[])
}
/* get fallback angle */
if (sscanf(argv[3], "%lf", &fb) != 1) {
if (sscanf(argv[3], "%lf", &fb_a) != 1) {
bu_vls_printf(gedp->ged_result_str, "%s: bad fallback angle - %s", argv[0], argv[3]);
return GED_ERROR;
}
rota *= DEG2RAD;
fb *= DEG2RAD;
fb_a *= DEG2RAD;
BU_ALLOC(arb, struct rt_arb_internal);
RT_DB_INTERNAL_INIT(&internal);
@@ -97,10 +97,10 @@ ged_arb(struct ged *gedp, int argc, const char *argv[])
*/
VSET(arb->pt[0], 0.0, 0.0, 0.0);
/* calculate normal vector defined by rot, fb */
norm1[0] = cos(fb) * cos(rota);
norm1[1] = cos(fb) * sin(rota);
norm1[2] = sin(fb);
/* calculate normal vector defined by rot, fb_a */
norm1[0] = cos(fb_a) * cos(rota);
norm1[1] = cos(fb_a) * sin(rota);
norm1[2] = sin(fb_a);
/* find two perpendicular vectors which are perpendicular to norm */
j = 0;
+5 -5
View File
@@ -196,7 +196,7 @@ edarb_edgedir(void *data, int argc, const char *argv[])
int i;
int edge;
vect_t slope;
fastf_t rot, fb;
fastf_t rot, fb_a;
static const char *usage = "arb edge [delta_x delta_y delta_z] | [rot fb]";
/* must be wanting help */
@@ -235,10 +235,10 @@ edarb_edgedir(void *data, int argc, const char *argv[])
*/
if (argc == 6) {
rot = atof(argv[1]) * DEG2RAD;
fb = atof(argv[2]) * DEG2RAD;
slope[0] = cos(fb) * cos(rot);
slope[1] = cos(fb) * sin(rot);
slope[2] = sin(fb);
fb_a = atof(argv[2]) * DEG2RAD;
slope[0] = cos(fb_a) * cos(rot);
slope[1] = cos(fb_a) * sin(rot);
slope[2] = sin(fb_a);
} else {
for (i=0; i<3; i++) {
/* put edge slope in slope[] array */
+5 -5
View File
@@ -123,17 +123,17 @@ get_3pts(struct ged *gedp, fastf_t *plane, const char *argv[], const struct bn_t
static void
get_rotfb(struct ged *gedp, fastf_t *plane, const char *argv[], const struct rt_arb_internal *arb)
{
fastf_t rota, fb;
fastf_t rota, fb_a;
short int i, temp;
point_t pt;
rota= atof(argv[0]) * DEG2RAD;
fb = atof(argv[1]) * DEG2RAD;
fb_a = atof(argv[1]) * DEG2RAD;
/* calculate normal vector (length=1) from rot, fb */
plane[0] = cos(fb) * cos(rota);
plane[1] = cos(fb) * sin(rota);
plane[2] = sin(fb);
plane[0] = cos(fb_a) * cos(rota);
plane[1] = cos(fb_a) * sin(rota);
plane[2] = sin(fb_a);
if (argv[2][0] == 'v') {
/* vertex given */
+1
View File
@@ -24,6 +24,7 @@ set(LIBTCLCAD_SRCS
tkImgFmtPIX.c
cmdhist_obj.c
)
set_property(SOURCE tclcad_obj.c APPEND PROPERTY COMPILE_DEFINITIONS FB_USE_INTERNAL_API)
BRLCAD_ADDLIB(libtclcad "${LIBTCLCAD_SRCS}" "libged;libdm;${TCLCAD_XLIBS}")
SET_TARGET_PROPERTIES(libtclcad PROPERTIES VERSION 20.0.1 SOVERSION 20)
set(tclcad_ignore_files tclcad_private.h)
+81 -134
View File
@@ -62,6 +62,8 @@
#include "ged.h"
#include "dm/dm-Null.h"
#include "fb.h"
#ifdef DM_X
# ifdef WITH_TK
# include "tk.h"
@@ -101,9 +103,11 @@
/* Private headers */
#include "tclcad_private.h"
#include "fb/fb_platform_specific.h"
#include "brlcad_version.h"
#define TO_UNLIMITED -1
/*
@@ -2289,10 +2293,8 @@ to_configure(struct ged *gedp,
status = DM_CONFIGURE_WIN(gdvp->gdv_dmp, 0);
/* configure the framebuffer window */
if (gdvp->gdv_fbs.fbs_fbp != FBIO_NULL)
fb_configureWindow(gdvp->gdv_fbs.fbs_fbp,
gdvp->gdv_dmp->dm_width,
gdvp->gdv_dmp->dm_height);
if (gdvp->gdv_fbs.fbs_fbp != FB_NULL)
(void)fb_configure_window(gdvp->gdv_fbs.fbs_fbp, gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height);
{
char cdimX[32];
@@ -6282,7 +6284,7 @@ to_listen(struct ged *gedp,
return GED_ERROR;
}
if (gdvp->gdv_fbs.fbs_fbp == FBIO_NULL) {
if (gdvp->gdv_fbs.fbs_fbp == FB_NULL) {
bu_vls_printf(gedp->ged_result_str, "%s listen: framebuffer not open!\n", argv[0]);
return GED_ERROR;
}
@@ -10075,7 +10077,7 @@ to_new_view(struct ged *gedp,
new_gdvp->gdv_fbs.fbs_listener.fbsl_fbsp = &new_gdvp->gdv_fbs;
new_gdvp->gdv_fbs.fbs_listener.fbsl_fd = -1;
new_gdvp->gdv_fbs.fbs_listener.fbsl_port = -1;
new_gdvp->gdv_fbs.fbs_fbp = FBIO_NULL;
new_gdvp->gdv_fbs.fbs_fbp = FB_NULL;
new_gdvp->gdv_fbs.fbs_callback = (void (*)(void *clientData))to_fbs_callback;
new_gdvp->gdv_fbs.fbs_clientData = new_gdvp;
new_gdvp->gdv_fbs.fbs_interp = current_top->to_interp;
@@ -13181,12 +13183,12 @@ to_fbs_callback(void *clientData)
HIDDEN int
to_close_fbs(struct ged_dm_view *gdvp)
{
if (gdvp->gdv_fbs.fbs_fbp == FBIO_NULL)
if (gdvp->gdv_fbs.fbs_fbp == FB_NULL)
return TCL_OK;
fb_flush(gdvp->gdv_fbs.fbs_fbp);
fb_close_existing(gdvp->gdv_fbs.fbs_fbp);
gdvp->gdv_fbs.fbs_fbp = FBIO_NULL;
gdvp->gdv_fbs.fbs_fbp = FB_NULL;
return TCL_OK;
}
@@ -13204,154 +13206,85 @@ HIDDEN void to_dm_get_display_image(struct ged *gedp, unsigned char **idata)
HIDDEN int
to_open_fbs(struct ged_dm_view *gdvp, Tcl_Interp *interp)
{
struct fb_platform_specific *fb_ps;
#ifdef DM_X
struct X24_fb_info *xfb_ps;
#endif
#ifdef DM_OGL
struct ogl_fb_info *ofb_ps;
#endif
#ifdef DM_WGL
struct wgl_fb_info *wfb_ps;
#endif
#ifdef DM_QT
struct qt_fb_info *qtfb_ps;
#endif
/* already open */
if (gdvp->gdv_fbs.fbs_fbp != FBIO_NULL)
if (gdvp->gdv_fbs.fbs_fbp != FB_NULL)
return TCL_OK;
/* don't use bu_calloc so we can fail slightly more gracefully */
if ((gdvp->gdv_fbs.fbs_fbp = (FBIO *)calloc(sizeof(FBIO), 1)) == FBIO_NULL) {
Tcl_Obj *obj;
obj = Tcl_GetObjResult(interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
Tcl_AppendStringsToObj(obj, "openfb: failed to allocate framebuffer memory\n",
(char *)NULL);
Tcl_SetObjResult(interp, obj);
return TCL_ERROR;
}
switch (gdvp->gdv_dmp->dm_type) {
#ifdef DM_X
case DM_TYPE_X:
*gdvp->gdv_fbs.fbs_fbp = X24_interface; /* struct copy */
gdvp->gdv_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/X")+1, "if_name");
bu_strlcpy(gdvp->gdv_fbs.fbs_fbp->if_name, "/dev/X", strlen("/dev/X")+1);
/* Mark OK by filling in magic number */
gdvp->gdv_fbs.fbs_fbp->if_magic = FB_MAGIC;
_X24_open_existing(gdvp->gdv_fbs.fbs_fbp,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->pix,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
gdvp->gdv_dmp->dm_width,
gdvp->gdv_dmp->dm_height,
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->gc);
fb_ps = fb_get_platform_specific(FB_X24_MAGIC);
xfb_ps = (struct X24_fb_info *)fb_ps->data;
xfb_ps->dpy = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy;
xfb_ps->win = ((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->pix;
xfb_ps->cwinp = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.priv_vars)->win;
xfb_ps->cmap = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.priv_vars)->cmap;
xfb_ps->vip = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.priv_vars)->vip;
xfb_ps->gc = ((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->gc;
gdvp->gdv_fbs.fbs_fbp = fb_open_existing("X", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);
fb_put_platform_specific(fb_ps);
break;
#endif
#ifdef DM_TK
#if 0
/* XXX TJM implement _tk_open_existing */
case DM_TYPE_TK:
*gdvp->gdv_fbs.fbs_fbp = tk_interface; /* struct copy */
gdvp->gdv_fbs.fbs_fbp->if_name = bu_malloc((unsigned)strlen("/dev/tk")+1, "if_name");
bu_strlcpy(gdvp->gdv_fbs.fbs_fbp->if_name, "/dev/tk", strlen("/dev/tk")+1);
/* Mark OK by filling in magic number */
gdvp->gdv_fbs.fbs_fbp->if_magic = FB_MAGIC;
_tk_open_existing(gdvp->gdv_fbs.fbs_fbp,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->pix,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
gdvp->gdv_dmp->dm_width,
gdvp->gdv_dmp->dm_height,
((struct x_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->gc);
break;
#endif
#endif
#ifdef DM_OGL
case DM_TYPE_OGL:
*gdvp->gdv_fbs.fbs_fbp = ogl_interface; /* struct copy */
gdvp->gdv_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/ogl")+1, "if_name");
bu_strlcpy(gdvp->gdv_fbs.fbs_fbp->if_name, "/dev/ogl", strlen("/dev/ogl")+1);
/* Mark OK by filling in magic number */
gdvp->gdv_fbs.fbs_fbp->if_magic = FB_MAGIC;
_ogl_open_existing(gdvp->gdv_fbs.fbs_fbp,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
gdvp->gdv_dmp->dm_width,
gdvp->gdv_dmp->dm_height,
((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc,
((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
0);
fb_ps = fb_get_platform_specific(FB_OGL_MAGIC);
ofb_ps = (struct ogl_fb_info *)fb_ps->data;
ofb_ps->dpy = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy;
ofb_ps->win = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win;
ofb_ps->cmap = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap;
ofb_ps->vip = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip;
ofb_ps->glxc = ((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc;
ofb_ps->double_buffer = ((struct ogl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer;
ofb_ps->soft_cmap = 0;
gdvp->gdv_fbs.fbs_fbp = fb_open_existing("ogl", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);
fb_put_platform_specific(fb_ps);
break;
#endif
#ifdef DM_OSG
case DM_TYPE_OSG:
#if 0
*gdvp->gdv_fbs.fbs_fbp = osg_interface; /* struct copy */
gdvp->gdv_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/osg")+1, "if_name");
bu_strlcpy(gdvp->gdv_fbs.fbs_fbp->if_name, "/dev/osg", strlen("/dev/osg")+1);
/* Mark OK by filling in magic number */
gdvp->gdv_fbs.fbs_fbp->if_magic = FB_MAGIC;
_osg_open_existing(gdvp->gdv_fbs.fbs_fbp,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
gdvp->gdv_dmp->dm_width,
gdvp->gdv_dmp->dm_height,
((struct osg_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->viewer,
((struct osg_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
0);
#endif
break;
#endif
#ifdef DM_WGL
case DM_TYPE_WGL:
*gdvp->gdv_fbs.fbs_fbp = wgl_interface; /* struct copy */
gdvp->gdv_fbs.fbs_fbp->if_name = bu_malloc((unsigned)strlen("/dev/wgl")+1, "if_name");
bu_strlcpy(gdvp->gdv_fbs.fbs_fbp->if_name, "/dev/wgl", strlen("/dev/wgl")+1);
/* Mark OK by filling in magic number */
gdvp->gdv_fbs.fbs_fbp->if_magic = FB_MAGIC;
_wgl_open_existing(gdvp->gdv_fbs.fbs_fbp,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip,
((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->hdc,
gdvp->gdv_dmp->dm_width,
gdvp->gdv_dmp->dm_height,
((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc,
((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer,
0);
fb_ps = fb_get_platform_specific(FB_WGL_MAGIC);
wfb_ps = (struct wgl_fb_info *)fb_ps->data;
wfb_ps->dpy = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->dpy;
wfb_ps->win = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->win;
wfb_ps->cmap = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->cmap;
wfb_ps->vip = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->vip;
wfb_ps->hdc = ((struct dm_xvars *)gdvp->gdv_dmp->dm_vars.pub_vars)->hdc;
wfb_ps->glxc = ((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->glxc;
wfb_ps->double_buffer = ((struct wgl_vars *)gdvp->gdv_dmp->dm_vars.priv_vars)->mvars.doublebuffer
wfb_ps->soft_cmap = 0;
gdvp->gdv_fbs.fbs_fbp = fb_open_existing("wgl", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);
fb_put_platform_specific(fb_ps);
break;
#endif
#ifdef DM_QT
case DM_TYPE_QT:
*gdvp->gdv_fbs.fbs_fbp = qt_interface; /* struct copy */
gdvp->gdv_fbs.fbs_fbp->if_name = (char *)bu_malloc((unsigned)strlen("/dev/Qt")+1, "if_name");
bu_strlcpy(gdvp->gdv_fbs.fbs_fbp->if_name, "/dev/Qt", strlen("/dev/Qt")+1);
/* Mark OK by filling in magic number */
gdvp->gdv_fbs.fbs_fbp->if_magic = FB_MAGIC;
fb_ps = fb_get_platform_specific(FB_QT_MAGIC);
qtfb_ps = (struct wgl_fb_info *)fb_ps->data;
qtfb_ps->qapp = NULL;
qtfb_ps->qwin = NULL;
qtfb_ps->qpainter = NULL;
qtfb_ps->draw = NULL;
qtfb_ps->qimg = NULL;
/*gdvp->gdv_fbs.fbs_fbp = fb_open_existing("Qt", gdvp->gdv_dmp->dm_width, gdvp->gdv_dmp->dm_height, fb_ps);*/
fb_put_platform_specific(fb_ps);
gdvp->gdv_dmp->dm_openFb(gdvp->gdv_dmp, gdvp->gdv_fbs.fbs_fbp);
break;
@@ -13360,7 +13293,7 @@ to_open_fbs(struct ged_dm_view *gdvp, Tcl_Interp *interp)
Tcl_Obj *obj;
free((void*)gdvp->gdv_fbs.fbs_fbp);
gdvp->gdv_fbs.fbs_fbp = FBIO_NULL;
gdvp->gdv_fbs.fbs_fbp = FB_NULL;
obj = Tcl_GetObjResult(interp);
if (Tcl_IsShared(obj))
@@ -13374,6 +13307,20 @@ to_open_fbs(struct ged_dm_view *gdvp, Tcl_Interp *interp)
}
}
if ((gdvp->gdv_fbs.fbs_fbp == FB_NULL)) {
Tcl_Obj *obj;
obj = Tcl_GetObjResult(interp);
if (Tcl_IsShared(obj))
obj = Tcl_DuplicateObj(obj);
Tcl_AppendStringsToObj(obj, "openfb: failed to allocate framebuffer memory\n",
(char *)NULL);
Tcl_SetObjResult(interp, obj);
return TCL_ERROR;
}
return TCL_OK;
}

Some files were not shown because too many files have changed in this diff Show More