- /* Iterate through multiples of mod to find one close to job->width. */
- for( i = 1;; i++ )
- {
- w = mod * i;
-
- if (w < width)
- {
- if ( ( width - w ) <= ( mod / 2 ) )
- /* We'll take a width that's
- smaller, but close enough. */
- break;
- }
- if (w == width)
- /* Mod 16 dimensions, how nice! */
- break;
- if( w > width )
- {
- if ( ( w - width ) < (mod/2) )
- /* We'll take a width that's bigger, if we have to. */
- break;
- }
- }
- width = mod * (i);
-
- /* Now do the same for a mod-friendly value near job->height. */
- for( i = 1;; i++)
- {
- h = i * mod;
-
- if (h < height)
- {
- if ( ( height - h ) <= ( mod / 2 ))
- /* Go with a smaller height,
- if it's close enough. */
- break;
- }
- if (h == height)
- /* Mod 16 dimensions, how nice! */
- break;
-
- if ( h > height)
- {
- if ( ( h - height ) < ( mod / 2 ))
- /* Use a taller height if necessary */
- break;
- }
- }
- height = mod * (i);
+ /* Time to get picture dimensions that divide cleanly.*/
+ width = MULTIPLE_MOD( width, mod);
+ height = MULTIPLE_MOD( height, mod);