]> mj.ucw.cz Git - libucw.git/blobdiff - images/scale.c
rest of bbuf printf
[libucw.git] / images / scale.c
index 4eceac678a7a91e42e3e2f4c088cc21a64753951..2c351cbdcb6714d47e4a4f74a69bff680dbea3d3 100644 (file)
@@ -74,7 +74,7 @@ image_dimensions_fit_to_box(u32 *cols, u32 *rows, u32 max_cols, u32 max_rows, un
     {
       if (!upsample)
        return;
     {
       if (!upsample)
        return;
-      if (max_cols / *cols > max_rows / *rows)
+      if (max_cols * *rows > max_rows * *cols)
         {
          *cols = *cols * max_rows / *rows;
          *cols = MIN(*cols, max_cols);
         {
          *cols = *cols * max_rows / *rows;
          *cols = MIN(*cols, max_cols);
@@ -100,5 +100,4 @@ down_rows:
   *rows = *rows * max_cols / *cols;
   *rows = MAX(*rows, 1);
   *cols = max_cols;
   *rows = *rows * max_cols / *cols;
   *rows = MAX(*rows, 1);
   *cols = max_cols;
-  return;
 }
 }