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
|
/* ScummVM - Scumm Interpreter
* Copyright (C) 2001 Ludvig Strigeus
* Copyright (C) 2001-2005 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Header$
*
*/
#include "common/stdafx.h"
#include "palm.h"
void OSystem_PALMOS::showOverlay() {
// hide the mouse
undraw_mouse();
// save background
byte *src = _offScreenP;
byte *dst = _tmpBackupP;
int h = _screenHeight;
UInt32 offset = 0;
do {
DmWrite(dst, offset, src, _screenWidth);
offset += _screenWidth;
src += _offScreenPitch;
} while (--h);
_overlayVisible = true;
clearOverlay();
}
void OSystem_PALMOS::hideOverlay() {
// hide the mouse
undraw_mouse();
_overlayVisible = false;
copyRectToScreen(_tmpBackupP, _screenWidth, 0, 0, _screenWidth, _screenHeight);
}
void OSystem_PALMOS::clearOverlay() {
if (!_overlayVisible)
return;
// hide the mouse
undraw_mouse();
// restore background
DmWrite(_tmpScreenP, 0, _tmpBackupP, _screenWidth * _screenHeight);
}
void OSystem_PALMOS::grabOverlay(byte *buf, int pitch) {
if (!_overlayVisible)
return;
// hide the mouse
undraw_mouse();
byte *src = _tmpScreenP;
int h = _screenHeight;
do {
memcpy(buf, src, _screenWidth);
src += _screenWidth;
buf += pitch;
} while (--h);
}
void OSystem_PALMOS::copyRectToOverlay(const byte *buf, int pitch, int x, int y, int w, int h) {
if (!_overlayVisible)
return;
if (!_tmpScreenP)
return;
// Clip the coordinates
if (x < 0) {
w += x;
buf -= x;
x = 0;
}
if (y < 0) {
h += y; buf -= y * pitch;
y = 0;
}
if (w > _screenWidth - x)
w = _screenWidth - x;
if (h > _screenHeight - y)
h = _screenHeight - y;
if (w <= 0 || h <= 0)
return;
/* FIXME: undraw mouse only if the draw rect intersects with the mouse rect */
if (_mouseDrawn) {
/* RectangleType mouse = {_mouseCurState.x, _mouseCurState.y, _mouseCurState.w, _mouseCurState.h};
RectangleType copy = {x, y, w, h};
RectangleType result;
RctGetIntersection(&mouse, ©, &result);
if (result.extent.x !=0 && result.extent.y !=0)*/
undraw_mouse();
}
byte *dst = _tmpScreenP;
int offset = y * _screenWidth + x;
do {
DmWrite(dst, offset, buf, w);
offset += _screenWidth;
buf += pitch;
} while (--h);
}
|