File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
SerialPrograms/Source/CommonFramework/ImageTools Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -108,13 +108,19 @@ size_t ImagePixelBox::distance_to_point_y(const size_t y) const{
108108}
109109// The distance from the box center to a point on x axis
110110size_t ImagePixelBox::center_distance_to_point_x (const size_t x) const {
111- size_t d = center_x () - x;
112- return d > 0 ? d : -d;
111+ const size_t cx = center_x ();
112+ if (cx >= x){
113+ return cx - x;
114+ }
115+ return x - cx;
113116}
114117// The distance from the box center to a point on y axis
115118size_t ImagePixelBox::center_distance_to_point_y (const size_t y) const {
116- size_t d = center_y () - y;
117- return d > 0 ? d : -d;
119+ const size_t cy = center_y ();
120+ if (cy >= y){
121+ return cy - y;
122+ }
123+ return y - cy;
118124}
119125
120126
You can’t perform that action at this time.
0 commit comments