MCPcopy Create free account
hub / github.com/SimHacker/micropolis / SetRect

Method SetRect

MicropolisCore/src/CellEngine/src/cellengine.cpp:442–484  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

440
441
442void CellEngine::SetRect(
443 long xx,
444 long yy,
445 long ww,
446 long hh)
447{
448 long w2;
449 long h2;
450 long rb;
451 long size;
452
453 idealWidth = ww;
454 idealHeight = hh;
455 ww = (ww + 3) & ~3;
456
457 w2 = backBorder + ww + backBorder;
458 h2 = backBorder + hh + backBorder;
459 rb = (w2 + 3) & (~3);
460 size = (rb * h2);
461
462 if ((backMem == NULL) ||
463 (backSize < size)) {
464
465 if (backMem != NULL) {
466 delete [] backMem;
467 }
468
469 // inflate the size a bit if this isn't the first allocation
470 if (backSize != 0) {
471 size = (12 * size) / 10;
472 }
473
474 backSize = size;
475 backMem = new Byte[size];
476 }
477
478 width = ww;
479 height = hh;
480 backWidth = w2;
481 backHeight = h2;
482 backRowBytes = rb;
483 SetPos(xx, yy);
484}
485
486
487void CellEngine::SetPos(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected