File: visual.c

package info (click to toggle)
libggi 1%3A2.2.2-5
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 10,752 kB
  • ctags: 9,218
  • sloc: ansic: 65,689; sh: 9,211; makefile: 1,226; pascal: 183
file content (120 lines) | stat: -rw-r--r-- 3,765 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* $Id: visual.c,v 1.8 2005/07/30 11:40:00 cegger Exp $
******************************************************************************

   Graphics library for GGI.

   Copyright (C) 1995 Andreas Beck     [becka@ggi-project.org]
   Copyright (C) 1997 Jason McMullan   [jmcc@ggi-project.org]

   Permission is hereby granted, free of charge, to any person obtaining a
   copy of this software and associated documentation files (the "Software"),
   to deal in the Software without restriction, including without limitation
   the rights to use, copy, modify, merge, publish, distribute, sublicense,
   and/or sell copies of the Software, and to permit persons to whom the
   Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in
   all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
   THE AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
   IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
   CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

******************************************************************************
*/

#include "lin16lib.h"

static int GGIopen(ggi_visual *vis, struct ggi_dlhandle *dlh,
			const char *args, void *argptr, uint32_t *dlret)
{
	gg_swartype swar;
	/* Frame handling
	 */

	vis->opdraw->setreadframe  = _ggi_default_setreadframe;
	vis->opdraw->setwriteframe = _ggi_default_setwriteframe;
	
	/* Generic drawing
	 */
	if (vis->needidleaccel) {
		vis->opdraw->drawpixel_nc	= GGI_lin16_drawpixel_nca;
		vis->opdraw->drawpixel		= GGI_lin16_drawpixela;
		vis->opdraw->putpixel_nc	= GGI_lin16_putpixel_nca;
		vis->opdraw->putpixel		= GGI_lin16_putpixela;
		vis->opdraw->getpixel		= GGI_lin16_getpixela;
	} else {
		vis->opdraw->drawpixel_nc	= GGI_lin16_drawpixel_nc;
		vis->opdraw->drawpixel		= GGI_lin16_drawpixel;
		vis->opdraw->putpixel_nc	= GGI_lin16_putpixel_nc;
		vis->opdraw->putpixel		= GGI_lin16_putpixel;
		vis->opdraw->getpixel		= GGI_lin16_getpixel;
	}

	vis->opdraw->drawhline		= GGI_lin16_drawhline;
	vis->opdraw->drawhline_nc	= GGI_lin16_drawhline_nc;
	vis->opdraw->puthline		= GGI_lin16_puthline;
	vis->opdraw->gethline		= GGI_lin16_gethline;

	vis->opdraw->drawvline		= GGI_lin16_drawvline;
	vis->opdraw->drawvline_nc	= GGI_lin16_drawvline_nc;
	vis->opdraw->putvline		= GGI_lin16_putvline;
	vis->opdraw->getvline		= GGI_lin16_getvline;

	vis->opdraw->drawline		= GGI_lin16_drawline;

	vis->opdraw->drawbox		= GGI_lin16_drawbox;
	vis->opdraw->putbox		= GGI_lin16_putbox;
	vis->opdraw->copybox		= GGI_lin16_copybox;

	swar = _ggiGetSwarType();

	vis->opdraw->crossblit		= NULL;

#ifdef DO_SWAR_NONE
	if (swar & GG_SWAR_NONE) 
		vis->opdraw->crossblit	= GGI_lin16_crossblit;
#endif
#ifdef DO_SWAR_64BITC
	if (swar & GG_SWAR_64BITC)
		vis->opdraw->crossblit	= GGI_lin16_crossblit_64bitc;
#endif
#ifdef DO_SWAR_MMX
	if (swar & GG_SWAR_MMX) 
		vis->opdraw->crossblit	= GGI_lin16_crossblit_mmx;
#endif

	if (vis->opdraw->crossblit == NULL) {
		fprintf(stderr, "linear_16: No acceptible SWAR.  Aborting.\n");
		return GGI_ENOFUNC;
	}

	*dlret = GGI_DL_OPDRAW;
	return 0;
}


EXPORTFUNC
int GGIdl_linear_16(int func, void **funcptr);

int GGIdl_linear_16(int func, void **funcptr)
{
	switch (func) {
	case GGIFUNC_open:
		*funcptr = (void *)GGIopen;
		return 0;
	case GGIFUNC_exit:
	case GGIFUNC_close:
		*funcptr = NULL;
		return 0;
	default:
		*funcptr = NULL;
	}

	return GGI_ENOTFOUND;
}
		
#include <ggi/internal/ggidlinit.h>