plug-ins/common/psd.c don't hardcode unit conversion factors.

2005-09-22  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/psd.c
	* plug-ins/common/psd_save.c: don't hardcode unit conversion factors.
This commit is contained in:
Sven Neumann 2005-09-22 08:57:48 +00:00 committed by Sven Neumann
parent ea4ac4f94f
commit 06d80596ee
3 changed files with 25 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2005-09-22 Sven Neumann <sven@gimp.org>
* plug-ins/common/psd.c
* plug-ins/common/psd_save.c: don't hardcode unit conversion factors.
2005-09-21 Jay Cox <jaycox@gimp.org>
* plug-ins/common/psd.c: Load the resolution properly when it is

View File

@ -1844,17 +1844,21 @@ load_image (const gchar *name)
if (psd_image.resolution_is_set)
{
if (psd_image.resolution.widthUnit == 2) /* px/cm */
{
psd_image.resolution.hRes *= 2.54;
psd_image.resolution.vRes *= 2.54;
}
gimp_image_set_resolution(image_ID,
psd_image.resolution.hRes / 65536.0,
psd_image.resolution.vRes / 65536.0);
{
gdouble factor = gimp_unit_get_factor (GIMP_UNIT_MM) / 10.0;
psd_image.resolution.hRes *= factor;
psd_image.resolution.vRes *= factor;
}
gimp_image_set_resolution (image_ID,
psd_image.resolution.hRes / 65536.0,
psd_image.resolution.vRes / 65536.0);
/* currently can only set one unit for the image so we use the
horizontal unit from the psd image */
gimp_image_set_unit(image_ID,
psd_unit_to_gimp_unit (psd_image.resolution.widthUnit));
gimp_image_set_unit (image_ID,
psd_unit_to_gimp_unit (psd_image.resolution.widthUnit));
}
fgetpos (fd, &tmpfpos);

View File

@ -784,12 +784,16 @@ save_resources (FILE *fd, gint32 image_id)
GimpUnit g_unit;
gshort psd_unit;
g_unit = gimp_image_get_unit(image_id);
gimp_image_get_resolution(image_id, &xres, &yres);
g_unit = gimp_image_get_unit (image_id);
gimp_image_get_resolution (image_id, &xres, &yres);
if (g_unit == GIMP_UNIT_MM)
{
xres /= 2.54; yres /= 2.54;
gdouble factor = gimp_unit_get_factor (g_unit) / 10.0;
xres /= factor;
yres /= factor;
psd_unit = PSD_UNIT_CM;
}
else