Skip to content

Commit 48582ae

Browse files
committed
Crop: fix getRegionsOfInterest.
Use the same intersecting function so that bugs are not duplicated. Also this is wrong, don't use the reformat in getRegionsOfInterest! We don't want to fetch the rectangle from (0,0) in the source image.
1 parent 08424b7 commit 48582ae

File tree

1 file changed

+3
-19
lines changed

1 file changed

+3
-19
lines changed

Crop/Crop.cpp

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -398,28 +398,12 @@ CropPlugin::setupAndProcess(CropProcessorBase &processor, const OFX::RenderArgum
398398
void
399399
CropPlugin::getRegionsOfInterest(const OFX::RegionsOfInterestArguments &args, OFX::RegionOfInterestSetter &rois)
400400
{
401-
bool reformat;
402-
_reformat->getValueAtTime(args.time, reformat);
401+
403402
OfxRectD cropRect;
404403
getCropRectangle_canonical(args.time, false, true, cropRect);
405-
if (reformat) {
406-
// translate, because cropRect will be rendered at (0,0) in this case
407-
OfxRectD roi = args.regionOfInterest;
408-
roi.x1 += cropRect.x1;
409-
roi.y1 += cropRect.y1;
410-
roi.x2 += cropRect.x2;
411-
roi.y2 += cropRect.y2;
412-
}
404+
413405
// intersect the crop rectangle with args.regionOfInterest
414-
cropRect.x1 = std::max(cropRect.x1, args.regionOfInterest.x1);
415-
// the region must be *at least* empty, thus the maximin.
416-
cropRect.x2 = std::max(cropRect.x1,std::min(cropRect.x2, args.regionOfInterest.x2));
417-
cropRect.y1 = std::max(cropRect.y1, args.regionOfInterest.y1);
418-
// the region must be *at least* empty, thus the maximin.
419-
cropRect.y2 = std::max(cropRect.y1,std::min(cropRect.y2, args.regionOfInterest.y2));
420-
421-
// set it on the mask only if we are in an interesting context
422-
// (i.e. eContextGeneral or eContextPaint, see Support/Plugins/Basic)
406+
MergeImages2D::rectangleIntersect(cropRect, args.regionOfInterest, &cropRect);
423407
rois.setRegionOfInterest(*srcClip_, cropRect);
424408
}
425409

0 commit comments

Comments
 (0)