| 972 | } |
| 973 | |
| 974 | ViewerInstance::ViewerRenderRetCode |
| 975 | ViewerInstance::getViewerRoIAndTexture(const RectD& rod, |
| 976 | const U64 viewerHash, |
| 977 | const bool useCache, |
| 978 | const bool isDraftMode, |
| 979 | const unsigned int mipmapLevel, |
| 980 | const RenderStatsPtr& stats, |
| 981 | ViewerArgs* outArgs) |
| 982 | { |
| 983 | // Roi is the coordinates of the 4 corners of the texture in the bounds with the current zoom |
| 984 | // factor taken into account. |
| 985 | |
| 986 | // When auto-contrast is enabled or user RoI, we compute exactly the image portion displayed in the rectangle and |
| 987 | // do not round it to Viewer tiles. |
| 988 | |
| 989 | outArgs->params->tiles.clear(); |
| 990 | outArgs->params->nbCachedTile = 0; |
| 991 | if (!useCache || outArgs->forceRender) { |
| 992 | outArgs->params->roi = _imp->uiContext->getExactImageRectangleDisplayed(outArgs->params->textureIndex, rod, outArgs->params->pixelAspectRatio, mipmapLevel); |
| 993 | outArgs->params->roiNotRoundedToTileSize = outArgs->params->roi; |
| 994 | |
| 995 | UpdateViewerParams::CachedTile tile; |
| 996 | if (outArgs->isDoingPartialUpdates) { |
| 997 | std::list<RectD> partialRects; |
| 998 | QMutexLocker k(&_imp->viewerParamsMutex); |
| 999 | partialRects = _imp->partialUpdateRects; |
| 1000 | for (std::list<RectD>::iterator it = partialRects.begin(); it != partialRects.end(); ++it) { |
| 1001 | RectI pixelRect; |
| 1002 | it->toPixelEnclosing(mipmapLevel, outArgs->params->pixelAspectRatio, &pixelRect); |
| 1003 | ///Intersect to the RoI |
| 1004 | if ( pixelRect.intersect(outArgs->params->roi, &pixelRect) ) { |
| 1005 | tile.rect.set(pixelRect); |
| 1006 | tile.rectRounded = pixelRect; |
| 1007 | tile.rect.closestPo2 = 1 << mipmapLevel; |
| 1008 | tile.rect.par = outArgs->params->pixelAspectRatio; |
| 1009 | tile.bytesCount = tile.rect.area() * 4; |
| 1010 | assert(tile.bytesCount > 0); |
| 1011 | if (outArgs->params->depth == eImageBitDepthFloat) { |
| 1012 | tile.bytesCount *= sizeof(float); |
| 1013 | } |
| 1014 | outArgs->params->tiles.push_back(tile); |
| 1015 | } |
| 1016 | } |
| 1017 | } else { |
| 1018 | if (!outArgs->params->roi.isNull()) { |
| 1019 | tile.rect.set(outArgs->params->roi); |
| 1020 | tile.rectRounded = outArgs->params->roi; |
| 1021 | tile.rect.closestPo2 = 1 << mipmapLevel; |
| 1022 | tile.rect.par = outArgs->params->pixelAspectRatio; |
| 1023 | tile.bytesCount = tile.rect.area() * 4; |
| 1024 | assert(tile.bytesCount > 0); |
| 1025 | if (outArgs->params->depth == eImageBitDepthFloat) { |
| 1026 | tile.bytesCount *= sizeof(float); |
| 1027 | } |
| 1028 | outArgs->params->tiles.push_back(tile); |
| 1029 | } |
| 1030 | } |
| 1031 |
nothing calls this directly
no test coverage detected