-
Notifications
You must be signed in to change notification settings - Fork 3
/
backgrd.c
92 lines (85 loc) · 2.35 KB
/
backgrd.c
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
/*
* CFLIB, a GEM library for ATARI/TOS
* Copyright (C) 1999, 2000 Christian Felsch
*
* Modified for FreeMiNT CVS by Frank Naumann <fnaumann@freemint.de>
*
* Please send suggestions, patches or bug reports to me or
* the MiNT mailing list.
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* 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 library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "intern.h"
#include "app.h"
static void cf_background(GRECT *box, MFDB *buffer, _WORD get)
{
MFDB screen;
_WORD xy[8];
GRECT r;
r = *box;
if (rc_intersect(&gl_desk, &r)) /* nur sichtbaren Bereich */
{
screen.fd_addr = NULL; /* Bildschirm */
buffer->fd_w = r.g_w;
buffer->fd_h = r.g_h;
buffer->fd_wdwidth = (r.g_w + 15) >> 4; /* Anzahl in intS */
buffer->fd_stand = FALSE;
buffer->fd_nplanes = gl_planes;
if (get)
buffer->fd_addr = cf_malloc((long)buffer->fd_wdwidth * 2L * r.g_h * gl_planes, "cf_background", FALSE);
if (buffer->fd_addr != NULL)
{
hide_mouse();
if (get)
{
xy[0] = r.g_x;
xy[1] = r.g_y;
xy[2] = r.g_x + r.g_w - 1;
xy[3] = r.g_y + r.g_h - 1;
xy[4] = 0;
xy[5] = 0;
xy[6] = r.g_w - 1;
xy[7] = r.g_h - 1;
vro_cpyfm(cf_vdi_handle, S_ONLY, xy, &screen, buffer);
}
else
{
xy[0] = 0;
xy[1] = 0;
xy[2] = r.g_w - 1;
xy[3] = r.g_h - 1;
xy[4] = r.g_x;
xy[5] = r.g_y;
xy[6] = r.g_x + r.g_w - 1;
xy[7] = r.g_y + r.g_h - 1;
vro_cpyfm(cf_vdi_handle, S_ONLY, xy, buffer, &screen);
free(buffer->fd_addr);
}
show_mouse();
}
else
form_dial_grect(FMD_FINISH, &r, &r);
}
}
void restore_background(GRECT *box, MFDB *buffer)
{
cf_background(box, buffer, FALSE);
}
void save_background(GRECT *box, MFDB *buffer)
{
cf_background(box, buffer, TRUE);
}