41 NSCParameterAssert(height > 0);
50 uint32_t* pixel = outPixMap.
pixels;
51 float fheight = height;
52 float rheight = 1.0f / fheight;
54 float halfSize = (sourcePixMap.
width - 1) * 0.5f;
55 uint8_t* srcBytes = sourcePixMap.
pixels;
58 float sinTable[width];
59 float cosTable[width];
60 for (
x = 0;
x < width;
x++) {
61 float lon = ((float)
x * rheight) *
kPiF;
62 sinTable[x] = sin(lon);
63 cosTable[x] = cos(lon);
66 for (
y = 0;
y < height;
y++) {
77 float cy = -sinTable[width * 3 / 4 - y];
78 float lac = -cosTable[width * 3 / 4 - y];
81 for (
x = 0;
x < width;
x++) {
82 float cx = sinTable[x] * lac;
83 float cz = cosTable[x] * lac;
95 if (ax >= ay && ax >= az) {
105 }
else if (ay >= ax && ay >= az) {
133 assert(ix < sourcePixMap.
width && iy < sourcePixMap.
width);
137 iy += sourcePixMap.
width * yOffset;
139 uint32_t* row = (uint32_t*)(srcBytes + iy * sourcePixMap.
rowBytes);
145 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)