aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/gfx/drivers/null_driver.c
blob: e6821f56ef3d113d712b6900edd4ff4bce993e1c (plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
/***************************************************************************
 null_driver.c Copyright (C) 2000 Christoph Reichenbach


 This program may be modified and copied freely according to the terms of
 the GNU general public license (GPL), as long as the above copyright
 notice and the licensing information contained herein are preserved.

 Please refer to www.gnu.org for licensing details.

 This work is provided AS IS, without warranty of any kind, expressed or
 implied, including but not limited to the warranties of merchantibility,
 noninfringement, and fitness for a specific purpose. The author will not
 be held liable for any damage caused by this work or derivatives of it.

 By using this source code, you agree to the licensing terms as stated
 above.


 Please contact the maintainer for bug reports or inquiries.

 Current Maintainer:

    Christoph Reichenbach (CR) <jameson@linuxgames.com>

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

#include <gfx_driver.h>
#include <gfx_tools.h>

static int debug_sleep = 0;
static int debug_draw = 0;

static int
null_set_parameter(struct _gfx_driver *drv, char *attribute, char *value)
{
	printf("[GFX-NULL] Setting '%s' <- '%s'\n", attribute, value);

	return GFX_OK;
}



static int
null_init_specific(struct _gfx_driver *drv, int xfact, int yfact, int bytespp)
{
	printf("[GFX-NULL] Initializing specific: %dx%d, %d bytespp\n",
		  xfact, yfact, bytespp);

	drv->mode = gfx_new_mode(xfact, yfact, bytespp,
				 0, 0, 0, 0,
				 0, 0, 0, 0, 0, 0);

	return GFX_OK;
}


static int
null_init(struct _gfx_driver *drv)
{
	printf("[GFX-NULL] Initializing default\n");
	return null_init_specific(drv, 1, 1, 1);
}

static void
null_exit(struct _gfx_driver *drv)
{
	printf("[GFX-NULL] Exitting\n");
}


  /*** Drawing operations ***/

static int
null_draw_line(struct _gfx_driver *drv, point_t start, point_t end,
	       gfx_color_t color,
               gfx_line_mode_t line_mode, gfx_line_style_t line_style)
{
	if (debug_draw)
		printf("[GFX-NULL] Line (%d,%d) -- (%d,%d)\n",
		       GFX_PRINT_POINT(start),
		       GFX_PRINT_POINT(end));
	return GFX_OK;
}

static int
null_draw_filled_rect(struct _gfx_driver *drv, rect_t rect,
                      gfx_color_t color1, gfx_color_t color2,
                      gfx_rectangle_fill_t shade_mode)
{
	if (debug_draw)
	    printf("[GFX-NULL] Box (%d,%d)d(%d,%d)\n",
		   GFX_PRINT_RECT(rect));
	return GFX_OK;
}


  /*** Pixmap operations ***/

static int
null_register_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm)
{
	return GFX_OK;
}

static int
null_unregister_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm)
{
	return GFX_OK;
}

static int
null_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority,
                 rect_t src, rect_t dest, gfx_buffer_t buffer)
{
	return GFX_OK;
}

static int
null_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm,
                 gfx_map_mask_t map)
{
	return GFX_OK;
	pxm->xl = src.xl;
	pxm->yl = src.yl;
}


  /*** Buffer operations ***/

static int
null_update(struct _gfx_driver *drv, rect_t src, point_t dest, gfx_buffer_t buffer)
{
	return GFX_OK;
}

static int
null_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority)
{
	return GFX_OK;
}


  /*** Mouse pointer operations ***/


static int
null_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer)
{
	return GFX_OK;
}


  /*** Palette operations ***/

static int
null_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue)
{
	return GFX_OK;
}


  /*** Event management ***/

static sci_event_t
null_get_event(struct _gfx_driver *drv)
{
	sci_event_t input;

	input.type = SCI_EVT_NONE;

	return input;
}


static int
null_usec_sleep(struct _gfx_driver *drv, long usecs)
{
	if (debug_sleep)
		sciprintf("[GFX-NULL] Sleeping %ld usecs...\n", usecs);
	return GFX_OK;
}

gfx_driver_t
gfx_driver_null = {
	"null",
	"0.1",
	SCI_GFX_DRIVER_MAGIC,
	SCI_GFX_DRIVER_VERSION,
	NULL,
	0, 0,
	GFX_CAPABILITY_WINDOWED,
	GFX_DEBUG_POINTER | GFX_DEBUG_UPDATES | GFX_DEBUG_PIXMAPS | GFX_DEBUG_BASIC,
	null_set_parameter,
	null_init_specific,
	null_init,
	null_exit,
	null_draw_line,
	null_draw_filled_rect,
	null_register_pixmap,
	null_unregister_pixmap,
	null_draw_pixmap,
	null_grab_pixmap,
	null_update,
	null_set_static_buffer,
	null_set_pointer,
	null_set_palette,
	null_get_event,
	null_usec_sleep,
	NULL
};