summaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-05-04 17:18:06 +0000
committerjstebbins <[email protected]>2009-05-04 17:18:06 +0000
commit81a21fb85217ac2a91c057f9896d1964c26d46c4 (patch)
treec91dad51bc35c069c40705c5410ca8a23fbc3571 /gtk
parent3d687432603f2c1905c5f10de0a7a8144806ef9a (diff)
LinGui: tweaks to appearance of visible crop borders
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2379 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk')
-rw-r--r--gtk/src/callbacks.c5
-rw-r--r--gtk/src/hb-backend.c40
2 files changed, 28 insertions, 17 deletions
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 541d8863f..184f8e35c 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1515,7 +1515,7 @@ crop_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
G_MODULE_EXPORT void
display_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("scale_changed_cb ()");
+ g_debug("display_width_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
ghb_clear_presets_selection(ud);
@@ -1541,7 +1541,7 @@ display_width_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
void
display_height_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
- g_debug("scale_changed_cb ()");
+ g_debug("display_height_changed_cb ()");
ghb_widget_to_setting(ud->settings, widget);
ghb_check_dependency(ud, widget);
ghb_clear_presets_selection(ud);
@@ -2224,6 +2224,7 @@ ghb_timer_cb(gpointer data)
}
if (update_preview)
{
+ g_debug("Updating preview\n");
ghb_set_preview_image (ud);
update_preview = FALSE;
}
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index 80d85bee8..93f3d3408 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -3976,22 +3976,30 @@ hash_pixbuf(
gint step,
gint orientation)
{
- gint ii;
+ gint ii, jj;
+ gint line_width = 8;
+ struct
+ {
+ guint8 r;
+ guint8 g;
+ guint8 b;
+ } c[4] =
+ {{0x80, 0x80, 0x80},{0xC0, 0x80, 0x70},{0x80, 0xA0, 0x80},{0x70, 0x80, 0xA0}};
if (!orientation)
{
// vertical lines
- for (ii = x; ii < x+w; ii += step)
+ for (ii = x, jj = 0; ii+line_width < x+w; ii += step, jj++)
{
- vert_line(pb, 0x80, 0x80, 0x80, ii, y, h, 4);
+ vert_line(pb, c[jj&3].r, c[jj&3].g, c[jj&3].b, ii, y, h, line_width);
}
}
else
{
// horizontal lines
- for (ii = y; ii < y+h; ii += step)
+ for (ii = y, jj = 0; ii+line_width < y+h; ii += step, jj++)
{
- horz_line(pb, 0x80, 0x80, 0x80, x, ii, w, 4);
+ horz_line(pb, c[jj&3].r, c[jj&3].g, c[jj&3].b, x, ii, w, line_width);
}
}
}
@@ -4119,26 +4127,28 @@ ghb_get_preview_image(
dstHeight = s_h * factor / 100;
dstWidth = dstWidth * dstHeight / orig_h;
}
- xscale *= dstWidth / orig_w;
- yscale *= dstHeight / orig_h;
+ xscale *= (gdouble)dstWidth / orig_w;
+ yscale *= (gdouble)dstHeight / orig_h;
+ w *= (gdouble)dstWidth / orig_w;
+ h *= (gdouble)dstHeight / orig_h;
}
g_debug("scaled %d x %d", dstWidth, dstHeight);
GdkPixbuf *scaled_preview;
scaled_preview = gdk_pixbuf_scale_simple(preview, dstWidth, dstHeight, GDK_INTERP_HYPER);
if (ghb_settings_get_boolean(settings, "show_crop"))
{
- c0 = (32 + MIN(c0 - 32, 0)) * yscale;
- c1 = (32 + MIN(c1 - 32, 0)) * yscale;
- c2 = (32 + MIN(c2 - 32, 0)) * xscale;
- c3 = (32 + MIN(c3 - 32, 0)) * xscale;
+ c0 = (c0 - MAX(c0 - 32, 0)) * yscale;
+ c1 = (c1 - MAX(c1 - 32, 0)) * yscale;
+ c2 = (c2 - MAX(c2 - 32, 0)) * xscale;
+ c3 = (c3 - MAX(c3 - 32, 0)) * xscale;
// Top
- hash_pixbuf(scaled_preview, c2, 0, w, c0, 16, 0);
+ hash_pixbuf(scaled_preview, c2, 0, w, c0, 32, 0);
// Bottom
- hash_pixbuf(scaled_preview, c2, dstHeight-c1, w, c1, 16, 0);
+ hash_pixbuf(scaled_preview, c2, dstHeight-c1, w, c1, 32, 0);
// Left
- hash_pixbuf(scaled_preview, 0, c0, c2, h, 16, 1);
+ hash_pixbuf(scaled_preview, 0, c0, c2, h, 32, 1);
// Right
- hash_pixbuf(scaled_preview, dstWidth-c3, c0, c3, h, 16, 1);
+ hash_pixbuf(scaled_preview, dstWidth-c3, c0, c3, h, 32, 1);
}
g_object_unref (preview);
return scaled_preview;