97 const void *userdata,
GLushort *newimage);
101 const GLushort *oldimage,
void *userdata);
175 const void *,
void *,
180 const void *,
void *,
209 void (*)(
int,
const void *,
GLfloat []),
210 void (*)(
const GLfloat [],
int,
void *),
214 void (*)(
int,
const void *,
GLfloat []),
215 void (*)(
const GLfloat [],
int,
void *),
219 void (*)(
int,
const void *,
GLfloat []),
220 void (*)(
const GLfloat [],
int,
void *),
294 if (
value == 0)
return -1;
299 if (
value != 1)
return -1;
318 if (
value == 0)
return -1;
323 }
else if (
value == 3) {
331#define __GLU_SWAP_2_BYTES(s)\
332(GLushort)(((GLushort)((const GLubyte*)(s))[1])<<8 | ((const GLubyte*)(s))[0])
334#define __GLU_SWAP_4_BYTES(s)\
335(GLuint)(((GLuint)((const GLubyte*)(s))[3])<<24 | \
336 ((GLuint)((const GLubyte*)(s))[2])<<16 | \
337 ((GLuint)((const GLubyte*)(s))[1])<<8 | ((const GLubyte*)(s))[0])
343 int newwidth, newheight;
348 newwidth =
width / 2;
355 for (
i = 0;
i < newheight;
i++) {
356 for (
j = 0;
j < newwidth;
j++) {
373 int newwidth, newheight;
382 element_size,ysize,group_size);
386 newwidth =
width / 2;
388 padBytes = ysize - (
width*group_size);
390 t = (
const char *)datain;
393 for (
i = 0;
i < newheight;
i++) {
394 for (
j = 0;
j < newwidth;
j++) {
399 *(
const GLubyte*)(
t+ysize+group_size) + 2) / 4;
400 s++;
t += element_size;
417 const char *
src= (
const char *) dataIn;
428 for (jj= 0; jj< halfWidth; jj++) {
440 int padBytes= ysize - (
width*group_size);
444 else if (
width == 1) {
445 int padBytes= ysize - (
width * group_size);
451 for (jj= 0; jj< halfHeight; jj++) {
466 [
components * element_size * halfWidth * halfHeight]);
475 int newwidth, newheight;
484 element_size,ysize,group_size);
488 newwidth =
width / 2;
490 padBytes = ysize - (
width*group_size);
492 t = (
const char *)datain;
495 for (
i = 0;
i < newheight;
i++) {
496 for (
j = 0;
j < newwidth;
j++) {
499 *(
const GLbyte*)(
t+group_size) +
501 *(
const GLbyte*)(
t+ysize+group_size) + 2) / 4;
502 s++;
t += element_size;
517 const char *
src= (
const char *) dataIn;
528 for (jj= 0; jj< halfWidth; jj++) {
539 int padBytes= ysize - (
width*group_size);
543 else if (
width == 1) {
544 int padBytes= ysize - (
width * group_size);
550 for (jj= 0; jj< halfHeight; jj++) {
566 [
components * element_size * halfWidth * halfHeight]);
575 int newwidth, newheight;
584 element_size,ysize,group_size, myswap_bytes);
588 newwidth =
width / 2;
590 padBytes = ysize - (
width*group_size);
592 t = (
const char *)datain;
596 for (
i = 0;
i < newheight;
i++) {
597 for (
j = 0;
j < newwidth;
j++) {
602 *(
const GLushort*)(
t+ysize+group_size) + 2) / 4;
603 s++;
t += element_size;
611 for (
i = 0;
i < newheight;
i++) {
612 for (
j = 0;
j < newwidth;
j++) {
618 s++;
t += element_size;
634 const char *
src= (
const char *) dataIn;
645 for (jj= 0; jj< halfWidth; jj++) {
666 int padBytes= ysize - (
width*group_size);
670 else if (
width == 1) {
671 int padBytes= ysize - (
width * group_size);
677 for (jj= 0; jj< halfHeight; jj++) {
703 [
components * element_size * halfWidth * halfHeight]);
714 int newwidth, newheight;
723 element_size,ysize,group_size, myswap_bytes);
727 newwidth =
width / 2;
729 padBytes = ysize - (
width*group_size);
731 t = (
const char *)datain;
735 for (
i = 0;
i < newheight;
i++) {
736 for (
j = 0;
j < newwidth;
j++) {
741 *(
const GLshort*)(
t+ysize+group_size) + 2) / 4;
742 s++;
t += element_size;
750 for (
i = 0;
i < newheight;
i++) {
751 for (
j = 0;
j < newwidth;
j++) {
764 s++;
t += element_size;
780 const char *
src= (
const char *) dataIn;
791 for (jj= 0; jj< halfWidth; jj++) {
805 *
dest= (sshort[0] + sshort[1]) / 2;
812 int padBytes= ysize - (
width*group_size);
816 else if (
width == 1) {
817 int padBytes= ysize - (
width * group_size);
823 for (jj= 0; jj< halfHeight; jj++) {
836 *
dest= (sshort[0] + sshort[1]) / 2;
849 [
components * element_size * halfWidth * halfHeight]);
860 int newwidth, newheight;
869 element_size,ysize,group_size, myswap_bytes);
873 newwidth =
width / 2;
875 padBytes = ysize - (
width*group_size);
877 t = (
const char *)datain;
881 for (
i = 0;
i < newheight;
i++) {
882 for (
j = 0;
j < newwidth;
j++) {
887 (
double)*(
const GLuint*)(
t+ysize) +
889 s++;
t += element_size;
898 for (
i = 0;
i < newheight;
i++) {
899 for (
j = 0;
j < newwidth;
j++) {
909 s++;
t += element_size;
926 const char *
src= (
const char *) dataIn;
937 for (jj= 0; jj< halfWidth; jj++) {
958 int padBytes= ysize - (
width*group_size);
962 else if (
width == 1) {
963 int padBytes= ysize - (
width * group_size);
969 for (jj= 0; jj< halfHeight; jj++) {
995 [
components * element_size * halfWidth * halfHeight]);
1004 int newwidth, newheight;
1013 element_size,ysize,group_size, myswap_bytes);
1017 newwidth =
width / 2;
1019 padBytes = ysize - (
width*group_size);
1021 t = (
const char *)datain;
1025 for (
i = 0;
i < newheight;
i++) {
1026 for (
j = 0;
j < newwidth;
j++) {
1030 (
float)*(
const GLint*)(
t+ysize) +
1031 (
float)*(
const GLint*)(
t+ysize+group_size))/4 + 0.5;
1032 s++;
t += element_size;
1040 for (
i = 0;
i < newheight;
i++) {
1041 for (
j = 0;
j < newwidth;
j++) {
1055 s++;
t += element_size;
1072 const char *
src= (
const char *) dataIn;
1083 for (jj= 0; jj< halfWidth; jj++) {
1104 int padBytes= ysize - (
width*group_size);
1108 else if (
width == 1) {
1109 int padBytes= ysize - (
width * group_size);
1115 for (jj= 0; jj< halfHeight; jj++) {
1141 [
components * element_size * halfWidth * halfHeight]);
1152 int newwidth, newheight;
1161 element_size,ysize,group_size, myswap_bytes);
1165 newwidth =
width / 2;
1167 padBytes = ysize - (
width*group_size);
1169 t = (
const char *)datain;
1173 for (
i = 0;
i < newheight;
i++) {
1174 for (
j = 0;
j < newwidth;
j++) {
1179 *(
const GLfloat*)(
t+ysize+group_size)) / 4;
1180 s++;
t += element_size;
1188 for (
i = 0;
i < newheight;
i++) {
1189 for (
j = 0;
j < newwidth;
j++) {
1201 s++;
t += element_size;
1218 const char *
src= (
const char *) dataIn;
1229 for (jj= 0; jj< halfWidth; jj++) {
1240 sfloat[1]= *(
const GLfloat*)(
src+group_size);
1243 *
dest= (sfloat[0] + sfloat[1]) / 2.0;
1250 int padBytes= ysize - (
width*group_size);
1254 else if (
width == 1) {
1255 int padBytes= ysize - (
width * group_size);
1261 for (jj= 0; jj< halfHeight; jj++) {
1274 *
dest= (sfloat[0] + sfloat[1]) / 2.0;
1286 [
components * element_size * halfWidth * halfHeight]);
1294 float x, lowx, highx, convx, halfconvx;
1295 float y, lowy, highy, convy, halfconvy;
1296 float xpercent,ypercent;
1301 int i,
j,
k,yint,xint,xindex,yindex;
1304 if (widthin == widthout*2 && heightin == heightout*2) {
1308 convy = (
float) heightin/heightout;
1309 convx = (
float) widthin/widthout;
1310 halfconvx = convx/2;
1311 halfconvy = convy/2;
1312 for (
i = 0;
i < heightout;
i++) {
1313 y = convy * (
i+0.5);
1314 if (heightin > heightout) {
1315 highy =
y + halfconvy;
1316 lowy =
y - halfconvy;
1321 for (
j = 0;
j < widthout;
j++) {
1322 x = convx * (
j+0.5);
1323 if (widthin > widthout) {
1324 highx =
x + halfconvx;
1325 lowx =
x - halfconvx;
1336 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
1342 yindex = (yint + heightin) % heightin;
1343 if (highy < yint+1) {
1344 ypercent = highy -
y;
1346 ypercent = yint+1 -
y;
1353 xindex = (xint + widthin) % widthin;
1354 if (highx < xint+1) {
1355 xpercent = highx -
x;
1357 xpercent = xint+1 -
x;
1360 percent = xpercent * ypercent;
1364 totals[
k] += datain[
temp +
k] * percent;
1399 const char *
temp, *temp0;
1400 const char *temp_index;
1403 int lowx_int, highx_int, lowy_int, highy_int;
1404 float x_percent, y_percent;
1405 float lowx_float, highx_float, lowy_float, highy_float;
1406 float convy_float, convx_float;
1407 int convy_int, convx_int;
1411 if (widthin == widthout*2 && heightin == heightout*2) {
1414 element_size, ysize, group_size);
1417 convy = (
float) heightin/heightout;
1418 convx = (
float) widthin/widthout;
1419 convy_int =
floor(convy);
1420 convy_float = convy - convy_int;
1421 convx_int =
floor(convx);
1422 convx_float = convx - convx_int;
1424 area = convx * convy;
1428 highy_int = convy_int;
1429 highy_float = convy_float;
1431 for (
i = 0;
i < heightout;
i++) {
1433 if (highy_int >= heightin)
1434 highy_int = heightin - 1;
1437 highx_int = convx_int;
1438 highx_float = convx_float;
1440 for (
j = 0;
j < widthout;
j++) {
1447 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
1450 xindex = lowx_int*group_size;
1451 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
1453 y_percent = 1-lowy_float;
1454 temp = (
const char *)datain + xindex + lowy_int * ysize;
1455 percent = y_percent * (1-lowx_float);
1457 k++, temp_index += element_size) {
1458 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1461 for(
l = lowx_int+1;
l < highx_int;
l++) {
1464 k++, temp_index += element_size) {
1465 totals[
k] += (
GLubyte)(*(temp_index)) * y_percent;
1470 percent = y_percent * highx_float;
1472 k++, temp_index += element_size) {
1473 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1477 y_percent = highy_float;
1478 percent = y_percent * (1-lowx_float);
1479 temp = (
const char *)datain + xindex + highy_int * ysize;
1481 k++, temp_index += element_size) {
1482 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1484 for(
l = lowx_int+1;
l < highx_int;
l++) {
1487 k++, temp_index += element_size) {
1488 totals[
k] += (
GLubyte)(*(temp_index)) * y_percent;
1492 percent = y_percent * highx_float;
1494 k++, temp_index += element_size) {
1495 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1500 for(
m = lowy_int+1;
m < highy_int;
m++) {
1504 k++,
left += element_size,
right += element_size) {
1509 }
else if (highy_int > lowy_int) {
1510 x_percent = highx_float - lowx_float;
1511 percent = (1-lowy_float)*x_percent;
1512 temp = (
const char *)datain + xindex + lowy_int*ysize;
1514 k++, temp_index += element_size) {
1515 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1517 for(
m = lowy_int+1;
m < highy_int;
m++) {
1520 k++, temp_index += element_size) {
1521 totals[
k] += (
GLubyte)(*(temp_index)) * x_percent;
1524 percent = x_percent * highy_float;
1527 k++, temp_index += element_size) {
1528 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1530 }
else if (highx_int > lowx_int) {
1531 y_percent = highy_float - lowy_float;
1532 percent = (1-lowx_float)*y_percent;
1533 temp = (
const char *)datain + xindex + lowy_int*ysize;
1535 k++, temp_index += element_size) {
1536 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1538 for (
l = lowx_int+1;
l < highx_int;
l++) {
1541 k++, temp_index += element_size) {
1542 totals[
k] += (
GLubyte)(*(temp_index)) * y_percent;
1546 percent = y_percent * highx_float;
1548 k++, temp_index += element_size) {
1549 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1552 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
1553 temp = (
const char *)datain + xindex + lowy_int * ysize;
1555 k++, temp_index += element_size) {
1556 totals[
k] += (
GLubyte)(*(temp_index)) * percent;
1563 temp0 = (
const char *)datain + xindex + group_size +
1565 for (
m = lowy_int+1;
m < highy_int;
m++) {
1567 for(
l = lowx_int+1;
l < highx_int;
l++) {
1569 k++, temp_index += element_size) {
1570 totals[
k] += (
GLubyte)(*(temp_index));
1579 dataout[outindex +
k] = totals[
k]/
area;
1582 lowx_int = highx_int;
1583 lowx_float = highx_float;
1584 highx_int += convx_int;
1585 highx_float += convx_float;
1586 if(highx_float > 1) {
1591 lowy_int = highy_int;
1592 lowy_float = highy_float;
1593 highy_int += convy_int;
1594 highy_float += convy_float;
1595 if(highy_float > 1) {
1616 const char *
temp, *temp0;
1617 const char *temp_index;
1620 int lowx_int, highx_int, lowy_int, highy_int;
1621 float x_percent, y_percent;
1622 float lowx_float, highx_float, lowy_float, highy_float;
1623 float convy_float, convx_float;
1624 int convy_int, convx_int;
1628 if (widthin == widthout*2 && heightin == heightout*2) {
1631 element_size, ysize, group_size);
1634 convy = (
float) heightin/heightout;
1635 convx = (
float) widthin/widthout;
1636 convy_int =
floor(convy);
1637 convy_float = convy - convy_int;
1638 convx_int =
floor(convx);
1639 convx_float = convx - convx_int;
1641 area = convx * convy;
1645 highy_int = convy_int;
1646 highy_float = convy_float;
1648 for (
i = 0;
i < heightout;
i++) {
1650 if (highy_int >= heightin)
1651 highy_int = heightin - 1;
1654 highx_int = convx_int;
1655 highx_float = convx_float;
1657 for (
j = 0;
j < widthout;
j++) {
1664 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
1667 xindex = lowx_int*group_size;
1668 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
1670 y_percent = 1-lowy_float;
1671 temp = (
const char *)datain + xindex + lowy_int * ysize;
1672 percent = y_percent * (1-lowx_float);
1674 k++, temp_index += element_size) {
1675 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1678 for(
l = lowx_int+1;
l < highx_int;
l++) {
1681 k++, temp_index += element_size) {
1682 totals[
k] += (
GLbyte)(*(temp_index)) * y_percent;
1687 percent = y_percent * highx_float;
1689 k++, temp_index += element_size) {
1690 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1694 y_percent = highy_float;
1695 percent = y_percent * (1-lowx_float);
1696 temp = (
const char *)datain + xindex + highy_int * ysize;
1698 k++, temp_index += element_size) {
1699 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1701 for(
l = lowx_int+1;
l < highx_int;
l++) {
1704 k++, temp_index += element_size) {
1705 totals[
k] += (
GLbyte)(*(temp_index)) * y_percent;
1709 percent = y_percent * highx_float;
1711 k++, temp_index += element_size) {
1712 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1717 for(
m = lowy_int+1;
m < highy_int;
m++) {
1721 k++,
left += element_size,
right += element_size) {
1726 }
else if (highy_int > lowy_int) {
1727 x_percent = highx_float - lowx_float;
1728 percent = (1-lowy_float)*x_percent;
1729 temp = (
const char *)datain + xindex + lowy_int*ysize;
1731 k++, temp_index += element_size) {
1732 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1734 for(
m = lowy_int+1;
m < highy_int;
m++) {
1737 k++, temp_index += element_size) {
1738 totals[
k] += (
GLbyte)(*(temp_index)) * x_percent;
1741 percent = x_percent * highy_float;
1744 k++, temp_index += element_size) {
1745 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1747 }
else if (highx_int > lowx_int) {
1748 y_percent = highy_float - lowy_float;
1749 percent = (1-lowx_float)*y_percent;
1750 temp = (
const char *)datain + xindex + lowy_int*ysize;
1752 k++, temp_index += element_size) {
1753 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1755 for (
l = lowx_int+1;
l < highx_int;
l++) {
1758 k++, temp_index += element_size) {
1759 totals[
k] += (
GLbyte)(*(temp_index)) * y_percent;
1763 percent = y_percent * highx_float;
1765 k++, temp_index += element_size) {
1766 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1769 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
1770 temp = (
const char *)datain + xindex + lowy_int * ysize;
1772 k++, temp_index += element_size) {
1773 totals[
k] += (
GLbyte)(*(temp_index)) * percent;
1780 temp0 = (
const char *)datain + xindex + group_size +
1782 for (
m = lowy_int+1;
m < highy_int;
m++) {
1784 for(
l = lowx_int+1;
l < highx_int;
l++) {
1786 k++, temp_index += element_size) {
1787 totals[
k] += (
GLbyte)(*(temp_index));
1796 dataout[outindex +
k] = totals[
k]/
area;
1799 lowx_int = highx_int;
1800 lowx_float = highx_float;
1801 highx_int += convx_int;
1802 highx_float += convx_float;
1803 if(highx_float > 1) {
1808 lowy_int = highy_int;
1809 lowy_float = highy_float;
1810 highy_int += convy_int;
1811 highy_float += convy_float;
1812 if(highy_float > 1) {
1834 const char *
temp, *temp0;
1835 const char *temp_index;
1838 int lowx_int, highx_int, lowy_int, highy_int;
1839 float x_percent, y_percent;
1840 float lowx_float, highx_float, lowy_float, highy_float;
1841 float convy_float, convx_float;
1842 int convy_int, convx_int;
1846 if (widthin == widthout*2 && heightin == heightout*2) {
1849 element_size, ysize, group_size, myswap_bytes);
1852 convy = (
float) heightin/heightout;
1853 convx = (
float) widthin/widthout;
1854 convy_int =
floor(convy);
1855 convy_float = convy - convy_int;
1856 convx_int =
floor(convx);
1857 convx_float = convx - convx_int;
1859 area = convx * convy;
1863 highy_int = convy_int;
1864 highy_float = convy_float;
1866 for (
i = 0;
i < heightout;
i++) {
1868 if (highy_int >= heightin)
1869 highy_int = heightin - 1;
1872 highx_int = convx_int;
1873 highx_float = convx_float;
1875 for (
j = 0;
j < widthout;
j++) {
1881 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
1884 xindex = lowx_int*group_size;
1885 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
1887 y_percent = 1-lowy_float;
1888 temp = (
const char *)datain + xindex + lowy_int * ysize;
1889 percent = y_percent * (1-lowx_float);
1891 k++, temp_index += element_size) {
1895 totals[
k] += *(
const GLushort*)temp_index * percent;
1899 for(
l = lowx_int+1;
l < highx_int;
l++) {
1902 k++, temp_index += element_size) {
1907 totals[
k] += *(
const GLushort*)temp_index * y_percent;
1913 percent = y_percent * highx_float;
1915 k++, temp_index += element_size) {
1919 totals[
k] += *(
const GLushort*)temp_index * percent;
1924 y_percent = highy_float;
1925 percent = y_percent * (1-lowx_float);
1926 temp = (
const char *)datain + xindex + highy_int * ysize;
1928 k++, temp_index += element_size) {
1932 totals[
k] += *(
const GLushort*)temp_index * percent;
1935 for(
l = lowx_int+1;
l < highx_int;
l++) {
1938 k++, temp_index += element_size) {
1943 totals[
k] += *(
const GLushort*)temp_index * y_percent;
1948 percent = y_percent * highx_float;
1950 k++, temp_index += element_size) {
1954 totals[
k] += *(
const GLushort*)temp_index * percent;
1959 for(
m = lowy_int+1;
m < highy_int;
m++) {
1963 k++,
left += element_size,
right += element_size) {
1974 }
else if (highy_int > lowy_int) {
1975 x_percent = highx_float - lowx_float;
1976 percent = (1-lowy_float)*x_percent;
1977 temp = (
const char *)datain + xindex + lowy_int*ysize;
1979 k++, temp_index += element_size) {
1983 totals[
k] += *(
const GLushort*)temp_index * percent;
1986 for(
m = lowy_int+1;
m < highy_int;
m++) {
1989 k++, temp_index += element_size) {
1994 totals[
k] += *(
const GLushort*)temp_index * x_percent;
1998 percent = x_percent * highy_float;
2001 k++, temp_index += element_size) {
2005 totals[
k] += *(
const GLushort*)temp_index * percent;
2008 }
else if (highx_int > lowx_int) {
2009 y_percent = highy_float - lowy_float;
2010 percent = (1-lowx_float)*y_percent;
2011 temp = (
const char *)datain + xindex + lowy_int*ysize;
2013 k++, temp_index += element_size) {
2017 totals[
k] += *(
const GLushort*)temp_index * percent;
2020 for (
l = lowx_int+1;
l < highx_int;
l++) {
2023 k++, temp_index += element_size) {
2028 totals[
k] += *(
const GLushort*)temp_index * y_percent;
2033 percent = y_percent * highx_float;
2035 k++, temp_index += element_size) {
2039 totals[
k] += *(
const GLushort*)temp_index * percent;
2043 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
2044 temp = (
const char *)datain + xindex + lowy_int * ysize;
2046 k++, temp_index += element_size) {
2050 totals[
k] += *(
const GLushort*)temp_index * percent;
2056 temp0 = (
const char *)datain + xindex + group_size +
2058 for (
m = lowy_int+1;
m < highy_int;
m++) {
2060 for(
l = lowx_int+1;
l < highx_int;
l++) {
2062 k++, temp_index += element_size) {
2066 totals[
k] += *(
const GLushort*)temp_index;
2076 dataout[outindex +
k] = totals[
k]/
area;
2079 lowx_int = highx_int;
2080 lowx_float = highx_float;
2081 highx_int += convx_int;
2082 highx_float += convx_float;
2083 if(highx_float > 1) {
2088 lowy_int = highy_int;
2089 lowy_float = highy_float;
2090 highy_int += convy_int;
2091 highy_float += convy_float;
2092 if(highy_float > 1) {
2114 const char *
temp, *temp0;
2115 const char *temp_index;
2118 int lowx_int, highx_int, lowy_int, highy_int;
2119 float x_percent, y_percent;
2120 float lowx_float, highx_float, lowy_float, highy_float;
2121 float convy_float, convx_float;
2122 int convy_int, convx_int;
2128 if (widthin == widthout*2 && heightin == heightout*2) {
2131 element_size, ysize, group_size, myswap_bytes);
2134 convy = (
float) heightin/heightout;
2135 convx = (
float) widthin/widthout;
2136 convy_int =
floor(convy);
2137 convy_float = convy - convy_int;
2138 convx_int =
floor(convx);
2139 convx_float = convx - convx_int;
2141 area = convx * convy;
2145 highy_int = convy_int;
2146 highy_float = convy_float;
2148 for (
i = 0;
i < heightout;
i++) {
2150 if (highy_int >= heightin)
2151 highy_int = heightin - 1;
2154 highx_int = convx_int;
2155 highx_float = convx_float;
2157 for (
j = 0;
j < widthout;
j++) {
2163 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
2166 xindex = lowx_int*group_size;
2167 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
2169 y_percent = 1-lowy_float;
2170 temp = (
const char *)datain + xindex + lowy_int * ysize;
2171 percent = y_percent * (1-lowx_float);
2173 k++, temp_index += element_size) {
2176 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2178 totals[
k] += *(
const GLshort*)temp_index * percent;
2182 for(
l = lowx_int+1;
l < highx_int;
l++) {
2185 k++, temp_index += element_size) {
2188 totals[
k] += *(
const GLshort*)&swapbuf * y_percent;
2190 totals[
k] += *(
const GLshort*)temp_index * y_percent;
2196 percent = y_percent * highx_float;
2198 k++, temp_index += element_size) {
2201 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2203 totals[
k] += *(
const GLshort*)temp_index * percent;
2208 y_percent = highy_float;
2209 percent = y_percent * (1-lowx_float);
2210 temp = (
const char *)datain + xindex + highy_int * ysize;
2212 k++, temp_index += element_size) {
2215 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2217 totals[
k] += *(
const GLshort*)temp_index * percent;
2220 for(
l = lowx_int+1;
l < highx_int;
l++) {
2223 k++, temp_index += element_size) {
2226 totals[
k] += *(
const GLshort*)&swapbuf * y_percent;
2228 totals[
k] += *(
const GLshort*)temp_index * y_percent;
2233 percent = y_percent * highx_float;
2235 k++, temp_index += element_size) {
2238 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2240 totals[
k] += *(
const GLshort*)temp_index * percent;
2245 for(
m = lowy_int+1;
m < highy_int;
m++) {
2249 k++,
left += element_size,
right += element_size) {
2252 totals[
k] += *(
const GLshort*)&swapbuf * (1-lowx_float);
2254 totals[
k] += *(
const GLshort*)&swapbuf * highx_float;
2261 }
else if (highy_int > lowy_int) {
2262 x_percent = highx_float - lowx_float;
2263 percent = (1-lowy_float)*x_percent;
2264 temp = (
const char *)datain + xindex + lowy_int*ysize;
2266 k++, temp_index += element_size) {
2269 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2271 totals[
k] += *(
const GLshort*)temp_index * percent;
2274 for(
m = lowy_int+1;
m < highy_int;
m++) {
2277 k++, temp_index += element_size) {
2280 totals[
k] += *(
const GLshort*)&swapbuf * x_percent;
2282 totals[
k] += *(
const GLshort*)temp_index * x_percent;
2286 percent = x_percent * highy_float;
2289 k++, temp_index += element_size) {
2292 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2294 totals[
k] += *(
const GLshort*)temp_index * percent;
2297 }
else if (highx_int > lowx_int) {
2298 y_percent = highy_float - lowy_float;
2299 percent = (1-lowx_float)*y_percent;
2301 temp = (
const char *)datain + xindex + lowy_int*ysize;
2303 k++, temp_index += element_size) {
2306 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2308 totals[
k] += *(
const GLshort*)temp_index * percent;
2311 for (
l = lowx_int+1;
l < highx_int;
l++) {
2314 k++, temp_index += element_size) {
2317 totals[
k] += *(
const GLshort*)&swapbuf * y_percent;
2319 totals[
k] += *(
const GLshort*)temp_index * y_percent;
2324 percent = y_percent * highx_float;
2326 k++, temp_index += element_size) {
2329 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2331 totals[
k] += *(
const GLshort*)temp_index * percent;
2335 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
2336 temp = (
const char *)datain + xindex + lowy_int * ysize;
2338 k++, temp_index += element_size) {
2341 totals[
k] += *(
const GLshort*)&swapbuf * percent;
2343 totals[
k] += *(
const GLshort*)temp_index * percent;
2349 temp0 = (
const char *)datain + xindex + group_size +
2351 for (
m = lowy_int+1;
m < highy_int;
m++) {
2353 for(
l = lowx_int+1;
l < highx_int;
l++) {
2355 k++, temp_index += element_size) {
2358 totals[
k] += *(
const GLshort*)&swapbuf;
2360 totals[
k] += *(
const GLshort*)temp_index;
2370 dataout[outindex +
k] = totals[
k]/
area;
2373 lowx_int = highx_int;
2374 lowx_float = highx_float;
2375 highx_int += convx_int;
2376 highx_float += convx_float;
2377 if(highx_float > 1) {
2382 lowy_int = highy_int;
2383 lowy_float = highy_float;
2384 highy_int += convy_int;
2385 highy_float += convy_float;
2386 if(highy_float > 1) {
2408 const char *
temp, *temp0;
2409 const char *temp_index;
2412 int lowx_int, highx_int, lowy_int, highy_int;
2413 float x_percent, y_percent;
2414 float lowx_float, highx_float, lowy_float, highy_float;
2415 float convy_float, convx_float;
2416 int convy_int, convx_int;
2420 if (widthin == widthout*2 && heightin == heightout*2) {
2423 element_size, ysize, group_size, myswap_bytes);
2426 convy = (
float) heightin/heightout;
2427 convx = (
float) widthin/widthout;
2428 convy_int =
floor(convy);
2429 convy_float = convy - convy_int;
2430 convx_int =
floor(convx);
2431 convx_float = convx - convx_int;
2433 area = convx * convy;
2437 highy_int = convy_int;
2438 highy_float = convy_float;
2440 for (
i = 0;
i < heightout;
i++) {
2442 if (highy_int >= heightin)
2443 highy_int = heightin - 1;
2446 highx_int = convx_int;
2447 highx_float = convx_float;
2449 for (
j = 0;
j < widthout;
j++) {
2455 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
2458 xindex = lowx_int*group_size;
2459 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
2461 y_percent = 1-lowy_float;
2462 temp = (
const char *)datain + xindex + lowy_int * ysize;
2463 percent = y_percent * (1-lowx_float);
2465 k++, temp_index += element_size) {
2469 totals[
k] += *(
const GLuint*)temp_index * percent;
2473 for(
l = lowx_int+1;
l < highx_int;
l++) {
2476 k++, temp_index += element_size) {
2481 totals[
k] += *(
const GLuint*)temp_index * y_percent;
2487 percent = y_percent * highx_float;
2489 k++, temp_index += element_size) {
2493 totals[
k] += *(
const GLuint*)temp_index * percent;
2498 y_percent = highy_float;
2499 percent = y_percent * (1-lowx_float);
2500 temp = (
const char *)datain + xindex + highy_int * ysize;
2502 k++, temp_index += element_size) {
2506 totals[
k] += *(
const GLuint*)temp_index * percent;
2509 for(
l = lowx_int+1;
l < highx_int;
l++) {
2512 k++, temp_index += element_size) {
2517 totals[
k] += *(
const GLuint*)temp_index * y_percent;
2522 percent = y_percent * highx_float;
2524 k++, temp_index += element_size) {
2528 totals[
k] += *(
const GLuint*)temp_index * percent;
2533 for(
m = lowy_int+1;
m < highy_int;
m++) {
2537 k++,
left += element_size,
right += element_size) {
2543 totals[
k] += *(
const GLuint*)
left * (1-lowx_float)
2548 }
else if (highy_int > lowy_int) {
2549 x_percent = highx_float - lowx_float;
2550 percent = (1-lowy_float)*x_percent;
2551 temp = (
const char *)datain + xindex + lowy_int*ysize;
2553 k++, temp_index += element_size) {
2557 totals[
k] += *(
const GLuint*)temp_index * percent;
2560 for(
m = lowy_int+1;
m < highy_int;
m++) {
2563 k++, temp_index += element_size) {
2568 totals[
k] += *(
const GLuint*)temp_index * x_percent;
2572 percent = x_percent * highy_float;
2575 k++, temp_index += element_size) {
2579 totals[
k] += *(
const GLuint*)temp_index * percent;
2582 }
else if (highx_int > lowx_int) {
2583 y_percent = highy_float - lowy_float;
2584 percent = (1-lowx_float)*y_percent;
2586 temp = (
const char *)datain + xindex + lowy_int*ysize;
2588 k++, temp_index += element_size) {
2592 totals[
k] += *(
const GLuint*)temp_index * percent;
2595 for (
l = lowx_int+1;
l < highx_int;
l++) {
2598 k++, temp_index += element_size) {
2603 totals[
k] += *(
const GLuint*)temp_index * y_percent;
2608 percent = y_percent * highx_float;
2610 k++, temp_index += element_size) {
2614 totals[
k] += *(
const GLuint*)temp_index * percent;
2618 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
2619 temp = (
const char *)datain + xindex + lowy_int * ysize;
2621 k++, temp_index += element_size) {
2625 totals[
k] += *(
const GLuint*)temp_index * percent;
2631 temp0 = (
const char *)datain + xindex + group_size +
2633 for (
m = lowy_int+1;
m < highy_int;
m++) {
2635 for(
l = lowx_int+1;
l < highx_int;
l++) {
2637 k++, temp_index += element_size) {
2641 totals[
k] += *(
const GLuint*)temp_index;
2656 else dataout[outindex +
k] =
value;
2658 lowx_int = highx_int;
2659 lowx_float = highx_float;
2660 highx_int += convx_int;
2661 highx_float += convx_float;
2662 if(highx_float > 1) {
2667 lowy_int = highy_int;
2668 lowy_float = highy_float;
2669 highy_int += convy_int;
2670 highy_float += convy_float;
2671 if(highy_float > 1) {
2695 const char *
temp, *temp0;
2696 const char *temp_index;
2699 int lowx_int, highx_int, lowy_int, highy_int;
2700 float x_percent, y_percent;
2701 float lowx_float, highx_float, lowy_float, highy_float;
2702 float convy_float, convx_float;
2703 int convy_int, convx_int;
2709 if (widthin == widthout*2 && heightin == heightout*2) {
2712 element_size, ysize, group_size, myswap_bytes);
2715 convy = (
float) heightin/heightout;
2716 convx = (
float) widthin/widthout;
2717 convy_int =
floor(convy);
2718 convy_float = convy - convy_int;
2719 convx_int =
floor(convx);
2720 convx_float = convx - convx_int;
2722 area = convx * convy;
2726 highy_int = convy_int;
2727 highy_float = convy_float;
2729 for (
i = 0;
i < heightout;
i++) {
2731 if (highy_int >= heightin)
2732 highy_int = heightin - 1;
2735 highx_int = convx_int;
2736 highx_float = convx_float;
2738 for (
j = 0;
j < widthout;
j++) {
2744 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
2747 xindex = lowx_int*group_size;
2748 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
2750 y_percent = 1-lowy_float;
2751 temp = (
const char *)datain + xindex + lowy_int * ysize;
2752 percent = y_percent * (1-lowx_float);
2754 k++, temp_index += element_size) {
2757 totals[
k] += *(
const GLint*)&swapbuf * percent;
2759 totals[
k] += *(
const GLint*)temp_index * percent;
2763 for(
l = lowx_int+1;
l < highx_int;
l++) {
2766 k++, temp_index += element_size) {
2769 totals[
k] += *(
const GLint*)&swapbuf * y_percent;
2771 totals[
k] += *(
const GLint*)temp_index * y_percent;
2777 percent = y_percent * highx_float;
2779 k++, temp_index += element_size) {
2782 totals[
k] += *(
const GLint*)&swapbuf * percent;
2784 totals[
k] += *(
const GLint*)temp_index * percent;
2789 y_percent = highy_float;
2790 percent = y_percent * (1-lowx_float);
2791 temp = (
const char *)datain + xindex + highy_int * ysize;
2793 k++, temp_index += element_size) {
2796 totals[
k] += *(
const GLint*)&swapbuf * percent;
2798 totals[
k] += *(
const GLint*)temp_index * percent;
2801 for(
l = lowx_int+1;
l < highx_int;
l++) {
2804 k++, temp_index += element_size) {
2807 totals[
k] += *(
const GLint*)&swapbuf * y_percent;
2809 totals[
k] += *(
const GLint*)temp_index * y_percent;
2814 percent = y_percent * highx_float;
2816 k++, temp_index += element_size) {
2819 totals[
k] += *(
const GLint*)&swapbuf * percent;
2821 totals[
k] += *(
const GLint*)temp_index * percent;
2826 for(
m = lowy_int+1;
m < highy_int;
m++) {
2830 k++,
left += element_size,
right += element_size) {
2833 totals[
k] += *(
const GLint*)&swapbuf * (1-lowx_float);
2835 totals[
k] += *(
const GLint*)&swapbuf * highx_float;
2837 totals[
k] += *(
const GLint*)
left * (1-lowx_float)
2842 }
else if (highy_int > lowy_int) {
2843 x_percent = highx_float - lowx_float;
2844 percent = (1-lowy_float)*x_percent;
2845 temp = (
const char *)datain + xindex + lowy_int*ysize;
2847 k++, temp_index += element_size) {
2850 totals[
k] += *(
const GLint*)&swapbuf * percent;
2852 totals[
k] += *(
const GLint*)temp_index * percent;
2855 for(
m = lowy_int+1;
m < highy_int;
m++) {
2858 k++, temp_index += element_size) {
2861 totals[
k] += *(
const GLint*)&swapbuf * x_percent;
2863 totals[
k] += *(
const GLint*)temp_index * x_percent;
2867 percent = x_percent * highy_float;
2870 k++, temp_index += element_size) {
2873 totals[
k] += *(
const GLint*)&swapbuf * percent;
2875 totals[
k] += *(
const GLint*)temp_index * percent;
2878 }
else if (highx_int > lowx_int) {
2879 y_percent = highy_float - lowy_float;
2880 percent = (1-lowx_float)*y_percent;
2882 temp = (
const char *)datain + xindex + lowy_int*ysize;
2884 k++, temp_index += element_size) {
2887 totals[
k] += *(
const GLint*)&swapbuf * percent;
2889 totals[
k] += *(
const GLint*)temp_index * percent;
2892 for (
l = lowx_int+1;
l < highx_int;
l++) {
2895 k++, temp_index += element_size) {
2898 totals[
k] += *(
const GLint*)&swapbuf * y_percent;
2900 totals[
k] += *(
const GLint*)temp_index * y_percent;
2905 percent = y_percent * highx_float;
2907 k++, temp_index += element_size) {
2910 totals[
k] += *(
const GLint*)&swapbuf * percent;
2912 totals[
k] += *(
const GLint*)temp_index * percent;
2916 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
2917 temp = (
const char *)datain + xindex + lowy_int * ysize;
2919 k++, temp_index += element_size) {
2922 totals[
k] += *(
const GLint*)&swapbuf * percent;
2924 totals[
k] += *(
const GLint*)temp_index * percent;
2930 temp0 = (
const char *)datain + xindex + group_size +
2932 for (
m = lowy_int+1;
m < highy_int;
m++) {
2934 for(
l = lowx_int+1;
l < highx_int;
l++) {
2936 k++, temp_index += element_size) {
2939 totals[
k] += *(
const GLint*)&swapbuf;
2941 totals[
k] += *(
const GLint*)temp_index;
2951 dataout[outindex +
k] = totals[
k]/
area;
2954 lowx_int = highx_int;
2955 lowx_float = highx_float;
2956 highx_int += convx_int;
2957 highx_float += convx_float;
2958 if(highx_float > 1) {
2963 lowy_int = highy_int;
2964 lowy_float = highy_float;
2965 highy_int += convy_int;
2966 highy_float += convy_float;
2967 if(highy_float > 1) {
2991 const char *
temp, *temp0;
2992 const char *temp_index;
2995 int lowx_int, highx_int, lowy_int, highy_int;
2996 float x_percent, y_percent;
2997 float lowx_float, highx_float, lowy_float, highy_float;
2998 float convy_float, convx_float;
2999 int convy_int, convx_int;
3005 if (widthin == widthout*2 && heightin == heightout*2) {
3008 element_size, ysize, group_size, myswap_bytes);
3011 convy = (
float) heightin/heightout;
3012 convx = (
float) widthin/widthout;
3013 convy_int =
floor(convy);
3014 convy_float = convy - convy_int;
3015 convx_int =
floor(convx);
3016 convx_float = convx - convx_int;
3018 area = convx * convy;
3022 highy_int = convy_int;
3023 highy_float = convy_float;
3025 for (
i = 0;
i < heightout;
i++) {
3027 if (highy_int >= heightin)
3028 highy_int = heightin - 1;
3031 highx_int = convx_int;
3032 highx_float = convx_float;
3034 for (
j = 0;
j < widthout;
j++) {
3040 totals[0] = totals[1] = totals[2] = totals[3] = 0.0;
3043 xindex = lowx_int*group_size;
3044 if((highy_int>lowy_int) && (highx_int>lowx_int)) {
3046 y_percent = 1-lowy_float;
3047 temp = (
const char *)datain + xindex + lowy_int * ysize;
3048 percent = y_percent * (1-lowx_float);
3050 k++, temp_index += element_size) {
3053 totals[
k] += swapbuf.f * percent;
3055 totals[
k] += *(
const GLfloat*)temp_index * percent;
3059 for(
l = lowx_int+1;
l < highx_int;
l++) {
3062 k++, temp_index += element_size) {
3065 totals[
k] += swapbuf.f * y_percent;
3067 totals[
k] += *(
const GLfloat*)temp_index * y_percent;
3073 percent = y_percent * highx_float;
3075 k++, temp_index += element_size) {
3078 totals[
k] += swapbuf.f * percent;
3080 totals[
k] += *(
const GLfloat*)temp_index * percent;
3085 y_percent = highy_float;
3086 percent = y_percent * (1-lowx_float);
3087 temp = (
const char *)datain + xindex + highy_int * ysize;
3089 k++, temp_index += element_size) {
3092 totals[
k] += swapbuf.f * percent;
3094 totals[
k] += *(
const GLfloat*)temp_index * percent;
3097 for(
l = lowx_int+1;
l < highx_int;
l++) {
3100 k++, temp_index += element_size) {
3103 totals[
k] += swapbuf.f * y_percent;
3105 totals[
k] += *(
const GLfloat*)temp_index * y_percent;
3110 percent = y_percent * highx_float;
3112 k++, temp_index += element_size) {
3115 totals[
k] += swapbuf.f * percent;
3117 totals[
k] += *(
const GLfloat*)temp_index * percent;
3122 for(
m = lowy_int+1;
m < highy_int;
m++) {
3126 k++,
left += element_size,
right += element_size) {
3129 totals[
k] += swapbuf.f * (1-lowx_float);
3131 totals[
k] += swapbuf.f * highx_float;
3138 }
else if (highy_int > lowy_int) {
3139 x_percent = highx_float - lowx_float;
3140 percent = (1-lowy_float)*x_percent;
3141 temp = (
const char *)datain + xindex + lowy_int*ysize;
3143 k++, temp_index += element_size) {
3146 totals[
k] += swapbuf.f * percent;
3148 totals[
k] += *(
const GLfloat*)temp_index * percent;
3151 for(
m = lowy_int+1;
m < highy_int;
m++) {
3154 k++, temp_index += element_size) {
3157 totals[
k] += swapbuf.f * x_percent;
3159 totals[
k] += *(
const GLfloat*)temp_index * x_percent;
3163 percent = x_percent * highy_float;
3166 k++, temp_index += element_size) {
3169 totals[
k] += swapbuf.f * percent;
3171 totals[
k] += *(
const GLfloat*)temp_index * percent;
3174 }
else if (highx_int > lowx_int) {
3175 y_percent = highy_float - lowy_float;
3176 percent = (1-lowx_float)*y_percent;
3178 temp = (
const char *)datain + xindex + lowy_int*ysize;
3180 k++, temp_index += element_size) {
3183 totals[
k] += swapbuf.f * percent;
3185 totals[
k] += *(
const GLfloat*)temp_index * percent;
3188 for (
l = lowx_int+1;
l < highx_int;
l++) {
3191 k++, temp_index += element_size) {
3194 totals[
k] += swapbuf.f * y_percent;
3196 totals[
k] += *(
const GLfloat*)temp_index * y_percent;
3201 percent = y_percent * highx_float;
3203 k++, temp_index += element_size) {
3206 totals[
k] += swapbuf.f * percent;
3208 totals[
k] += *(
const GLfloat*)temp_index * percent;
3212 percent = (highy_float-lowy_float)*(highx_float-lowx_float);
3213 temp = (
const char *)datain + xindex + lowy_int * ysize;
3215 k++, temp_index += element_size) {
3218 totals[
k] += swapbuf.f * percent;
3220 totals[
k] += *(
const GLfloat*)temp_index * percent;
3226 temp0 = (
const char *)datain + xindex + group_size +
3228 for (
m = lowy_int+1;
m < highy_int;
m++) {
3230 for(
l = lowx_int+1;
l < highx_int;
l++) {
3232 k++, temp_index += element_size) {
3235 totals[
k] += swapbuf.f;
3237 totals[
k] += *(
const GLfloat*)temp_index;
3247 dataout[outindex +
k] = totals[
k]/
area;
3250 lowx_int = highx_int;
3251 lowx_float = highx_float;
3252 highx_int += convx_int;
3253 highx_float += convx_float;
3254 if(highx_float > 1) {
3259 lowy_int = highy_int;
3260 lowy_float = highy_float;
3261 highy_int += convy_int;
3262 highy_float += convy_float;
3263 if(highy_float > 1) {
3396 if (baseLevel < 0 || baseLevel < userLevel || maxLevel < baseLevel ||
3397 totalLevels < maxLevel)
3423 GLint widthAtLevelOne= (widthPowerOf2 > 1) ?
3424 widthPowerOf2 >> 1 :
3426 GLint heightAtLevelOne= (heightPowerOf2 > 1) ?
3427 heightPowerOf2 >> 1 :
3430 assert(widthAtLevelOne > 0);
assert(heightAtLevelOne > 0);
3439#if defined(GL_ARB_texture_cube_map)
3460 if (proxyWidth == 0) {
3461 if (widthPowerOf2 == 1 && heightPowerOf2 == 1) {
3468 goto noProxyTextures;
3470 widthPowerOf2= widthAtLevelOne;
3471 heightPowerOf2= heightAtLevelOne;
3474 }
while (proxyWidth == 0);
3478 *newWidth= widthPowerOf2;
3479 *newHeight= heightPowerOf2;
3490 if (*newWidth > maxsize) *newWidth = maxsize;
3492 if (*newHeight > maxsize) *newHeight = maxsize;
3499 GLenum typein,
const void *datain,
3508 if (widthin == 0 || heightin == 0 || widthout == 0 || heightout == 0) {
3511 if (widthin < 0 || heightin < 0 || widthout < 0 || heightout < 0) {
3527 if (beforeImage ==
NULL || afterImage ==
NULL) {
3535 datain, beforeImage);
3538 widthout, heightout, afterImage);
3557 GLint newImage_width;
3569 newwidth= widthPowerOf2;
3577 newImage_width =
width;
3578 if (newImage ==
NULL) {
3594 if (newImage_width == newwidth) {
3596 if (baseLevel <=
level &&
level <= maxLevel) {
3601 if (otherImage ==
NULL) {
3604 if (otherImage ==
NULL) {
3615 newwidth, 1, otherImage);
3617 imageTemp = otherImage;
3618 otherImage = newImage;
3619 newImage = imageTemp;
3621 newImage_width = newwidth;
3622 if (baseLevel <=
level &&
level <= maxLevel) {
3627 if (newwidth > 1) newwidth /= 2;
3652 if (rc != 0)
return rc;
3667 userLevel, baseLevel, maxLevel,
3676 GLint widthPowerOf2;
3681 if (rc != 0)
return rc;
3700 GLint newwidth, newheight;
3703 GLint newImage_width;
3704 GLint newImage_height;
3716 if (newwidth > maxsize) newwidth = maxsize;
3718 if (newheight > maxsize) newheight = maxsize;
3721 &newwidth,&newheight);
3730 newImage_width =
width;
3731 newImage_height =
height;
3732 if (newImage ==
NULL) {
3750 if (newImage_width == newwidth && newImage_height == newheight) {
3755 if (otherImage ==
NULL) {
3759 if (otherImage ==
NULL) {
3770 newwidth, newheight, otherImage);
3772 imageTemp = otherImage;
3773 otherImage = newImage;
3774 newImage = imageTemp;
3776 newImage_width = newwidth;
3777 newImage_height = newheight;
3782 if (newwidth > 1) newwidth /= 2;
3783 if (newheight > 1) newheight /= 2;
3799#define __GLU_INIT_SWAP_IMAGE void *tmpImage
3800#define __GLU_SWAP_IMAGE(a,b) tmpImage = a; a = b; b = tmpImage;
3811 GLint newwidth, newheight;
3813 const void *usersImage;
3814 void *srcImage, *dstImage;
3819 GLint myswap_bytes, groups_per_line, element_size, group_size;
3831 srcImage = dstImage =
NULL;
3833 newwidth= widthPowerOf2;
3834 newheight= heightPowerOf2;
3847 groups_per_line =
width;
3851 group_size = element_size * cmpts;
3852 if (element_size == 1) myswap_bytes = 0;
3854 rowsize = groups_per_line * group_size;
3871 if (baseLevel <=
level &&
level <= maxLevel) {
3887 int nextWidth= newwidth/2;
3888 int nextHeight= newheight/2;
3891 if (nextWidth < 1) nextWidth= 1;
3892 if (nextHeight < 1) nextHeight= 1;
3939 if (dstImage ==
NULL) {
3952 element_size, rowsize, group_size);
3957 element_size, rowsize, group_size);
3962 element_size, rowsize, group_size, myswap_bytes);
3967 element_size, rowsize, group_size, myswap_bytes);
3972 element_size, rowsize, group_size, myswap_bytes);
3976 (
const GLint *)usersImage, (
GLint *)dstImage,
3977 element_size, rowsize, group_size, myswap_bytes);
3982 element_size, rowsize, group_size, myswap_bytes);
3988 element_size,rowsize,myswap_bytes);
3994 element_size,rowsize,myswap_bytes);
3999 element_size,rowsize,myswap_bytes);
4004 element_size,rowsize,myswap_bytes);
4009 element_size,rowsize,myswap_bytes);
4014 element_size,rowsize,myswap_bytes);
4019 element_size,rowsize,myswap_bytes);
4024 element_size,rowsize,myswap_bytes);
4029 element_size,rowsize,myswap_bytes);
4034 element_size,rowsize,myswap_bytes);
4039 element_size,rowsize,myswap_bytes);
4044 element_size,rowsize,myswap_bytes);
4053 if (newwidth < 1) newwidth= 1;
4054 if (newheight < 1) newheight= 1;
4057 rowsize = newwidth * group_size;
4104 if (dstImage ==
NULL) {
4114 level = userLevel+1;
4161 if (dstImage ==
NULL) {