44 NSCParameterAssert(height > 0);
52 uint32_t *pixel = outPixMap.
pixels;
53 float fheight = height;
54 float rheight = 1.0f / fheight;
56 float halfSize = (sourcePixMap.
width - 1) * 0.5f;
57 uint8_t *srcBytes = sourcePixMap.
pixels;
60 float sinTable[width];
61 float cosTable[width];
62 for (
x = 0;
x < width;
x++)
64 float lon = ((float)
x * rheight) *
kPiF;
65 sinTable[x] = sin(lon);
66 cosTable[x] = cos(lon);
69 for (
y = 0;
y < height;
y++)
81 float cy = -sinTable[width * 3 / 4 - y];
82 float lac = -cosTable[width * 3 / 4 - y];
85 for (
x = 0;
x < width;
x++)
87 float cx = sinTable[x] * lac;
88 float cz = cosTable[x] * lac;
100 if (ax >= ay && ax >= az)
115 else if (ay >= ax && ay >= az)
152 assert(ix < sourcePixMap.
width && iy < sourcePixMap.
width);
156 iy += sourcePixMap.
width * yOffset;
158 uint32_t *row = (uint32_t *)(srcBytes + iy * sourcePixMap.
rowBytes);
164 return OOScalePixMap(outPixMap, width / 2, height / 2, leaveSpaceForMipMaps);
OOPixMap OOAllocatePixMap(OOPixMapDimension width, OOPixMapDimension height, OOPixMapFormat format, size_t rowBytes, size_t bufferSize)
OOPixMap OOScalePixMap(OOPixMap srcPixMap, OOPixMapDimension dstWidth, OOPixMapDimension dstHeight, BOOL leaveSpaceForMipMaps)