Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
20 | pmbaty | 1 | #include "pmdsptch.h" |
2 | |||
3 | #include "CORE/FW/devsetup.h" |
||
4 | #include "CORE/FW/scratch.h" |
||
5 | #include "CORE/PIXELMAP/fontptrs.h" |
||
6 | #include "CORE/PIXELMAP/gencopy.h" |
||
7 | #include "CORE/PIXELMAP/pmmem.h" |
||
8 | #include "CORE/STD/brstdlib.h" |
||
9 | #include "harness/hooks.h" |
||
10 | #include "harness/trace.h" |
||
11 | #include <stdarg.h> |
||
12 | #include <stdlib.h> |
||
13 | #include <string.h> |
||
14 | |||
15 | // IDA: br_pixelmap* __cdecl BrPixelmapAllocateSub(br_pixelmap *src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) |
||
16 | br_pixelmap* BrPixelmapAllocateSub(br_pixelmap* src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) { |
||
17 | br_pixelmap* new; |
||
18 | br_rectangle r; |
||
19 | LOG_TRACE("(%p, %d, %d, %d, %d)", src, x, y, w, h); |
||
20 | |||
21 | r.h = h; |
||
22 | r.w = w; |
||
23 | r.x = x; |
||
24 | r.y = y; |
||
25 | CheckDispatch((br_device_pixelmap*)src); |
||
26 | if (((br_device_pixelmap*)src)->dispatch->_allocateSub((br_device_pixelmap*)src, (br_device_pixelmap**)&new, &r) != 0) { |
||
27 | return NULL; |
||
28 | } |
||
29 | return new; |
||
30 | } |
||
31 | |||
32 | // IDA: void __cdecl BrPixelmapFree(br_pixelmap *src) |
||
33 | void BrPixelmapFree(br_pixelmap* src) { |
||
34 | LOG_TRACE10("(%p)", src); |
||
35 | |||
36 | CheckDispatch((br_device_pixelmap*)src); |
||
37 | if (BrDevLastBeginQuery() == src) { |
||
38 | BrDevLastBeginSet(NULL); |
||
39 | } |
||
40 | ((br_device_pixelmap*)src)->dispatch->_free((br_object*)src); |
||
41 | } |
||
42 | |||
43 | // IDA: br_pixelmap* __cdecl BrPixelmapResize(br_pixelmap *src, br_int_32 width, br_int_32 height) |
||
44 | br_pixelmap* BrPixelmapResize(br_pixelmap* src, br_int_32 width, br_int_32 height) { |
||
45 | LOG_TRACE("(%p, %d, %d)", src, width, height); |
||
46 | NOT_IMPLEMENTED(); |
||
47 | } |
||
48 | |||
49 | // IDA: br_pixelmap* __cdecl BrPixelmapMatch(br_pixelmap *src, br_uint_8 match_type) |
||
50 | br_pixelmap* BrPixelmapMatch(br_pixelmap* src, br_uint_8 match_type) { |
||
51 | br_pixelmap* new; |
||
52 | br_token_value tv[3]; |
||
53 | new = NULL; |
||
54 | LOG_TRACE("(%p, %d)", src, match_type); |
||
55 | |||
56 | CheckDispatch((br_device_pixelmap*)src); |
||
57 | |||
58 | switch (match_type) { |
||
59 | case 0u: |
||
60 | tv[1].t = BRT_OFFSCREEN; |
||
61 | break; |
||
62 | case 1u: |
||
63 | tv[2].t = BRT_VECTOR2_INTEGER; |
||
64 | tv[1].t = BRT_DEPTH; |
||
65 | tv[1].v.u32 = 76; |
||
66 | break; |
||
67 | default: |
||
68 | LOG_PANIC("Case %d not implemented", match_type); |
||
69 | } |
||
70 | |||
71 | //((br_device_pixelmap*)src)->dispatch->_match((br_device_pixelmap*)src, (br_device_pixelmap**)&new, &tv[0]); |
||
72 | if (_M_br_device_pixelmap_mem_match((br_device_pixelmap*)src, (br_device_pixelmap**)&new, &tv[0]) != 0) { |
||
73 | LOG_WARN("_M_br_device_pixelmap_mem_match returned error"); |
||
74 | return NULL; |
||
75 | } |
||
76 | return new; |
||
77 | } |
||
78 | |||
79 | // IDA: br_pixelmap* __cdecl BrPixelmapMatchSized(br_pixelmap *src, br_uint_8 match_type, br_int_32 width, br_int_32 height) |
||
80 | br_pixelmap* BrPixelmapMatchSized(br_pixelmap* src, br_uint_8 match_type, br_int_32 width, br_int_32 height) { |
||
81 | //br_pixelmap* new; // Pierre-Marie Baty -- unused variable |
||
82 | //br_token_value tv[5]; // Pierre-Marie Baty -- unused variable |
||
83 | LOG_TRACE("(%p, %d, %d, %d)", src, match_type, width, height); |
||
84 | NOT_IMPLEMENTED(); |
||
85 | } |
||
86 | |||
87 | // IDA: br_pixelmap* __cdecl BrPixelmapMatchTyped(br_pixelmap *src, br_uint_8 match_type, br_uint_8 pixelmap_type) |
||
88 | br_pixelmap* BrPixelmapMatchTyped(br_pixelmap* src, br_uint_8 match_type, br_uint_8 pixelmap_type) { |
||
89 | //br_pixelmap* new; // Pierre-Marie Baty -- unused variable |
||
90 | //br_token_value tv[4]; // Pierre-Marie Baty -- unused variable |
||
91 | LOG_TRACE("(%p, %d, %d)", src, match_type, pixelmap_type); |
||
92 | NOT_IMPLEMENTED(); |
||
93 | } |
||
94 | |||
95 | // IDA: br_pixelmap* __cdecl BrPixelmapMatchTypedSized(br_pixelmap *src, br_uint_8 match_type, br_uint_8 pixelmap_type, br_int_32 width, br_int_32 height) |
||
96 | br_pixelmap* BrPixelmapMatchTypedSized(br_pixelmap* src, br_uint_8 match_type, br_uint_8 pixelmap_type, br_int_32 width, br_int_32 height) { |
||
97 | //br_pixelmap* new; // Pierre-Marie Baty -- unused variable |
||
98 | //br_token_value tv[6]; // Pierre-Marie Baty -- unused variable |
||
99 | LOG_TRACE("(%p, %d, %d, %d, %d)", src, match_type, pixelmap_type, width, height); |
||
100 | NOT_IMPLEMENTED(); |
||
101 | } |
||
102 | |||
103 | // IDA: br_pixelmap* __cdecl BrPixelmapClone(br_pixelmap *src) |
||
104 | br_pixelmap* BrPixelmapClone(br_pixelmap* src) { |
||
105 | //br_pixelmap* new; // Pierre-Marie Baty -- unused variable |
||
106 | //br_token_value tv[2]; // Pierre-Marie Baty -- unused variable |
||
107 | LOG_TRACE("(%p)", src); |
||
108 | NOT_IMPLEMENTED(); |
||
109 | } |
||
110 | |||
111 | // IDA: void __cdecl BrPixelmapFill(br_pixelmap *dst, br_uint_32 colour) |
||
112 | void BrPixelmapFill(br_pixelmap* dst, br_uint_32 colour) { |
||
113 | LOG_TRACE("(%p, %d)", dst, colour); |
||
114 | //br_uint_32 y; // Pierre-Marie Baty -- unused variable |
||
115 | //char* d; // Pierre-Marie Baty -- unused variable |
||
116 | |||
117 | CheckDispatch((br_device_pixelmap*)dst); |
||
118 | (*(br_device_pixelmap_dispatch**)dst)->_fill((br_device_pixelmap*)dst, colour); |
||
119 | } |
||
120 | |||
121 | // IDA: void __cdecl BrPixelmapRectangle(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour) |
||
122 | void BrPixelmapRectangle(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour) { |
||
123 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
124 | LOG_TRACE("(%p, %d, %d, %d, %d, %d)", dst, x, y, w, h, colour); |
||
125 | NOT_IMPLEMENTED(); |
||
126 | } |
||
127 | |||
128 | // IDA: void __cdecl BrPixelmapRectangle2(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour_tl, br_uint_32 colour_br) |
||
129 | void BrPixelmapRectangle2(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour_tl, br_uint_32 colour_br) { |
||
130 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
131 | LOG_TRACE("(%p, %d, %d, %d, %d, %d, %d)", dst, x, y, w, h, colour_tl, colour_br); |
||
132 | NOT_IMPLEMENTED(); |
||
133 | } |
||
134 | |||
135 | // IDA: br_error __usercall DispatchCopy@<EAX>(br_device_pixelmap *self@<EAX>, br_device_pixelmap *src@<EDX>) |
||
136 | br_error DispatchCopy(br_device_pixelmap* self, br_device_pixelmap* src) { |
||
137 | LOG_TRACE("(%p, %p)", self, src); |
||
138 | NOT_IMPLEMENTED(); |
||
139 | } |
||
140 | |||
141 | // IDA: br_error __usercall DispatchRectangleCopy@<EAX>(br_device_pixelmap *self@<EAX>, br_point *p@<EDX>, br_device_pixelmap *src@<EBX>, br_rectangle *r@<ECX>) |
||
142 | br_error DispatchRectangleCopy(br_device_pixelmap* self, br_point* p, br_device_pixelmap* src, br_rectangle* r) { |
||
143 | LOG_TRACE("(%p, %p, %p, %p)", self, p, src, r); |
||
144 | |||
145 | CheckDispatch(self); |
||
146 | CheckDispatch(src); |
||
147 | if ((*(br_device_pixelmap_dispatch**)self)->_device((br_object*)self) == (*(br_device_pixelmap_dispatch**)src)->_device((br_object*)src)) { |
||
148 | return (*(br_device_pixelmap_dispatch**)self)->_rectangleCopy(self, p, src, r); |
||
149 | } |
||
150 | if ((src->pm_flags & BR_PMF_NO_ACCESS) == 0) { |
||
151 | return (*(br_device_pixelmap_dispatch**)self)->_rectangleCopyTo(self, p, src, r); |
||
152 | } |
||
153 | if ((self->pm_flags & BR_PMF_NO_ACCESS) == 0) { |
||
154 | return (*(br_device_pixelmap_dispatch**)self)->_rectangleCopyFrom(src, p, self, r); |
||
155 | } |
||
156 | return GeneralRectangleCopy(self, p, src, r); |
||
157 | } |
||
158 | |||
159 | // IDA: br_error __usercall DispatchRectangleStretchCopy@<EAX>(br_device_pixelmap *self@<EAX>, br_rectangle *r@<EDX>, br_device_pixelmap *src@<EBX>, br_rectangle *s@<ECX>) |
||
160 | br_error DispatchRectangleStretchCopy(br_device_pixelmap* self, br_rectangle* r, br_device_pixelmap* src, br_rectangle* s) { |
||
161 | LOG_TRACE("(%p, %p, %p, %p)", self, r, src, s); |
||
162 | NOT_IMPLEMENTED(); |
||
163 | } |
||
164 | |||
165 | // IDA: void __cdecl BrPixelmapRectangleCopy(br_pixelmap *dst, br_int_32 dx, br_int_32 dy, br_pixelmap *src, br_int_32 sx, br_int_32 sy, br_int_32 w, br_int_32 h) |
||
166 | void BrPixelmapRectangleCopy(br_pixelmap* dst, br_int_32 dx, br_int_32 dy, br_pixelmap* src, br_int_32 sx, br_int_32 sy, br_int_32 w, br_int_32 h) { |
||
167 | br_rectangle r; |
||
168 | br_point p; |
||
169 | |||
170 | r.x = sx; |
||
171 | r.y = sy; |
||
172 | r.w = w; |
||
173 | r.h = h; |
||
174 | p.x = dx; |
||
175 | p.y = dy; |
||
176 | DispatchRectangleCopy((br_device_pixelmap*)dst, &p, (br_device_pixelmap*)src, &r); |
||
177 | } |
||
178 | |||
179 | // IDA: void __cdecl BrPixelmapRectangleStretchCopy(br_pixelmap *dst, br_int_32 dx, br_int_32 dy, br_int_32 dw, br_int_32 dh, br_pixelmap *src, br_int_32 sx, br_int_32 sy, br_int_32 sw, br_int_32 sh) |
||
180 | void BrPixelmapRectangleStretchCopy(br_pixelmap* dst, br_int_32 dx, br_int_32 dy, br_int_32 dw, br_int_32 dh, br_pixelmap* src, br_int_32 sx, br_int_32 sy, br_int_32 sw, br_int_32 sh) { |
||
181 | //br_rectangle s; // Pierre-Marie Baty -- unused variable |
||
182 | //br_rectangle d; // Pierre-Marie Baty -- unused variable |
||
183 | LOG_TRACE("(%p, %d, %d, %d, %d, %p, %d, %d, %d, %d)", dst, dx, dy, dw, dh, src, sx, sy, sw, sh); |
||
184 | NOT_IMPLEMENTED(); |
||
185 | } |
||
186 | |||
187 | // IDA: void __cdecl BrPixelmapRectangleFill(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour) |
||
188 | void BrPixelmapRectangleFill(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour) { |
||
189 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
190 | LOG_TRACE("(%p, %d, %d, %d, %d, %d)", dst, x, y, w, h, colour); |
||
191 | br_uint_8* dst_pix = (br_uint_8*)dst->pixels; |
||
192 | |||
193 | x += dst->origin_x; |
||
194 | y += dst->origin_y; |
||
195 | for (int i = 0; i < w; i++) { |
||
196 | if (x + i < 0 || x + i >= dst->width) { |
||
197 | continue; |
||
198 | } |
||
199 | for (int j = 0; j < h; j++) { |
||
200 | if (y + j < 0 || y + j >= dst->height) { |
||
201 | continue; |
||
202 | } |
||
203 | dst_pix[(y + j) * dst->row_bytes + (x + i)] = colour; |
||
204 | } |
||
205 | } |
||
206 | } |
||
207 | |||
208 | // IDA: void __cdecl BrPixelmapDirtyRectangleCopy(br_pixelmap *dst, br_pixelmap *src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) |
||
209 | void BrPixelmapDirtyRectangleCopy(br_pixelmap* dst, br_pixelmap* src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) { |
||
210 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
211 | //br_point p; // Pierre-Marie Baty -- unused variable |
||
212 | LOG_TRACE("(%p, %p, %d, %d, %d, %d)", dst, src, x, y, w, h); |
||
213 | NOT_IMPLEMENTED(); |
||
214 | } |
||
215 | |||
216 | // IDA: void __cdecl BrPixelmapDirtyRectangleClear(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour) |
||
217 | void BrPixelmapDirtyRectangleClear(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h, br_uint_32 colour) { |
||
218 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
219 | LOG_TRACE("(%p, %d, %d, %d, %d, %d)", dst, x, y, w, h, colour); |
||
220 | NOT_IMPLEMENTED(); |
||
221 | } |
||
222 | |||
223 | // IDA: void __cdecl BrPixelmapDirtyRectangleDoubleBuffer(br_pixelmap *dst, br_pixelmap *src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) |
||
224 | void BrPixelmapDirtyRectangleDoubleBuffer(br_pixelmap* dst, br_pixelmap* src, br_int_32 x, br_int_32 y, br_int_32 w, br_int_32 h) { |
||
225 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
226 | LOG_TRACE("(%p, %p, %d, %d, %d, %d)", dst, src, x, y, w, h); |
||
227 | NOT_IMPLEMENTED(); |
||
228 | } |
||
229 | |||
230 | // IDA: void __cdecl BrPixelmapPixelSet(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_uint_32 colour) |
||
231 | void BrPixelmapPixelSet(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_uint_32 colour) { |
||
232 | br_point p; |
||
233 | // LOG_TRACE("(%p, %d, %d, %d)", dst, x, y, colour); |
||
234 | |||
235 | CheckDispatch((br_device_pixelmap*)dst); |
||
236 | p.x = x; |
||
237 | p.y = y; |
||
238 | (*(br_device_pixelmap_dispatch**)dst)->_pixelSet((br_device_pixelmap*)dst, &p, colour); |
||
239 | } |
||
240 | |||
241 | // IDA: br_uint_32 __cdecl BrPixelmapPixelGet(br_pixelmap *dst, br_int_32 x, br_int_32 y) |
||
242 | br_uint_32 BrPixelmapPixelGet(br_pixelmap* dst, br_int_32 x, br_int_32 y) { |
||
243 | //br_point p; // Pierre-Marie Baty -- unused variable |
||
244 | //br_uint_32 colour; // Pierre-Marie Baty -- unused variable |
||
245 | LOG_TRACE("(%p, %d, %d)", dst, x, y); |
||
246 | NOT_IMPLEMENTED(); |
||
247 | } |
||
248 | |||
249 | // IDA: void __cdecl BrPixelmapCopy(br_pixelmap *dst, br_pixelmap *src) |
||
250 | void BrPixelmapCopy(br_pixelmap* dst, br_pixelmap* src) { |
||
251 | //br_rectangle s; // Pierre-Marie Baty -- unused variable |
||
252 | //br_rectangle d; // Pierre-Marie Baty -- unused variable |
||
253 | LOG_TRACE("(%p, %p)", dst, src); |
||
254 | |||
255 | STUB_ONCE(); // stub because this implementation is improperly (=coordinates can lie outside pixelmap + pixel format size can be > 1 bytes) |
||
256 | |||
257 | for (int y = 0; y < src->height; y++) { |
||
258 | for (int x = 0; x < src->width; x++) { |
||
259 | ((br_uint_8*)dst->pixels)[y * dst->row_bytes + x] = ((br_uint_8*)src->pixels)[y * src->row_bytes + x]; |
||
260 | } |
||
261 | } |
||
262 | } |
||
263 | |||
264 | // IDA: void __cdecl BrPixelmapLine(br_pixelmap *dst, br_int_32 x1, br_int_32 y1, br_int_32 x2, br_int_32 y2, br_uint_32 colour) |
||
265 | void BrPixelmapLine(br_pixelmap* dst, br_int_32 x1, br_int_32 y1, br_int_32 x2, br_int_32 y2, br_uint_32 colour) { |
||
266 | // br_point s; |
||
267 | // br_point e; |
||
268 | LOG_TRACE("(%p, %d, %d, %d, %d, %d)", dst, x1, y1, x2, y2, colour); |
||
269 | |||
270 | STUB_ONCE(); // stub because this implementation is improperly (=coordinates can lie outside pixelmap + pixel format size can be > 1 bytes) |
||
271 | |||
272 | // Thanks Errol! |
||
273 | br_int_16 dx, dy, inx, iny, e; |
||
274 | dx = x2 - x1; |
||
275 | dy = y2 - y1; |
||
276 | inx = dx > 0 ? 1 : -1; |
||
277 | iny = dy > 0 ? 1 : -1; |
||
278 | dx = abs(dx); |
||
279 | dy = abs(dy); |
||
280 | if (dx >= dy) { |
||
281 | dy <<= 1; |
||
282 | e = dy - dx; |
||
283 | dx <<= 1; |
||
284 | while (x1 != x2) { |
||
285 | BrPixelmapPixelSet(dst, x1, y1, colour); |
||
286 | if (e >= 0) { |
||
287 | y1 += iny; |
||
288 | e -= dx; |
||
289 | } |
||
290 | e += dy; |
||
291 | x1 += inx; |
||
292 | } |
||
293 | } else { |
||
294 | dx <<= 1; |
||
295 | e = dx - dy; |
||
296 | dy <<= 1; |
||
297 | while (y1 != y2) { |
||
298 | BrPixelmapPixelSet(dst, x1, y1, colour); |
||
299 | if (e >= 0) { |
||
300 | x1 += inx; |
||
301 | e -= dy; |
||
302 | } |
||
303 | e += dx; |
||
304 | y1 += iny; |
||
305 | } |
||
306 | } |
||
307 | BrPixelmapPixelSet(dst, x1, y1, colour); |
||
308 | } |
||
309 | |||
310 | // IDA: void __cdecl BrPixelmapDoubleBuffer(br_pixelmap *dst, br_pixelmap *src) |
||
311 | void BrPixelmapDoubleBuffer(br_pixelmap* dst, br_pixelmap* src) { |
||
312 | Harness_Hook_BrPixelmapDoubleBuffer(dst, src); |
||
313 | } |
||
314 | |||
315 | // IDA: void __cdecl BrPixelmapText(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_uint_32 colour, br_font *font, char *text) |
||
316 | void BrPixelmapText(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_uint_32 colour, br_font* font, char* text) { |
||
317 | br_point p; |
||
318 | LOG_TRACE("(%p, %d, %d, %d, %p, \"%s\")", dst, x, y, colour, font, text); |
||
319 | |||
320 | CheckDispatch((br_device_pixelmap*)dst); |
||
321 | if (font == NULL) { |
||
322 | font = BrFontFixed3x5; |
||
323 | } |
||
324 | p.x = x; |
||
325 | p.y = y; |
||
326 | if (((br_device_pixelmap *) dst)->dispatch->_text == NULL) { // Pierre-Marie Baty -- consistency check |
||
327 | LOG_PANIC("about to dereference NULL _text() function pointer!"); |
||
328 | } |
||
329 | ((br_device_pixelmap*)dst)->dispatch->_text((br_device_pixelmap*)dst, &p, font, text, colour); |
||
330 | } |
||
331 | |||
332 | // IDA: void __cdecl BrPixelmapTextF(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_uint_32 colour, br_font *font, char *fmt, ...) |
||
333 | void BrPixelmapTextF(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_uint_32 colour, br_font* font, char* fmt, ...) { |
||
334 | char* ss; |
||
335 | br_point p; |
||
336 | va_list args; |
||
337 | LOG_TRACE("(%p, %d, %d, %d, %p, \"%s\")", dst, x, y, colour, font, fmt); |
||
338 | |||
339 | CheckDispatch((br_device_pixelmap*)dst); |
||
340 | ss = BrScratchString(); |
||
341 | if (font == NULL) { |
||
342 | font = BrFontFixed3x5; |
||
343 | } |
||
344 | va_start(args, fmt); |
||
345 | BrVSprintfN(ss, BrScratchStringSize(), fmt, args); |
||
346 | va_end(args); |
||
347 | p.x = x; |
||
348 | p.y = y; |
||
349 | if (((br_device_pixelmap *) dst)->dispatch->_text == NULL) { // Pierre-Marie Baty -- consistency check |
||
350 | LOG_PANIC("about to dereference NULL _text() function pointer!"); |
||
351 | } |
||
352 | (*(br_device_pixelmap_dispatch**)dst)->_text((br_device_pixelmap*)dst, &p, font, ss, colour); |
||
353 | } |
||
354 | |||
355 | // IDA: br_uint_16 __cdecl BrPixelmapTextWidth(br_pixelmap *dst, br_font *font, char *text) |
||
356 | br_uint_16 BrPixelmapTextWidth(br_pixelmap* dst, br_font* font, char* text) { |
||
357 | int i; |
||
358 | int j; |
||
359 | int w; |
||
360 | LOG_TRACE("(%p, %p, \"%s\")", dst, font, text); |
||
361 | |||
362 | if (!text) { |
||
363 | return (font->glyph_x); |
||
364 | } |
||
365 | if (BrStrLen(text) == 0) { |
||
366 | return 0; |
||
367 | } |
||
368 | |||
369 | if (font->flags & BR_FONTF_PROPORTIONAL) { |
||
370 | for (i = 0, w = 0, j = BrStrLen(text); i < j; i++, text++) |
||
371 | w += font->width[*(br_uint_8*)text] + 1; |
||
372 | w -= 1; |
||
373 | return w; |
||
374 | } else |
||
375 | return (br_uint_16) ((font->glyph_x + 1) * BrStrLen(text) - 1); // Pierre-Marie Baty -- added type cast |
||
376 | } |
||
377 | |||
378 | // IDA: br_uint_16 __cdecl BrPixelmapTextHeight(br_pixelmap *dst, br_font *font) |
||
379 | br_uint_16 BrPixelmapTextHeight(br_pixelmap* dst, br_font* font) { |
||
380 | LOG_TRACE("(%p, %p)", dst, font); |
||
381 | NOT_IMPLEMENTED(); |
||
382 | } |
||
383 | |||
384 | // IDA: void __cdecl BrPixelmapCopyBits(br_pixelmap *dst, br_int_32 x, br_int_32 y, br_uint_8 *src, br_int_32 s_stride, br_int_32 start_bit, br_int_32 end_bit, br_int_32 nrows, br_uint_32 colour) |
||
385 | void BrPixelmapCopyBits(br_pixelmap* dst, br_int_32 x, br_int_32 y, br_uint_8* src, br_int_32 s_stride, br_int_32 start_bit, br_int_32 end_bit, br_int_32 nrows, br_uint_32 colour) { |
||
386 | //br_point p; // Pierre-Marie Baty -- unused variable |
||
387 | //br_rectangle r; // Pierre-Marie Baty -- unused variable |
||
388 | LOG_TRACE("(%p, %d, %d, %p, %d, %d, %d, %d, %d)", dst, x, y, src, s_stride, start_bit, end_bit, nrows, colour); |
||
389 | NOT_IMPLEMENTED(); |
||
390 | } |
||
391 | |||
392 | // IDA: br_uint_16 __cdecl BrPixelmapFileSize(br_pixelmap *pm) |
||
393 | br_uint_16 BrPixelmapFileSize(br_pixelmap* pm) { |
||
394 | LOG_TRACE("(%p)", pm); |
||
395 | NOT_IMPLEMENTED(); |
||
396 | } |
||
397 | |||
398 | // IDA: br_uint_16 __cdecl BrPixelmapPixelSize(br_pixelmap *pm) |
||
399 | br_uint_16 BrPixelmapPixelSize(br_pixelmap* pm) { |
||
400 | LOG_TRACE("(%p)", pm); |
||
401 | NOT_IMPLEMENTED(); |
||
402 | } |
||
403 | |||
404 | // IDA: br_uint_16 __cdecl BrPixelmapChannels(br_pixelmap *pm) |
||
405 | br_uint_16 BrPixelmapChannels(br_pixelmap* pm) { |
||
406 | LOG_TRACE("(%p)", pm); |
||
407 | NOT_IMPLEMENTED(); |
||
408 | } |
||
409 | |||
410 | // IDA: void __cdecl BrPixelmapPaletteSet(br_pixelmap *pm, br_pixelmap *pal) |
||
411 | void BrPixelmapPaletteSet(br_pixelmap* pm, br_pixelmap* pal) { |
||
412 | LOG_TRACE("(%p, %p)", pm, pal); |
||
413 | NOT_IMPLEMENTED(); |
||
414 | } |
||
415 | |||
416 | // IDA: void __cdecl BrPixelmapPaletteEntrySet(br_pixelmap *pm, br_int_32 index, br_colour colour) |
||
417 | void BrPixelmapPaletteEntrySet(br_pixelmap* pm, br_int_32 index, br_colour colour) { |
||
418 | //br_device_clut* clut; // Pierre-Marie Baty -- unused variable |
||
419 | LOG_TRACE("(%p, %d, %d)", pm, index, colour); |
||
420 | NOT_IMPLEMENTED(); |
||
421 | } |
||
422 | |||
423 | // IDA: void __cdecl BrPixelmapPaletteEntrySetMany(br_pixelmap *pm, br_int_32 index, br_int_32 ncolours, br_colour *colours) |
||
424 | void BrPixelmapPaletteEntrySetMany(br_pixelmap* pm, br_int_32 index, br_int_32 ncolours, br_colour* colours) { |
||
425 | //br_device_clut* clut; // Pierre-Marie Baty -- unused variable |
||
426 | LOG_TRACE("(%p, %d, %d, %p)", pm, index, ncolours, colours); |
||
427 | NOT_IMPLEMENTED(); |
||
428 | } |
||
429 | |||
430 | // IDA: br_pixelmap* __cdecl BrPixelmapDirectLock(br_pixelmap *src, br_boolean block) |
||
431 | br_pixelmap* BrPixelmapDirectLock(br_pixelmap* src, br_boolean block) { |
||
432 | LOG_TRACE("(%p, %d)", src, block); |
||
433 | |||
434 | CheckDispatch((br_device_pixelmap*)src); |
||
435 | if (((br_device_pixelmap*)(src))->dispatch->_directLock((br_device_pixelmap*)src, block) == 0) { |
||
436 | return src; |
||
437 | } else { |
||
438 | return NULL; |
||
439 | } |
||
440 | } |
||
441 | |||
442 | // IDA: br_pixelmap* __cdecl BrPixelmapDirectUnlock(br_pixelmap *src) |
||
443 | br_pixelmap* BrPixelmapDirectUnlock(br_pixelmap* src) { |
||
444 | LOG_TRACE("(%p)", src); |
||
445 | |||
446 | CheckDispatch((br_device_pixelmap*)src); |
||
447 | if (((br_device_pixelmap*)(src))->dispatch->_directUnlock((br_device_pixelmap*)src) == 0) { |
||
448 | return src; |
||
449 | } else { |
||
450 | return NULL; |
||
451 | } |
||
452 | } |