[gimp/soc-2009-siox-drb] 7.5 debug
- From: Jie Ding <jieding src gnome org>
- To: svn-commits-list gnome org
- Subject: [gimp/soc-2009-siox-drb] 7.5 debug
- Date: Sun, 5 Jul 2009 08:46:39 +0000 (UTC)
commit 5af8481c6725e9a079bc655d28ca38d5f1a0f25a
Author: Jie Ding <jieding src gnome org>
Date: Sun Jul 5 16:44:08 2009 +0800
7.5 debug
app/base/base-enums.h | 4 +-
app/base/siox.c | 60 ++++++++++++++++---
app/base/siox.h | 4 +-
app/core/gimpdrawable-foreground-extract.c | 14 ++--
app/core/gimpdrawable-foreground-extract.h | 5 +-
app/tools/gimpforegroundselecttool.c | 90 ++++++++++++++++++---------
app/tools/gimpforegroundselecttool.h | 1 -
7 files changed, 126 insertions(+), 52 deletions(-)
---
diff --git a/app/base/base-enums.h b/app/base/base-enums.h
index 36426c5..34c532c 100644
--- a/app/base/base-enums.h
+++ b/app/base/base-enums.h
@@ -130,7 +130,6 @@ typedef enum /*< pdb-skip, skip >*/
SIOX_REFINEMENT_CHANGE_SENSITIVITY = (1 << 2),
SIOX_REFINEMENT_CHANGE_SMOOTHNESS = (1 << 3),
SIOX_REFINEMENT_CHANGE_MULTIBLOB = (1 << 4),
- SIOX_REFINEMENT_CHANGE_THRESHOLD = (1 << 5),/* threshold */
SIOX_REFINEMENT_RECALCULATE = 0xFF
} SioxRefinementType;
typedef enum /*< pdb-skip, skip >*///(new)
@@ -138,6 +137,9 @@ typedef enum /*< pdb-skip, skip >*///(new)
SIOX_DRB_NO_CHANGE = 0,
SIOX_DRB_ADD = (1 << 0),
SIOX_DRB_SUBTRACT = (1 << 1),
+ SIOX_DRB_CHANGE_THRESHOLD = (1 << 2),/* threshold */
+ SIOX_DRB_CHANGE_SENSITIVITY = (1 << 3),
+ SIOX_DRB_CHANGE_SMOOTHNESS = (1 << 4),
SIOX_DRB_RECALCULATE = 0xFF
} SioxDRBType;
diff --git a/app/base/siox.c b/app/base/siox.c
index fcf8779..de111ae 100644
--- a/app/base/siox.c
+++ b/app/base/siox.c
@@ -50,6 +50,7 @@
#include "tile-manager.h"
#include "siox.h"
+#include "tile-manager-private.h"
/* Thresholds in the mask:
* pixels < SIOX_LOW are known background
@@ -103,8 +104,8 @@ struct _SioxState
gint xsbpp;
};
-//static SioxState *drbstate;//
-//static TileManager *drbmask;//
+static SioxState *drbstate;//
+static TileManager *drbmask;//
/* A struct that holds the classification result */
typedef struct
@@ -785,7 +786,7 @@ siox_init (TileManager *pixels,
(GDestroyNotify) siox_cache_entry_free);
cpercep_init ();
-
+printf("offset_x=%d, offset_y=%d,x=%d, y=%d, width=%d, height=%d,state->bgsiglen=%d,state->fgsiglen=%d\n", offset_x, offset_y, x, y, width, height, state->bgsiglen, state->fgsiglen);
#ifdef SIOX_DEBUG
g_printerr ("siox.c: siox_init (bpp=%d, "
"x=%d, y=%d, width=%d, height=%d, offset_x=%d, offset_y=%d)\n",
@@ -834,6 +835,12 @@ siox_foreground_extract (SioxState *state,
gpointer progress_data)
{
//if(!drbsignal)
+ printf("siox_start====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
+ "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d\n",
+ state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);
+ printf("siox_mask_start====mask->ref_count=%d,mask->x=%d,mask->y=%d,mask->width=%d,mask->height=%d,mask->ntile_rows=%d"
+ "mask->ntile_cols=%d,mask->cached_num=%d\n",
+ mask->ref_count,mask->x,mask->y,mask->width,mask->height,mask->ntile_rows,mask->ntile_cols,mask->cached_num);
printf("siox_foreground_extract \n");
PixelRegion srcPR;
PixelRegion mapPR;
@@ -892,10 +899,13 @@ siox_foreground_extract (SioxState *state,
else
{
if (! state->bgsig)
- refinement |= SIOX_REFINEMENT_ADD_BACKGROUND;
-
+ {printf("siox_foreground_extract/!state->bgsig");
+ refinement |= SIOX_REFINEMENT_ADD_BACKGROUND;
+ }
if (! state->fgsig)
+ {printf("siox_foreground_extract/!state->fgsig");
refinement |= SIOX_REFINEMENT_ADD_FOREGROUND;
+ }
}
@@ -1296,6 +1306,12 @@ printf("siox_foreground_extract/dilate, to fill up boundary pixels killed by ero
brush_radius,brush_mode,
threshold);
} */
+printf("siox_end====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
+ "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d",
+ state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);
+ printf("siox_mask_end====mask->ref_count=%d,mask->x=%d,mask->y=%d,mask->width=%d,mask->height=%d,mask->ntile_rows=%d"
+ "mask->ntile_cols=%d,mask->cached_num=%d\n",mask->ref_count,mask->x,mask->y,mask->width,
+ mask->height,mask->ntile_rows,mask->ntile_cols,mask->cached_num);
}
@@ -1325,18 +1341,41 @@ siox_drb (SioxState *state,
gint x,
gint y,
gint brush_radius,
- gint brush_mode,
+ SioxDRBType optionsrefinement,//
+ //gint brush_mode,
gfloat threshold,
gpointer progress_data)//
{printf("siox_drb\n");
+ printf("drb_start====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
+ "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d",
+ state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);
PixelRegion srcPR;
PixelRegion mapPR;
gpointer pr;
gint row, col;
-
+ gint brush_mode;//
+ //state = drbstate;//
+ //mask = drbmask;//
+ printf("brush_mode before");
+ brush_mode |= (optionsrefinement ?
+ SIOX_DRB_ADD :
+ SIOX_DRB_SUBTRACT); //
+ printf("brush_mode after");
g_return_if_fail (state != NULL);
g_return_if_fail (mask != NULL && tile_manager_bpp (mask) == 1);
+/* if (drbrefinement & SIOX_DRB_ADD)
+ g_hash_table_foreach_remove(state->cache,siox_cache_remove_bg,NULL);
+ if (drbrefinement & SIOX_DRB_SUBTRACT)
+ g_hash_table_foreach_remove(state->cache,siox_cache_remove_fg,NULL);
+ if (drbrefinement & SIOX_DRB_CHANGE_THRESHOLD)
+ {
+ drbrefinement = SIOX_DRB_RECALCULATE;
+ }
+ else
+ {
+
+ }*/
pixel_region_init (&srcPR, state->pixels,
x - brush_radius, y - brush_radius, brush_radius * 2,
brush_radius * 2, FALSE);
@@ -1423,6 +1462,12 @@ siox_drb (SioxState *state,
map += mapPR.rowstride;
}
}
+ printf("drb_start====state->offset_x=%d,state->offset_y=%d,state->x = %d,state->y=%d,"
+ "state->width=%d,state->height=%d,state->bgsiglen=%d,state->fgsiglen=%d",
+ state->offset_x,state->offset_y,state->x,state->y,state->width,state->height,state->bgsiglen,state->fgsiglen);
+ printf("siox_drb_end====mask->ref_count=%d,mask->x=%d,mask->y=%d,mask->width=%d,mask->height=%d,mask->ntile_rows=%d"
+ "mask->ntile_cols=%d,mask->cached_num=%d\n",mask->ref_count,mask->x,mask->y,mask->width,
+ mask->height,mask->ntile_rows,mask->ntile_cols,mask->cached_num);
}
/**
@@ -1446,4 +1491,3 @@ siox_done (SioxState *state)
g_printerr ("siox.c: siox_done()\n");
#endif
}
-
diff --git a/app/base/siox.h b/app/base/siox.h
index 15cbee7..c207c64 100644
--- a/app/base/siox.h
+++ b/app/base/siox.h
@@ -83,11 +83,11 @@ void siox_drb (SioxState *state,
gint x,
gint y,
gint brush_radius,
- gint brush_mode,
+ SioxDRBType optionsrefinement,//
+ //gint brush_mode,
gfloat threshold,
// SioxProgressFunc progress_callback,//
gpointer progress_data);//(new)
#endif /* __SIOX_H__ */
-
diff --git a/app/core/gimpdrawable-foreground-extract.c b/app/core/gimpdrawable-foreground-extract.c
index 5556b85..f7495f8 100644
--- a/app/core/gimpdrawable-foreground-extract.c
+++ b/app/core/gimpdrawable-foreground-extract.c
@@ -123,7 +123,7 @@ gimp_drawable_foreground_extract_siox (GimpDrawable *mask,
SioxRefinementType refinement,
gint smoothness,
gfloat sioxdrbthreshold,//(new)
- gboolean sioxdrboption,//(new)
+ SioxDRBType sioxdrboption,//(new)
const gdouble sensitivity[3],
gboolean multiblob,
gboolean drbsignal,//(new)
@@ -191,16 +191,16 @@ gimp_drawable_foreground_extract_siox_done (SioxState *state)
void //(new)
gimp_drawable_foreground_extract_siox_drb(GimpDrawable *mask,
SioxState *state,
- gboolean optionsrefinement,
- gfloat optionsthreshold,//( should be float)
+ SioxDRBType optionsrefinement,
+ gfloat optionsthreshold,//( should be float)
gint radius,
GimpProgress *progress)
{printf("gimp_drawable_foreground_extract_siox_drb\n");
- gint brush_mode;
+ /*gint brush_mode;
brush_mode |= (optionsrefinement ?
SIOX_DRB_ADD :
SIOX_DRB_SUBTRACT);
-
+ */
gint x = (state->x);
gint y = (state->y);
@@ -208,7 +208,8 @@ gimp_drawable_foreground_extract_siox_drb(GimpDrawable *mask,
mask,//
x,y,
radius,
- brush_mode, //
+ optionsrefinement,//
+ //brush_mode, //
optionsthreshold,
progress);
@@ -272,4 +273,3 @@ siox_foreground_drb (SioxState *state,
}*/
-
diff --git a/app/core/gimpdrawable-foreground-extract.h b/app/core/gimpdrawable-foreground-extract.h
index 133f5be..ecf629c 100644
--- a/app/core/gimpdrawable-foreground-extract.h
+++ b/app/core/gimpdrawable-foreground-extract.h
@@ -38,7 +38,7 @@ void gimp_drawable_foreground_extract_siox (GimpDrawable *mask,
SioxRefinementType refinemane,
gint smoothness,
gfloat sioxdrbthreshold,//(new)
- gboolean sioxdrboption,//(new)
+ SioxDRBType sioxdrboption,//(new)
const gdouble sensitivity[3],
gboolean multiblob,
gboolean drbsignal,//
@@ -48,7 +48,7 @@ void gimp_drawable_foreground_extract_siox_done (SioxState *state);
void gimp_drawable_foreground_extract_siox_drb(GimpDrawable *mask,//(new)
SioxState *state,
- gboolean optionsrefinement,
+ SioxDRBType optionsrefinement,
gfloat optionsthreshold,//( should be float)
gint radius,
GimpProgress *progress);
@@ -61,4 +61,3 @@ void siox_foreground_drb (SioxState *state,//(new)
gint brushradius,
gfloat threshold);//(new)*/
#endif /* __GIMP_DRAWABLE_FOREGROUND_EXTRACT_H__ */
-
diff --git a/app/tools/gimpforegroundselecttool.c b/app/tools/gimpforegroundselecttool.c
index 107870f..45083d5 100644
--- a/app/tools/gimpforegroundselecttool.c
+++ b/app/tools/gimpforegroundselecttool.c
@@ -58,7 +58,7 @@ typedef struct
{
gint width;
gboolean background;
- gboolean drbrefinement;
+ // gboolean drbrefinement;
gint num_points;
GimpVector2 *points;
} FgSelectStroke;
@@ -452,7 +452,7 @@ gimp_foreground_select_tool_key_press (GimpTool *tool,
{mark_drb = TRUE;
printf("click Up\n");
- G_CALLBACK (gimp_foreground_select_options_notify);
+ G_CALLBACK (gimp_foreground_select_options_notify);////?(������)
return TRUE;
}
@@ -491,17 +491,19 @@ gimp_foreground_select_tool_button_press (GimpTool *tool,
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (tool);
if (fg_select->mask &&(!mark_drb))//
- {
+ {printf("button press/ fg_select->mask\n");
GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
gimp_draw_tool_pause (draw_tool);
if (gimp_draw_tool_is_active (draw_tool) && draw_tool->display != display)
- gimp_draw_tool_stop (draw_tool);
-
+ { printf("gimp_foreground_select_tool_button_press/gimp_draw_tool_is_active\n");
+ gimp_draw_tool_stop (draw_tool);
+ }
if (! gimp_tool_control_is_active (tool->control))
- gimp_tool_control_activate (tool->control);
-
+ {printf("gimp_foreground_select_tool_button_press/! gimp_tool_control_is_active \n");
+ gimp_tool_control_activate (tool->control);
+ }
fg_select->last_coords = *coords;
g_return_if_fail (fg_select->stroke == NULL);
@@ -510,14 +512,15 @@ gimp_foreground_select_tool_button_press (GimpTool *tool,
g_array_append_val (fg_select->stroke, point);
if (! gimp_draw_tool_is_active (draw_tool))
- gimp_draw_tool_start (draw_tool, display);
-
+ {printf("gimp_foreground_select_tool_button_press/! gimp_tool_control_is_active /tool/start \n");
+ gimp_draw_tool_start (draw_tool, display);
+ }
gimp_draw_tool_resume (draw_tool);
}
else if (fg_select->mask && mark_drb)//
{
GimpVector2 point = gimp_vector2_new (coords->x, coords->y);
- printf("----------------------drb brush");
+ printf("----------------------drb brush\n");
gimp_draw_tool_pause (draw_tool);
if (gimp_draw_tool_is_active (draw_tool) && draw_tool->display != display)//?
@@ -590,7 +593,7 @@ gimp_foreground_select_tool_button_release (GimpTool *tool,
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
else
- {
+ {printf("(parent_class)->button_release\n");
GIMP_TOOL_CLASS (parent_class)->button_release (tool,
coords, time, state,
release_type,
@@ -612,9 +615,9 @@ gimp_foreground_select_tool_motion (GimpTool *tool,
GimpVector2 *last = &g_array_index (fg_select->stroke,
GimpVector2,
fg_select->stroke->len - 1);
-
+
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
-
+ printf("gimp_foreground_select_tool_motion/gimp_draw_tool_pause");
fg_select->last_coords = *coords;
if (last->x != (gint) coords->x || last->y != (gint) coords->y)
@@ -701,7 +704,7 @@ gimp_foreground_select_tool_draw (GimpDrawTool *draw_tool)
GIMP_CONTEXT (options),
(options->refinement ?
GIMP_ACTIVE_COLOR_BACKGROUND :
- GIMP_ACTIVE_COLOR_BACKGROUND),
+ GIMP_ACTIVE_COLOR_BACKGROUND),//???????
options->stroke_width);
}
if (fg_select->mask)
@@ -782,7 +785,7 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
mask = gimp_channel_new (image,
gimp_image_get_width (image),
gimp_image_get_height (image),
- "foreground-extraction", NULL);
+ "foreground-extraction", NULL);//????????
gimp_scan_convert_render_value (scan_convert,
gimp_drawable_get_tiles (GIMP_DRAWABLE (mask)),
@@ -890,7 +893,7 @@ gimp_foreground_select_tool_set_mask (GimpForegroundSelectTool *fg_select,
gimp_tool_control_set_toggled (tool->control, options->background);
}
else if (mask && mark_drb)//(new)
- {printf("gimp_foreground_select_tool_set_mask if (mask && fg_select->drbsignal)\n");
+ {printf("gimp_foreground_select_tool_set_mask if (mask && mark_drb)\n");
gimp_tool_control_set_tool_cursor (tool->control,
GIMP_TOOL_CURSOR_PAINTBRUSH);
gimp_tool_control_set_toggle_tool_cursor (tool->control,
@@ -937,7 +940,7 @@ gimp_foreground_select_tool_stroke (GimpChannel *mask,
{printf("gimp_foreground_select_tool_stroke \n");
GimpScanConvert *scan_convert = gimp_scan_convert_new ();
- if (stroke->num_points == 1)
+ if (stroke->num_points == 1)//(è¿?é??æ??ä¹?ç??解ï¼?)
{
GimpVector2 points[2];
@@ -995,7 +998,7 @@ else
stroke = g_slice_new (FgSelectStroke);
- stroke->drbrefinement = options->refinement;
+ stroke->background = options->refinement;//
stroke->width = ROUND ((gdouble) options->stroke_width / shell->scale_y);
stroke->num_points = fg_select->drbsignal->len;
stroke->points = (GimpVector2 *) g_array_free (fg_select->drbsignal, FALSE);
@@ -1004,7 +1007,7 @@ else
fg_select->drbsignals = g_list_append (fg_select->drbsignals, stroke);
- fg_select->drbrefinement |= (stroke->drbrefinement?
+ fg_select->drbrefinement |= (stroke->background?
SIOX_DRB_ADD :
SIOX_DRB_SUBTRACT);
}
@@ -1029,28 +1032,45 @@ gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
GimpForegroundSelectTool *fg_select)
{printf("gimp_foreground_select_options_notify \n");
SioxRefinementType refinement = 0;
-
- if (! fg_select->mask)
+ SioxDRBType drbrefinement = 0; //
+ if(!mark_drb)
+ { if (! fg_select->mask)
return;
if (strcmp (pspec->name, "smoothness") == 0)
- {
+ {printf("_notify smoothness\n");
refinement = SIOX_REFINEMENT_CHANGE_SMOOTHNESS;
}
else if (strcmp (pspec->name, "contiguous") == 0)
- {
+ {printf("_notify contiguous\n");
refinement = SIOX_REFINEMENT_CHANGE_MULTIBLOB;
}
else if (g_str_has_prefix (pspec->name, "sensitivity"))
- {
+ {printf("_notify ssensitivity\n");
refinement = SIOX_REFINEMENT_CHANGE_SENSITIVITY;
}
- else if (strcmp (pspec->name, "threshold"))//(new)
- {
- refinement = SIOX_REFINEMENT_CHANGE_THRESHOLD;
- }
+ }
+ else//
+ {
+ if (! fg_select->mask)
+ return;
+ if (strcmp (pspec->name, "threshold") == 0)//(new)
+ {
+ printf("_notify threshold\n");
+ drbrefinement = SIOX_DRB_CHANGE_THRESHOLD;
+ }
+ else if (strcmp (pspec->name, "smoothness") == 0)
+ {printf("_notify smoothness\n");
+ drbrefinement = SIOX_DRB_CHANGE_SMOOTHNESS;
+ }
+ else if (g_str_has_prefix (pspec->name, "sensitivity"))
+ {printf("_notify ssensitivity\n");
+ drbrefinement = SIOX_DRB_CHANGE_SENSITIVITY;
+ }
+
+ }
if (refinement)
- {
+ {printf("_notify if (refinement)\n");
fg_select->refinement |= refinement;
if (fg_select->idle_id)
@@ -1061,7 +1081,18 @@ gimp_foreground_select_options_notify (GimpForegroundSelectOptions *options,
(GSourceFunc) gimp_foreground_select_tool_idle_select,
fg_select, NULL);
}
+ if (drbrefinement)
+ {printf("_notify if (refinement)\n");
+ fg_select->drbrefinement |= drbrefinement;
+
+ if (fg_select->idle_id)
+ g_source_remove (fg_select->idle_id);
+ fg_select->idle_id =
+ g_idle_add_full (G_PRIORITY_LOW,
+ (GSourceFunc) gimp_foreground_select_tool_idle_select,
+ fg_select, NULL);
+ }
if (g_str_has_prefix (pspec->name, "mask-color"))
{
GimpTool *tool = GIMP_TOOL (fg_select);
@@ -1082,4 +1113,3 @@ gimp_foreground_select_tool_push_drbsignal (GimpForegroundSelectTool *fg_sele
{
}*/
-
diff --git a/app/tools/gimpforegroundselecttool.h b/app/tools/gimpforegroundselecttool.h
index c7ae30c..730c821 100644
--- a/app/tools/gimpforegroundselecttool.h
+++ b/app/tools/gimpforegroundselecttool.h
@@ -64,4 +64,3 @@ GType gimp_foreground_select_tool_get_type (void) G_GNUC_CONST;
#endif /* __GIMP_FOREGROUND_SELECT_TOOL_H__ */
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]