Commit e9e33421 authored by Michael Natterer's avatar Michael Natterer 😴

app: turned an XCF debug patch I had into proper GIMP_LOG=xcf output

only for loading and incomplete, but a start.
parent 39f74017
......@@ -44,7 +44,8 @@ static const GDebugKey log_keys[] =
{ "instances", GIMP_LOG_INSTANCES },
{ "rectangle-tool", GIMP_LOG_RECTANGLE_TOOL },
{ "brush-cache", GIMP_LOG_BRUSH_CACHE },
{ "projection", GIMP_LOG_PROJECTION }
{ "projection", GIMP_LOG_PROJECTION },
{ "xcf", GIMP_LOG_XCF }
};
......
......@@ -40,7 +40,8 @@ typedef enum
GIMP_LOG_INSTANCES = 1 << 16,
GIMP_LOG_RECTANGLE_TOOL = 1 << 17,
GIMP_LOG_BRUSH_CACHE = 1 << 18,
GIMP_LOG_PROJECTION = 1 << 19
GIMP_LOG_PROJECTION = 1 << 19,
GIMP_LOG_XCF = 1 << 20
} GimpLogFlags;
......@@ -101,6 +102,7 @@ void gimp_logv (GimpLogFlags flags,
#define RECTANGLE_TOOL GIMP_LOG_RECTANGLE_TOOL
#define BRUSH_CACHE GIMP_LOG_BRUSH_CACHE
#define PROJECTION GIMP_LOG_PROJECTION
#define XCF GIMP_LOG_XCF
#if 0 /* last resort */
# define GIMP_LOG /* nothing => no varargs, no log */
......
......@@ -67,6 +67,7 @@
#include "xcf-read.h"
#include "xcf-seek.h"
#include "gimp-log.h"
#include "gimp-intl.h"
......@@ -202,6 +203,9 @@ xcf_load_image (Gimp *gimp,
}
}
GIMP_LOG (XCF, "version=%d, width=%d, height=%d, image_type=%d, precision=%d",
info->file_version, width, height, image_type, precision);
image = gimp_create_image (gimp, width, height, image_type, precision,
FALSE);
......@@ -213,6 +217,8 @@ xcf_load_image (Gimp *gimp,
if (! xcf_load_image_props (info, image))
goto hard_error;
GIMP_LOG (XCF, "image props loaded");
/* check for a GimpGrid parasite */
parasite = gimp_image_parasite_find (GIMP_IMAGE (image),
gimp_grid_parasite_name ());
......@@ -635,6 +641,8 @@ xcf_load_image_props (XcfInfo *info,
*/
if (gimp_image_get_base_type (image) == GIMP_INDEXED)
gimp_image_set_colormap (image, cmap, n_colors, FALSE);
GIMP_LOG (XCF, "prop colormap n_colors=%d", n_colors);
}
break;
......@@ -657,6 +665,8 @@ xcf_load_image_props (XcfInfo *info,
}
info->compression = compression;
GIMP_LOG (XCF, "prop compression=%d", compression);
}
break;
......@@ -679,6 +689,9 @@ xcf_load_image_props (XcfInfo *info,
if (position < 0)
continue;
GIMP_LOG (XCF, "prop guide orientation=%d position=%d",
orientation, position);
switch (orientation)
{
case XCF_ORIENTATION_HORIZONTAL:
......@@ -716,6 +729,8 @@ xcf_load_image_props (XcfInfo *info,
info->cp += xcf_read_int32 (info->input, (guint32 *) &x, 1);
info->cp += xcf_read_int32 (info->input, (guint32 *) &y, 1);
GIMP_LOG (XCF, "prop sample point x=%d y=%d", x, y);
gimp_image_add_sample_point_at_pos (image, x, y, FALSE);
}
}
......@@ -728,6 +743,8 @@ xcf_load_image_props (XcfInfo *info,
info->cp += xcf_read_float (info->input, &xres, 1);
info->cp += xcf_read_float (info->input, &yres, 1);
GIMP_LOG (XCF, "prop resolution x=%f y=%f", xres, yres);
if (xres < GIMP_MIN_RESOLUTION || xres > GIMP_MAX_RESOLUTION ||
yres < GIMP_MIN_RESOLUTION || yres > GIMP_MAX_RESOLUTION)
{
......@@ -747,6 +764,8 @@ xcf_load_image_props (XcfInfo *info,
case PROP_TATTOO:
{
info->cp += xcf_read_int32 (info->input, &info->tattoo_state, 1);
GIMP_LOG (XCF, "prop tattoo state=%d", info->tattoo_state);
}
break;
......@@ -791,6 +810,8 @@ xcf_load_image_props (XcfInfo *info,
info->cp += xcf_read_int32 (info->input, &unit, 1);
GIMP_LOG (XCF, "prop unit=%d", unit);
if ((unit <= GIMP_UNIT_PIXEL) ||
(unit >= gimp_unit_get_number_of_built_in_units ()))
{
......@@ -1354,6 +1375,9 @@ xcf_load_layer (XcfInfo *info,
info->cp += xcf_read_int32 (info->input, (guint32 *) &type, 1);
info->cp += xcf_read_string (info->input, &name, 1);
GIMP_LOG (XCF, "width=%d, height=%d, type=%d, name='%s'",
width, height, type, name);
switch (type)
{
case GIMP_RGB_IMAGE:
......@@ -1413,6 +1437,8 @@ xcf_load_layer (XcfInfo *info,
&text_layer_flags, &group_layer_flags))
goto error;
GIMP_LOG (XCF, "layer props loaded");
xcf_progress_update (info);
/* call the evil text layer hack that might change our layer pointer */
......@@ -1443,10 +1469,14 @@ xcf_load_layer (XcfInfo *info,
if (! xcf_seek_pos (info, hierarchy_offset, NULL))
goto error;
GIMP_LOG (XCF, "loading buffer");
if (! xcf_load_buffer (info,
gimp_drawable_get_buffer (GIMP_DRAWABLE (layer))))
goto error;
GIMP_LOG (XCF, "buffer loaded");
xcf_progress_update (info);
}
else
......@@ -1735,6 +1765,8 @@ xcf_load_level (XcfInfo *info,
XCF_TILE_WIDTH, XCF_TILE_HEIGHT,
i, &rect);
GIMP_LOG (XCF, "loading tile %d/%d", i + 1, ntiles);
/* read in the tile */
switch (info->compression)
{
......@@ -1760,6 +1792,8 @@ xcf_load_level (XcfInfo *info,
if (fail)
return FALSE;
GIMP_LOG (XCF, "loaded tile %d/%d", i + 1, ntiles);
/* restore the saved position so we'll be ready to
* read the next offset.
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment