| 1244 | #define VTK_VEC_DIV_2(intvector) (((intvector) >> 1) & 0x7F7F7F7F) |
| 1245 | |
| 1246 | void vtkParallelRenderManager::MagnifyImageLinear(vtkUnsignedCharArray* fullImage, |
| 1247 | const int fullImageSize[2], vtkUnsignedCharArray* reducedImage, const int reducedImageSize[2], |
| 1248 | const int fullImageViewport[4], const int reducedImageViewport[4]) |
| 1249 | { |
| 1250 | int xmag, ymag; |
| 1251 | int x, y; |
| 1252 | int srcComp = reducedImage->GetNumberOfComponents(); |
| 1253 | |
| 1254 | // Allocate full image so all pixels are on 4-byte integer boundaries. |
| 1255 | fullImage->SetNumberOfComponents(4); |
| 1256 | fullImage->SetNumberOfTuples(fullImageSize[0] * fullImageSize[1]); |
| 1257 | |
| 1258 | int destLeft, destBottom, destWidth, destHeight; |
| 1259 | if (fullImageViewport) |
| 1260 | { |
| 1261 | destLeft = fullImageViewport[0]; |
| 1262 | destBottom = fullImageViewport[1]; |
| 1263 | destWidth = fullImageViewport[2] - fullImageViewport[0]; |
| 1264 | destHeight = fullImageViewport[3] - fullImageViewport[1]; |
| 1265 | } |
| 1266 | else |
| 1267 | { |
| 1268 | destLeft = destBottom = 0; |
| 1269 | destWidth = fullImageSize[0]; |
| 1270 | destHeight = fullImageSize[1]; |
| 1271 | } |
| 1272 | |
| 1273 | int srcLeft, srcBottom, srcWidth, srcHeight; |
| 1274 | if (reducedImageViewport) |
| 1275 | { |
| 1276 | srcLeft = reducedImageViewport[0]; |
| 1277 | srcBottom = reducedImageViewport[1]; |
| 1278 | srcWidth = reducedImageViewport[2] - reducedImageViewport[0]; |
| 1279 | srcHeight = reducedImageViewport[3] - reducedImageViewport[1]; |
| 1280 | } |
| 1281 | else |
| 1282 | { |
| 1283 | srcLeft = srcBottom = 0; |
| 1284 | srcWidth = reducedImageSize[0]; |
| 1285 | srcHeight = reducedImageSize[1]; |
| 1286 | } |
| 1287 | |
| 1288 | // Guess x and y magnification. Round up to ensure we do not try to |
| 1289 | // read data from the image data that does not exist. |
| 1290 | xmag = (destWidth + srcWidth - 1) / srcWidth; |
| 1291 | ymag = (destHeight + srcHeight - 1) / srcHeight; |
| 1292 | |
| 1293 | // For speed, we only magnify by powers of 2. Round up to the nearest |
| 1294 | // power of 2 to ensure that the reduced image is large enough. |
| 1295 | int powOf2; |
| 1296 | for (powOf2 = 1; powOf2 < xmag; powOf2 <<= 1) |
| 1297 | { |
| 1298 | } |
| 1299 | xmag = powOf2; |
| 1300 | for (powOf2 = 1; powOf2 < ymag; powOf2 <<= 1) |
| 1301 | { |
| 1302 | } |
| 1303 | ymag = powOf2; |
no test coverage detected