- for(int i = 0; i < get_total_packages(); i++)
- {
- MaskPackage *ptr = (MaskPackage*)get_package(i);
-
- ptr->start_y = output->get_h() * i / get_total_packages();
- ptr->end_y = output->get_h() * (i + 1) / get_total_packages();
-
- ptr->start_x = output->get_w() * i / get_total_packages();
- ptr->end_x = output->get_w() * (i + 1) / get_total_packages();
+ while( i < n ) {
+ MaskPackage *ptr = (MaskPackage*)get_package(i++);
+ int x1 = (out_w * i) / n, y1 = (out_h * i) / n;
+ ptr->start_x = x0; ptr->end_x = x1;
+ ptr->start_y = y0; ptr->end_y = y1;
+ x0 = x1; y0 = y1;