36#define DUMP_MIP_MAPS 0
63#if OOLITE_NATIVE_64_BIT
94#if !OOLITE_NATIVE_64_BIT
118 StretchVerticallyN_x8(srcPx, dstPx);
150 [NSException raise:NSInternalInconsistencyException format:@"Unsupported pixmap format in scaler: %@", OOPixMapFormatName(pixMap.format)];
180 [NSException raise:NSInternalInconsistencyException format:@"Unsupported pixmap format in scaler: %@", OOPixMapFormatName(srcPx.format)];
208 [NSException raise:NSInternalInconsistencyException format:@"Unsupported pixmap format in scaler: %@", OOPixMapFormatName(pixMap.format)];
215#if DUMP_MIP_MAPS || DUMP_SCALE
217volatile int32_t sPreviousDumpID = 0;
218int32_t OSAtomicAdd32(int32_t __theAmount,
volatile int32_t *__theValue);
223#define DUMP_CHANNELS -1
225#define DUMP_MIP_MAP_PREPARE(pl) uint32_t dumpPlanes = pl; \
226 uint32_t dumpLevel = 0; \
227 BOOL dumpThis = (dumpPlanes & DUMP_CHANNELS) != 0; \
228 SInt32 dumpID = dumpThis ? OSAtomicAdd32(1, &sPreviousDumpID) : 0;
229#define DUMP_MIP_MAP_DUMP(px, w, h) if (dumpThis) DumpMipMap(px, w, h, dumpPlanes, dumpID, dumpLevel++);
232#define DUMP_MIP_MAP_PREPARE(pl) do { (void)pl; } while (0)
233#define DUMP_MIP_MAP_DUMP(px, w, h) do { (void)px; (void)w; (void)h; } while (0)
237#define DUMP_SCALE_PREPARE() SInt32 dumpID = OSAtomicAdd32(1, &sPreviousDumpID), dumpCount = 0;
238#define DUMP_SCALE_DUMP(PM, stage) do { OOPixMap *pm = &(PM); OODumpPixMap(*pm, [NSString stringWithFormat:@"scaling dump ID %u stage %u-%@ %ux%u", dumpID, dumpCount++, stage, pm->width, pm->height]); } while (0)
240#define DUMP_SCALE_PREPARE()
241#define DUMP_SCALE_DUMP(PM, stage) do {} while (0)
247 OOPixMap dstPx = {0}, sparePx = {0};
261 if (srcPx.
height < dstHeight)
264 size_t dstSize = srcPx.
rowBytes * dstHeight;
265 if (leaveSpaceForMipMaps && dstWidth <= srcPx.
width) dstSize = dstSize * 4 / 3;
276 else if (dstHeight < srcPx.
height)
284 if (srcPx.
width < dstWidth)
288 if (leaveSpaceForMipMaps) dstSize = dstSize * 4 / 3;
290 if (dstSize <= sparePx.bufferSize)
304 else if (dstWidth < srcPx.
width)
310 dstPx.
width = dstWidth;
328 if (sparePx.pixels != dstPx.
pixels && sparePx.pixels != srcPx.
pixels)
330 free(sparePx.pixels);
347 OOLog(
kOOLogParameterError,
@"Non-power-of-two dimensions (%ux%u) passed to %s() - ignoring, data will be junk.", width, height, __PRETTY_FUNCTION__);
380 uint8_t *curr, *next;
385#if OOLITE_NATIVE_64_BIT
386 while (8 < w && 1 < h)
391 ScaleToHalf_1_x8(curr, next, w, h);
398 while (4 < w && 1 < h)
411 while (1 < w && 1 < h)
433 uint8_t *src0, *src1, *dst;
434 uint_fast8_t px00, px01, px10, px11;
438 src1 = src0 + srcWidth;
454 sum = px00 + px01 + px10 + px11;
470#if !OOLITE_NATIVE_64_BIT
475 uint32_t *src0, *src1, *dst;
476 uint_fast32_t px00, px01, px10, px11;
477 uint_fast32_t sum0, sum1;
481 src1 = src0 + srcWidth;
497 sum0 = (px00 & 0x00FF00FF) +
498 (px10 & 0x00FF00FF) +
499 ((px00 & 0xFF00FF00) >> 8) +
500 ((px10 & 0xFF00FF00) >> 8);
501 sum1 = (px01 & 0x00FF00FF) +
502 (px11 & 0x00FF00FF) +
503 ((px01 & 0xFF00FF00) >> 8) +
504 ((px11 & 0xFF00FF00) >> 8);
508 sum0 = ((sum0 << 6) & 0xFF000000) | ((sum0 << 14) & 0x00FF0000);
509 sum1 = ((sum1 >> 10) & 0x0000FF00) | ((sum1 >>2) & 0x000000FF);
510#elif OOLITE_LITTLE_ENDIAN
511 sum0 = ((sum0 >> 10) & 0x0000FF00) | ((sum0 >>2) & 0x000000FF);
512 sum1 = ((sum1 << 6) & 0xFF000000) | ((sum1 << 14) & 0x00FF0000);
514 #error Neither OOLITE_BIG_ENDIAN nor OOLITE_LITTLE_ENDIAN is defined as nonzero!
518 *dst++ = sum0 | sum1;
532 uint64_t *src0, *src1;
534 uint_fast64_t px00, px01, px10, px11;
535 uint_fast64_t sum0, sum1;
539 src1 = src0 + srcWidth;
555 sum0 = ((px00 & 0x00FF00FF00FF00FFULL)) +
556 ((px10 & 0x00FF00FF00FF00FFULL)) +
557 ((px00 & 0xFF00FF00FF00FF00ULL) >> 8) +
558 ((px10 & 0xFF00FF00FF00FF00ULL) >> 8);
559 sum1 = ((px01 & 0x00FF00FF00FF00FFULL)) +
560 ((px11 & 0x00FF00FF00FF00FFULL)) +
561 ((px01 & 0xFF00FF00FF00FF00ULL) >> 8) +
562 ((px11 & 0xFF00FF00FF00FF00ULL) >> 8);
566 sum0 = ((sum0 << 06) & 0xFF00000000000000ULL) |
567 ((sum0 << 14) & 0x00FF000000000000ULL) |
568 ((sum0 << 22) & 0x0000FF0000000000ULL) |
569 ((sum0 << 30) & 0x000000FF00000000ULL);
570 sum1 = ((sum1 >> 26) & 0x00000000FF000000ULL) |
571 ((sum1 >> 18) & 0x0000000000FF0000ULL) |
572 ((sum1 >> 10) & 0x000000000000FF00ULL) |
573 ((sum1 >> 02) & 0x00000000000000FFULL);
574#elif OOLITE_LITTLE_ENDIAN
575 sum0 = ((sum0 >> 26) & 0x00000000FF000000ULL) |
576 ((sum0 >> 18) & 0x0000000000FF0000ULL) |
577 ((sum0 >> 10) & 0x000000000000FF00ULL) |
578 ((sum0 >> 02) & 0x00000000000000FFULL);
579 sum1 = ((sum1 << 06) & 0xFF00000000000000ULL) |
580 ((sum1 << 14) & 0x00FF000000000000ULL) |
581 ((sum1 << 22) & 0x0000FF0000000000ULL) |
582 ((sum1 << 30) & 0x000000FF00000000ULL);
584 #error Neither OOLITE_BIG_ENDIAN nor OOLITE_LITTLE_ENDIAN is defined as nonzero!
587 *dst++ = sum0 | sum1;
602 uint16_t *curr, *next;
609#if OOLITE_NATIVE_64_BIT
610 while (4 < w && 1 < h)
615 ScaleToHalf_2_x4(curr, next, w, h);
622 while (2 < w && 1 < h)
627 ScaleToHalf_2_x2(curr, next, w, h);
636 while (1 < w && 1 < h)
658 uint16_t *src0, *src1, *dst;
659 uint_fast16_t px00, px01, px10, px11;
660 uint_fast32_t sumHi, sumLo;
663 src1 = src0 + srcWidth;
679 sumHi = (px00 & 0xFF00) + (px01 & 0xFF00) + (px10 & 0xFF00) + (px11 & 0xFF00);
680 sumLo = (px00 & 0x00FF) + (px01 & 0x00FF) + (px10 & 0x00FF) + (px11 & 0x00FF);
683 sumLo = ((sumHi & 0x3FC00) | sumLo) >> 2;
699 uint32_t *curr, *next;
704#if OOLITE_NATIVE_64_BIT
705 while (2 < w && 1 < h)
710 ScaleToHalf_4_x2(curr, next, w, h);
716 if (
EXPECT(1 < w && 1 < h))
727 while (1 < w && 1 < h)
750 uint32_t *src0, *src1, *dst;
751 uint_fast32_t px00, px01, px10, px11;
758 uint_fast32_t ag, br;
761 src1 = src0 + srcWidth;
777 ag = (px00 & 0xFF00FF00) >> 8;
778 br = (px00 & 0x00FF00FF);
779 ag += (px01 & 0xFF00FF00) >> 8;
780 br += (px01 & 0x00FF00FF);
781 ag += (px10 & 0xFF00FF00) >> 8;
782 br += (px10 & 0x00FF00FF);
783 ag += (px11 & 0xFF00FF00) >> 8;
784 br += (px11 & 0x00FF00FF);
791 *dst++ = (ag & 0xFF00FF00) | (br & 0x00FF00FF);
801#if OOLITE_NATIVE_64_BIT
806 uint_fast64_t *src0, *src1, *dst;
807 uint_fast64_t px00, px01, px10, px11;
814 uint_fast64_t ag0, ag1, br0, br1;
818 src1 = src0 + srcWidth;
834 ag0 = (px00 & 0xFF00FF00FF00FF00ULL) >> 8;
835 br0 = (px00 & 0x00FF00FF00FF00FFULL);
836 ag0 += (px10 & 0xFF00FF00FF00FF00ULL) >> 8;
837 br0 += (px10 & 0x00FF00FF00FF00FFULL);
838 ag1 = (px01 & 0xFF00FF00FF00FF00ULL) >> 8;
839 br1 = (px01 & 0x00FF00FF00FF00FFULL);
840 ag1 += (px11 & 0xFF00FF00FF00FF00ULL) >> 8;
841 br1 += (px11 & 0x00FF00FF00FF00FFULL);
845 ag0 = ag0 + (ag0 << 32);
846 br0 = br0 + (br0 << 32);
847 ag1 = ag1 + (ag1 >> 32);
848 br1 = br1 + (br1 >> 32);
851 ag0 = ((ag0 & 0x03FC03FC00000000ULL) | (ag1 & 0x0000000003FC03FCULL)) << 6;
852 br0 = ((br0 & 0x03FC03FC00000000ULL) | (br1 & 0x0000000003FC03FCULL)) >> 2;
853#elif OOLITE_LITTLE_ENDIAN
855 ag0 = ag0 + (ag0 >> 32);
856 br0 = br0 + (br0 >> 32);
857 ag1 = ag1 + (ag1 << 32);
858 br1 = br1 + (br1 << 32);
861 ag0 = ((ag0 & 0x0000000003FC03FCULL) | (ag1 & 0x03FC03FC00000000ULL)) << 6;
862 br0 = ((br0 & 0x0000000003FC03FCULL) | (br1 & 0x03FC03FC00000000ULL)) >> 2;
864 #error Unknown architecture.
891 uint8_t *src, *src0, *src1, *prev, *dst;
893 uint_fast32_t
x,
y, xCount;
895 uint_fast16_t weight0, weight1;
896 uint_fast32_t fractY;
911 prev = src1 = src + srcRowBytes * (fractY >> 8);
913 weight1 = fractY & 0xFF;
914 weight0 = 0x100 - weight1;
922 *dst++ = (px0 * weight0 + px1 * weight1) >> 8;
935#if !OOLITE_NATIVE_64_BIT
940 uint32_t *src0, *src1, *prev, *dst;
941 uint32_t px0, px1, ag, br;
942 uint_fast32_t
x,
y, xCount;
944 uint_fast16_t weight0, weight1;
945 uint_fast32_t fractY;
951 src0 = prev = (uint32_t *)src;
960 prev = src1 = (uint32_t *)(src + srcRowBytes * (fractY >> 8));
962 weight1 = fractY & 0xFF;
963 weight0 = 0x100 - weight1;
971 ag = ((px0 & 0xFF00FF00) >> 8) * weight0 + ((px1 & 0xFF00FF00) >> 8) * weight1;
972 br = (px0 & 0x00FF00FF) * weight0 + (px1 & 0x00FF00FF) * weight1;
974 *dst++ = (ag & 0xFF00FF00) | ((br >> 8) & 0x00FF00FF);
991 uint64_t *src0, *src1, *prev, *dst;
992 uint64_t px0, px1, agag, brbr;
993 uint_fast32_t
x,
y, xCount;
995 uint_fast16_t weight0, weight1;
996 uint_fast32_t fractY;
1002 src0 = prev = (uint64_t *)src;
1011 prev = src1 = (uint64_t *)(src + srcRowBytes * (fractY >> 8));
1013 weight1 = fractY & 0xFF;
1014 weight0 = 0x100 - weight1;
1022 agag = ((px0 & 0xFF00FF00FF00FF00ULL) >> 8) * weight0 + ((px1 & 0xFF00FF00FF00FF00ULL) >> 8) * weight1;
1023 brbr = (px0 & 0x00FF00FF00FF00FFULL) * weight0 + (px1 & 0x00FF00FF00FF00FFULL) * weight1;
1025 *dst++ = (agag & 0xFF00FF00FF00FF00ULL) | ((brbr >> 8) & 0x00FF00FF00FF00FFULL);
1041 uint8_t *src, *srcStart, *dst;
1043 uint_fast32_t
x,
y, xCount;
1045 uint_fast16_t weight0, weight1;
1046 uint_fast32_t fractX, deltaX;
1052 xCount = dstPx.
width;
1062 for (
x = 0;
x!= xCount; ++
x)
1066 weight1 = (fractX >> 4) & 0xFF;
1067 weight0 = 0x100 - weight1;
1070 src = srcStart + (fractX >> 12);
1073 *dst++ = (px0 * weight0 + px1 * weight1) >> 8;
1076 srcStart = (uint8_t *)((
char *)srcStart + srcRowBytes);
1082 for (
x = 0;
x!= xCount; ++
x)
1086 weight1 = (fractX >> 4) & 0xFF;
1087 weight0 = 0x100 - weight1;
1090 src = srcStart + (fractX >> 12);
1093 *dst++ = (px0 * weight0 + px1 * weight1) >> 8;
1100 uint16_t *src, *srcStart, *dst;
1102 uint_fast32_t hi, lo;
1103 uint_fast32_t
x,
y, xCount;
1105 uint_fast16_t weight0, weight1;
1106 uint_fast32_t fractX, deltaX;
1112 xCount = dstPx.
width;
1122 for (
x = 0;
x!= xCount; ++
x)
1126 weight1 = (fractX >> 4) & 0xFF;
1127 weight0 = 0x100 - weight1;
1130 src = srcStart + (fractX >> 12);
1133 hi = (px0 & 0xFF00) * weight0 + (px1 & 0xFF00) * weight1;
1134 lo = (px0 & 0x00FF) * weight0 + (px1 & 0x00FF) * weight1;
1136 *dst++ = ((hi & 0xFF0000) | (lo & 0x00FF00)) >> 8;
1139 srcStart = (uint16_t *)((
char *)srcStart + srcRowBytes);
1145 for (
x = 0;
x!= xCount; ++
x)
1149 weight1 = (fractX >> 4) & 0xFF;
1150 weight0 = 0x100 - weight1;
1153 src = srcStart + (fractX >> 12);
1156 hi = (px0 & 0xFF00) * weight0 + (px1 & 0xFF00) * weight1;
1157 lo = (px0 & 0x00FF) * weight0 + (px1 & 0x00FF) * weight1;
1159 *dst++ = ((hi & 0xFF0000) | (lo & 0x00FF00)) >> 8;
1166 uint32_t *src, *srcStart, *dst;
1169 uint_fast32_t
x,
y, xCount;
1171 uint_fast16_t weight0, weight1;
1172 uint_fast32_t fractX, deltaX;
1178 xCount = dstPx.
width;
1188 for (
x = 0;
x!= xCount; ++
x)
1192 weight1 = (fractX >> 4) & 0xFF;
1193 weight0 = 0x100 - weight1;
1196 src = srcStart + (fractX >> 12);
1199 ag = ((px0 & 0xFF00FF00) >> 8) * weight0 + ((px1 & 0xFF00FF00) >> 8) * weight1;
1200 br = (px0 & 0x00FF00FF) * weight0 + (px1 & 0x00FF00FF) * weight1;
1202 *dst++ = (ag & 0xFF00FF00) | ((br & 0xFF00FF00) >> 8);
1205 srcStart = (uint32_t *)((
char *)srcStart + srcRowBytes);
1211 for (
x = 0;
x!= xCount; ++
x)
1215 weight1 = (fractX >> 4) & 0xFF;
1216 weight0 = 0x100 - weight1;
1219 src = srcStart + (fractX >> 12);
1220 if (
EXPECT(
x < xCount - 1)) px1 = *src;
1222 ag = ((px0 & 0xFF00FF00) >> 8) * weight0 + ((px1 & 0xFF00FF00) >> 8) * weight1;
1223 br = (px0 & 0x00FF00FF) * weight0 + (px1 & 0x00FF00FF) * weight1;
1225 *dst++ = (ag & 0xFF00FF00) | ((br & 0xFF00FF00) >> 8);
1232 uint8_t *src, *srcStart, *dst;
1234 uint_fast32_t
x,
y, xCount, endX;
1236 uint_fast32_t endFractX, deltaX;
1237 uint_fast32_t accum, weight;
1238 uint_fast8_t borderWeight;
1246 deltaX = (srcPx.
width << 12) / dstWidth;
1250 borderPx = *srcStart;
1260 endFractX += deltaX;
1261 endX = endFractX >> 12;
1263 borderWeight = 0xFF - borderWeight;
1264 accum = borderPx * borderWeight;
1265 weight = borderWeight;
1267 borderWeight = (endFractX >> 4) & 0xFF;
1268 weight += borderWeight;
1275 if (
EXPECT(xCount)) borderPx = *++src;
1276 accum += borderPx * borderWeight;
1281 accum += *++src * 0xFF;
1286 *dst++ = accum / weight;
1289 srcStart = (uint8_t *)((
char *)srcStart + srcRowBytes);
1296 uint8_t *src, *srcStart, *dst;
1297 uint_fast32_t
x,
y, xCount, startY, endY, lastRow;
1299 uint_fast32_t endFractY, deltaY;
1300 uint_fast32_t accum, weight;
1301 uint_fast8_t startWeight, endWeight;
1307 xCount = srcPx.
width;
1309 deltaY = (srcPx.
height << 12) / dstHeight;
1315 lastRow = srcPx.
height - 1;
1317 while (endY < lastRow)
1319 endFractY += deltaY;
1321 endY = endFractY >> 12;
1323 startWeight = 0xFF - endWeight;
1324 endWeight = (endFractY >> 4) & 0xFF;
1326 srcStart = (uint8_t *)((
char *)srcPx.
pixels + srcRowBytes * startY);
1328 for (
x = 0;
x != xCount; ++
x)
1331 accum = startWeight * *src;
1332 weight = startWeight + endWeight;
1338 src = (uint8_t *)((
char *)src + srcRowBytes);
1341 if (
EXPECT(endY < lastRow)) accum += *src * endWeight;
1346 accum += *src * 0xFF;
1351 *dst++ = accum / weight;
1362#define ACCUM2(PX, WT) do { \
1364 uint_fast32_t wt = WT; \
1365 accumHi += (px & 0xFF00) * wt; \
1366 accumLo += (px & 0x00FF) * wt; \
1370#define CLEAR_ACCUM2() do { \
1376#define ACCUM2TOPX() ( \
1377 ((accumHi / weight) & 0xFF00) | \
1378 ((accumLo / weight) & 0x00FF) \
1384 uint16_t *src, *srcStart, *dst;
1386 uint_fast32_t
x,
y, xCount, endX;
1388 uint_fast32_t endFractX, deltaX;
1389 uint_fast32_t accumHi, accumLo, weight;
1390 uint_fast8_t borderWeight;
1398 deltaX = (srcPx.
width << 12) / dstWidth;
1402 borderPx = *srcStart;
1412 endFractX += deltaX;
1413 endX = endFractX >> 12;
1417 borderWeight = 0xFF - borderWeight;
1418 ACCUM2(borderPx, borderWeight);
1420 borderWeight = (endFractX >> 4) & 0xFF;
1427 if (
EXPECT(xCount)) borderPx = *++src;
1428 ACCUM2(borderPx, borderWeight);
1440 srcStart = (uint16_t *)((
char *)srcStart + srcRowBytes);
1447 uint16_t *src, *srcStart, *dst;
1448 uint_fast32_t
x,
y, xCount, startY, endY, lastRow;
1450 uint_fast32_t endFractY, deltaY;
1451 uint_fast32_t accumHi, accumLo, weight;
1452 uint_fast8_t startWeight, endWeight;
1458 xCount = srcPx.
width;
1460 deltaY = (srcPx.
height << 12) / dstHeight;
1466 lastRow = srcPx.
height - 1;
1468 while (endY < lastRow)
1470 endFractY += deltaY;
1472 endY = endFractY >> 12;
1474 startWeight = 0xFF - endWeight;
1475 endWeight = (endFractY >> 4) & 0xFF;
1477 srcStart = (uint16_t *)((
char *)srcPx.
pixels + srcRowBytes * startY);
1479 for (
x = 0;
x != xCount; ++
x)
1484 ACCUM2(*src, startWeight);
1490 src = (uint16_t *)((
char *)src + srcRowBytes);
1513#define ACCUM4(PX, WT) do { \
1515 uint_fast32_t wt = WT; \
1516 ag = ((px & 0xFF00FF00) >> 8) * wt; \
1517 br = (px & 0x00FF00FF) * wt; \
1518 accum1 += ag >> 16; \
1519 accum2 += br >> 16; \
1520 accum3 += ag & 0xFFFF; \
1521 accum4 += br & 0xFFFF; \
1525#define CLEAR_ACCUM4() do { \
1539#define ACCUM4TOPX() ( \
1540 (((accum1 / weight) & 0xFF) << 24) | \
1541 (((accum3 / weight) & 0xFF) << 8) | \
1542 (((accum2 / weight) & 0xFF) << 16) | \
1543 ((accum4 / weight) & 0xFF) \
1549 uint32_t *src, *srcStart, *dst;
1550 uint32_t borderPx, ag, br;
1551 uint_fast32_t
x,
y, xCount, endX;
1553 uint_fast32_t endFractX, deltaX;
1554 uint_fast32_t accum1, accum2, accum3, accum4, weight;
1555 uint_fast8_t borderWeight;
1563 deltaX = (srcPx.
width << 12) / dstWidth;
1567 borderPx = *srcStart;
1577 endFractX += deltaX;
1578 endX = endFractX >> 12;
1582 borderWeight = 0xFF - borderWeight;
1583 ACCUM4(borderPx, borderWeight);
1585 borderWeight = (endFractX >> 4) & 0xFF;
1592 if (
EXPECT(xCount)) borderPx = *++src;
1593 ACCUM4(borderPx, borderWeight);
1605 srcStart = (uint32_t *)((
char *)srcStart + srcRowBytes);
1612 uint32_t *src, *srcStart, *dst;
1613 uint_fast32_t
x,
y, xCount, startY, endY, lastRow;
1616 uint_fast32_t endFractY, deltaY;
1617 uint_fast32_t accum1, accum2, accum3, accum4, weight;
1618 uint_fast8_t startWeight, endWeight;
1624 xCount = srcPx.
width;
1626 deltaY = (srcPx.
height << 12) / dstHeight;
1632 lastRow = srcPx.
height - 1;
1634 while (endY < lastRow)
1636 endFractY += deltaY;
1638 endY = endFractY >> 12;
1640 startWeight = 0xFF - endWeight;
1641 endWeight = (endFractY >> 4) & 0xFF;
1643 srcStart = (uint32_t *)((
char *)srcPx.
pixels + srcRowBytes * startY);
1645 for (
x = 0;
x != xCount; ++
x)
1650 ACCUM4(*src, startWeight);
1656 src = (uint32_t *)((
char *)src + srcRowBytes);
1694 if (leaveSpaceForMipMaps) correctSize = correctSize * 4 / 3;
1697 bytes = realloc(pixMap->
pixels, correctSize);
#define ALWAYS_INLINE_FUNC
#define OOLogGenericParameterError()
#define OOLog(class, format,...)
NSString *const kOOLogParameterError
uint_fast32_t OOPixMapDimension
NSString * OOPixMapFormatName(OOPixMapFormat format) PURE_FUNC
void OODumpPixMap(OOPixMap pixMap, NSString *name)
@ kOOPixMapGrayscaleAlpha
const OOPixMap kOONullPixMap
#define OORoundUpToPowerOf2_PixMap
OOPixMap OOAllocatePixMap(OOPixMapDimension width, OOPixMapDimension height, OOPixMapFormat format, size_t rowBytes, size_t bufferSize)
OOINLINE unsigned short OOPixMapBytesPerPixel(OOPixMap pixMap)
OOPixMap OOMakePixMap(void *pixels, OOPixMapDimension width, OOPixMapDimension height, OOPixMapFormat format, size_t rowBytes, size_t bufferSize)
BOOL OOIsValidPixMap(OOPixMap pixMap)
static BOOL GenerateMipMaps2(void *textureBytes, OOPixMapDimension width, OOPixMapDimension height) NONNULL_FUNC
static void SqueezeVertically1(OOPixMap srcPx, OOPixMapDimension dstHeight)
#define DUMP_MIP_MAP_DUMP(px, w, h)
static void ScaleToHalf_4_x1(void *srcBytes, void *dstBytes, OOPixMapDimension srcWidth, OOPixMapDimension srcHeight) NONNULL_FUNC
static void ScaleToHalf_2_x1(void *srcBytes, void *dstBytes, OOPixMapDimension srcWidth, OOPixMapDimension srcHeight) NONNULL_FUNC
#define DUMP_SCALE_PREPARE()
static void StretchHorizontally2(OOPixMap srcPx, OOPixMap dstPx)
#define DUMP_SCALE_DUMP(PM, stage)
static BOOL GenerateMipMaps4(void *textureBytes, OOPixMapDimension width, OOPixMapDimension height) NONNULL_FUNC
static BOOL EnsureCorrectDataSize(OOPixMap *pixMap, BOOL leaveSpaceForMipMaps) NONNULL_FUNC
OOPixMap OOScalePixMap(OOPixMap srcPx, OOPixMapDimension dstWidth, OOPixMapDimension dstHeight, BOOL leaveSpaceForMipMaps)
#define DUMP_MIP_MAP_PREPARE(pl)
OOINLINE void StretchVertically(OOPixMap srcPx, OOPixMap dstPx) ALWAYS_INLINE_FUNC
static void SqueezeHorizontally2(OOPixMap srcPx, OOPixMapDimension dstWidth)
static BOOL GenerateMipMaps1(void *textureBytes, OOPixMapDimension width, OOPixMapDimension height) NONNULL_FUNC
OOINLINE void StretchHorizontally(OOPixMap srcPx, OOPixMap dstPx) ALWAYS_INLINE_FUNC
static void SqueezeVertically4(OOPixMap srcPx, OOPixMapDimension dstHeight)
OOINLINE void SqueezeVertically(OOPixMap pixMap, OOPixMapDimension dstHeight) ALWAYS_INLINE_FUNC
static void ScaleToHalf_1_x1(void *srcBytes, void *dstBytes, OOPixMapDimension srcWidth, OOPixMapDimension srcHeight) NONNULL_FUNC
OOINLINE void SqueezeHorizontally(OOPixMap pixMap, OOPixMapDimension dstHeight) ALWAYS_INLINE_FUNC
static void SqueezeHorizontally1(OOPixMap srcPx, OOPixMapDimension dstWidth)
static void SqueezeHorizontally4(OOPixMap srcPx, OOPixMapDimension dstWidth)
BOOL OOGenerateMipMaps(void *textureBytes, OOPixMapDimension width, OOPixMapDimension height, OOPixMapFormat format)
static void StretchHorizontally1(OOPixMap srcPx, OOPixMap dstPx)
static void StretchVerticallyN_x1(OOPixMap srcPx, OOPixMap dstPx)
static void ScaleToHalf_1_x4(void *srcBytes, void *dstBytes, OOPixMapDimension srcWidth, OOPixMapDimension srcHeight) NONNULL_FUNC
static void StretchHorizontally4(OOPixMap srcPx, OOPixMap dstPx)
static void SqueezeVertically2(OOPixMap srcPx, OOPixMapDimension dstHeight)
static void StretchVerticallyN_x4(OOPixMap srcPx, OOPixMap dstPx)