| 1710 | } |
| 1711 | |
| 1712 | bool |
| 1713 | ImageStatisticsPlugin::computeWindow(const Image* srcImg, |
| 1714 | const OfxPointD& renderScale, |
| 1715 | double time, |
| 1716 | OfxRectI *analysisWindow) |
| 1717 | { |
| 1718 | OfxRectD regionOfInterest; |
| 1719 | bool restrictToRectangle = _restrictToRectangle->getValueAtTime(time); |
| 1720 | |
| 1721 | if (!restrictToRectangle && _srcClip) { |
| 1722 | // use the src region of definition as rectangle, but avoid infinite rectangle |
| 1723 | regionOfInterest = _srcClip->getRegionOfDefinition(time); |
| 1724 | OfxPointD size = getProjectSize(); |
| 1725 | OfxPointD offset = getProjectOffset(); |
| 1726 | if (regionOfInterest.x1 <= kOfxFlagInfiniteMin) { |
| 1727 | regionOfInterest.x1 = offset.x; |
| 1728 | } |
| 1729 | if (regionOfInterest.x2 >= kOfxFlagInfiniteMax) { |
| 1730 | regionOfInterest.x2 = offset.x + size.x; |
| 1731 | } |
| 1732 | if (regionOfInterest.y1 <= kOfxFlagInfiniteMin) { |
| 1733 | regionOfInterest.y1 = offset.y; |
| 1734 | } |
| 1735 | if (regionOfInterest.y2 >= kOfxFlagInfiniteMax) { |
| 1736 | regionOfInterest.y2 = offset.y + size.y; |
| 1737 | } |
| 1738 | } else { |
| 1739 | _btmLeft->getValueAtTime(time, regionOfInterest.x1, regionOfInterest.y1); |
| 1740 | _size->getValueAtTime(time, regionOfInterest.x2, regionOfInterest.y2); |
| 1741 | regionOfInterest.x2 += regionOfInterest.x1; |
| 1742 | regionOfInterest.y2 += regionOfInterest.y1; |
| 1743 | } |
| 1744 | Coords::toPixelEnclosing(regionOfInterest, |
| 1745 | renderScale, |
| 1746 | srcImg->getPixelAspectRatio(), |
| 1747 | analysisWindow); |
| 1748 | |
| 1749 | return Coords::rectIntersection(*analysisWindow, srcImg->getBounds(), analysisWindow); |
| 1750 | } |
| 1751 | |
| 1752 | // update image statistics |
| 1753 | void |
nothing calls this directly
no test coverage detected