31 || light->region.projection_roi.Area() <= 0) {
39 int xl = light->region.projection_roi.x;
40 int yt = light->region.projection_roi.y;
41 int xr = xl + light->region.projection_roi.width - 1;
42 int yb = yt + light->region.projection_roi.height - 1;
45 int center_x = (xr + xl) / 2;
46 int center_y = (yb + yt) / 2;
47 int resize =
static_cast<int>(
49 *
static_cast<float>(std::max(light->region.projection_roi.width, light->region.projection_roi.height)));
51 resize = std::max(resize, min_crop_size_);
52 resize = std::min(resize, width);
53 resize = std::min(resize, height);
56 xl = center_x - resize / 2 + 1;
57 xl = (xl < 0) ? 0 : xl;
58 yt = center_y - resize / 2 + 1;
59 yt = (yt < 0) ? 0 : yt;
74 crop_box->
width = xr - xl + 1;
75 crop_box->
height = yb - yt + 1;