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

Method CopyToBack

MicropolisCore/src/CellEngine/src/cellengine.cpp:1179–1358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1177//
1178
1179void CellEngine::CopyToBack()
1180{
1181 long yy;
1182 Byte *f = frontMem;
1183 Byte *p = backMem +
1184 backBorder +
1185 (backBorder * backRowBytes);
1186
1187 switch (wrap) {
1188
1189 case 0:
1190 // no effect, don't change back
1191 break;
1192
1193 case 1:
1194 // copy front to back, no wrap,
1195 // don't change back perimeter
1196 for (yy = 0; yy < height; yy++) {
1197 memcpy(p, f, width);
1198 p += backRowBytes;
1199 f += screenRowBytes;
1200 }
1201 break;
1202
1203 case 2:
1204 // don't copy front to back, just wrap 1 pixel edges
1205 for (yy = 0; yy < height; yy++) {
1206 p[-1] = p[width - 1];
1207 p[width] = p[0];
1208 p += backRowBytes;
1209 f += screenRowBytes;
1210 } // for
1211 f = frontMem;
1212 p = backMem +
1213 backBorder +
1214 (backBorder * backRowBytes);
1215 memcpy(&p[(-1 * backRowBytes) - 1],
1216 &p[((height - 1) * backRowBytes) - 1],
1217 width + 2);
1218 memcpy(&p[(height * backRowBytes) - 1],
1219 &p[-1],
1220 width + 2);
1221 break;
1222
1223 case 3:
1224 // copy front to back, and wrap 1 pixel edges
1225 for (yy = 0; yy < height; yy++) {
1226 memcpy(p, f, width);
1227 p[-1] = p[width - 1];
1228 p[width] = p[0];
1229 p += backRowBytes;
1230 f += screenRowBytes;
1231 } // for
1232 f = frontMem;
1233 p = backMem +
1234 backBorder +
1235 (backBorder * backRowBytes);
1236 memcpy(&p[(-1 * backRowBytes) - 1],

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected