[gimp] imagemap: clear preview area background before drawing image
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] imagemap: clear preview area background before drawing image
- Date: Tue, 20 Dec 2016 19:15:44 +0000 (UTC)
commit f91e2a94a7d0ab41d0c53a8eae480c35b1c11cf7
Author: Ell <ell_se yahoo com>
Date: Tue Dec 20 13:36:27 2016 -0500
imagemap: clear preview area background before drawing image
Previously, we neither cleared the preview area's buffer, nor set
its max size, so if the preview area was bigger than the image, the
rest of the widget would display garbage.
This is an ad-hoc-ish fix, simply filling the preview area's buffer
with the background color prior to drawing the image. Anything
more sophisticated will have to wait till image maps are cool
again, I guess :)
plug-ins/imagemap/imap_preview.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/plug-ins/imagemap/imap_preview.c b/plug-ins/imagemap/imap_preview.c
index b0dafe8..cee8c10 100644
--- a/plug-ins/imagemap/imap_preview.c
+++ b/plug-ins/imagemap/imap_preview.c
@@ -75,6 +75,25 @@ preview_get_height(GtkWidget *preview)
}
static void
+render_background(Preview_t *preview_base)
+{
+ GtkWidget *preview = preview_base->preview;
+ GtkStyle *style;
+ const GdkColor *bg_color;
+
+ gtk_widget_ensure_style (preview);
+
+ style = gtk_widget_get_style (preview);
+ bg_color = &style->bg[GTK_STATE_NORMAL];
+
+ gimp_preview_area_fill (GIMP_PREVIEW_AREA (preview),
+ 0, 0, G_MAXINT, G_MAXINT,
+ bg_color->red >> 8,
+ bg_color->green >> 8,
+ bg_color->blue >> 8);
+}
+
+static void
render_gray_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
{
guchar *src_row, *dest_buffer, *dest;
@@ -264,6 +283,8 @@ render_rgb_image(Preview_t *preview_base, GimpPixelRgn *srcrgn)
static void
render_preview(Preview_t *preview_base, GimpPixelRgn *srcrgn)
{
+ render_background (preview_base);
+
switch (gimp_drawable_type(srcrgn->drawable->drawable_id)) {
case GIMP_RGB_IMAGE:
case GIMP_RGBA_IMAGE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]