MCPcopy Create free account
hub / github.com/NetHack/NetHack / alloc_bits

Function alloc_bits

outdated/sys/mac/mactty.c:360–395  ·  view source on GitHub ↗

* Allocate memory for the bitmap holding the tty window */

Source from the content-addressed store, hash-verified

358 * Allocate memory for the bitmap holding the tty window
359 */
360static short
361alloc_bits(tty_record *record)
362{
363 short s_err;
364
365 SetRect(&record->its_bits.bounds, 0, 0,
366 record->char_width * record->x_size,
367 record->row_height * record->y_size);
368
369 /*
370 * Clear two highest and lowest bit - not a color pixMap, and even in size
371 */
372 record->its_bits.rowBytes =
373 ((record->its_bits.bounds.right + 15) >> 3) & 0x1ffe;
374
375 if (record->uses_gworld) {
376 s_err = allocate_offscreen_world(record);
377#if !TARGET_API_MAC_CARBON
378 } else {
379 s_err = alloc_ptr((void **) &(record->its_bits.baseAddr),
380 record->its_bits.rowBytes
381 * record->its_bits.bounds.bottom);
382 if (!s_err) {
383 s_err = alloc_ptr((void **) &(record->offscreen_port),
384 sizeof(GrafPort));
385 }
386 if (!s_err) {
387 OpenPort(record->offscreen_port);
388 SetPort(record->offscreen_port);
389 ClipRect(&(record->its_bits.bounds));
390 SetPortBits(&(record->its_bits));
391 }
392#endif
393 }
394 return s_err;
395}
396
397/*
398 * Save the current port/world in a safe place for later retrieval

Callers 1

Calls 2

allocate_offscreen_worldFunction · 0.85
alloc_ptrFunction · 0.85

Tested by

no test coverage detected