MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / opengl_ChangeChunkedBitmap

Function opengl_ChangeChunkedBitmap

renderer/HardwareOpenGL.cpp:1342–1433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1340chunked_bitmap opengl_Chunked_bitmap;
1341
1342void opengl_ChangeChunkedBitmap(int bm_handle, chunked_bitmap *chunk) {
1343 int bw = bm_w(bm_handle, 0);
1344 int bh = bm_h(bm_handle, 0);
1345
1346 // determine optimal size of the square bitmaps
1347 float fopt = 128.0f;
1348 int iopt;
1349
1350 // find the smallest dimension and base off that
1351 int smallest = std::min(bw, bh);
1352
1353 if (smallest <= 32)
1354 fopt = 32;
1355 else if (smallest <= 64)
1356 fopt = 64;
1357 else
1358 fopt = 128;
1359
1360 iopt = (int)fopt;
1361
1362 // Get how many pieces we need across and down
1363 float temp = bw / fopt;
1364 int how_many_across = temp;
1365 if ((temp - how_many_across) > 0)
1366 how_many_across++;
1367
1368 temp = bh / fopt;
1369 int how_many_down = temp;
1370 if ((temp - how_many_down) > 0)
1371 how_many_down++;
1372
1373 ASSERT(how_many_across > 0);
1374 ASSERT(how_many_down > 0);
1375
1376 // Now go through our big bitmap and partition it into pieces
1377 uint16_t *src_data = bm_data(bm_handle, 0);
1378 uint16_t *sdata;
1379 uint16_t *ddata;
1380
1381 int shift;
1382 switch (iopt) {
1383 case 32:
1384 shift = 5;
1385 break;
1386 case 64:
1387 shift = 6;
1388 break;
1389 case 128:
1390 shift = 7;
1391 break;
1392 default:
1393 Int3(); // Get Jeff
1394 break;
1395 }
1396 int maxx, maxy;
1397 int windex, hindex;
1398 int s_y, s_x, d_y, d_x;
1399

Callers 1

Calls 3

bm_wFunction · 0.85
bm_hFunction · 0.85
bm_dataFunction · 0.85

Tested by

no test coverage detected