]> granicus.if.org Git - handbrake/commitdiff
MacGui: fix picture sizing issue in presets where creating a preset using an HD sourc...
authordynaflash <dynaflashtech@gmail.com>
Thu, 7 Feb 2008 18:39:05 +0000 (18:39 +0000)
committerdynaflash <dynaflashtech@gmail.com>
Thu, 7 Feb 2008 18:39:05 +0000 (18:39 +0000)
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@1252 b64f7644-9d1e-0410-96f1-a4d463321fa5

macosx/Controller.mm

index 769f4039aca23d0841f503a959ea0f61ef503aa2..d8ce1bfd921fe9360f8bd5ef7f9ceb801ec26696 100644 (file)
@@ -3422,8 +3422,19 @@ if (item == nil)
             }
             else // /* If not 0 or 2 we assume objectForKey:@"UsesPictureSettings is 1 which is "Use picture sizing from when the preset was set" */
             {
-                job->width = [[chosenPreset objectForKey:@"PictureWidth"]  intValue];
-                job->height = [[chosenPreset objectForKey:@"PictureHeight"]  intValue];
+                /* we check to make sure the presets width/height does not exceed the sources width/height */
+                if (fTitle->width < [[chosenPreset objectForKey:@"PictureWidth"]  intValue] || fTitle->height < [[chosenPreset objectForKey:@"PictureHeight"]  intValue])
+                {
+                    /* if so, then we use the sources height and width to avoid scaling up */
+                    job->width = fTitle->width;
+                    job->height = fTitle->height;
+                }
+                else // source width/height is >= the preset height/width
+                {
+                    /* we can go ahead and use the presets values for height and width */
+                    job->width = [[chosenPreset objectForKey:@"PictureWidth"]  intValue];
+                    job->height = [[chosenPreset objectForKey:@"PictureHeight"]  intValue];
+                }
                 job->keep_ratio = [[chosenPreset objectForKey:@"PictureKeepRatio"]  intValue];
                 if (job->keep_ratio == 1)
                 {