app: only expose the area covered by the vectors object

gimp_display_shell_expose_vectors() exposes the bounding box of
the vectors plus a small border.
This commit is contained in:
Sven Neumann 2010-09-17 21:32:38 +02:00
parent ec2be9b415
commit ae0cf760ab
1 changed files with 32 additions and 2 deletions

View File

@ -27,6 +27,8 @@
#include "core/gimpguide.h" #include "core/gimpguide.h"
#include "core/gimpsamplepoint.h" #include "core/gimpsamplepoint.h"
#include "vectors/gimpvectors.h"
#include "gimpdisplayshell.h" #include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h" #include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-transform.h" #include "gimpdisplayshell-transform.h"
@ -44,6 +46,26 @@ gimp_display_shell_expose_area (GimpDisplayShell *shell,
gtk_widget_queue_draw_area (shell->canvas, x, y, w, h); gtk_widget_queue_draw_area (shell->canvas, x, y, w, h);
} }
static void
gimp_display_shell_expose_region (GimpDisplayShell *shell,
gdouble x1,
gdouble y1,
gdouble x2,
gdouble y2,
gint border)
{
const gint x = floor (x1);
const gint y = floor (y1);
const gint w = ceil (x2) - x;
const gint h = ceil (y2) - y;
gimp_display_shell_expose_area (shell,
x - border,
y - border,
w + 2 * border,
h + 2 * border);
}
void void
gimp_display_shell_expose_guide (GimpDisplayShell *shell, gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide) GimpGuide *guide)
@ -111,11 +133,19 @@ void
gimp_display_shell_expose_vectors (GimpDisplayShell *shell, gimp_display_shell_expose_vectors (GimpDisplayShell *shell,
GimpVectors *vectors) GimpVectors *vectors)
{ {
gdouble x1, y1;
gdouble x2, y2;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (vectors != NULL); g_return_if_fail (vectors != NULL);
// FIXME if (gimp_vectors_bounds (vectors, &x1, &y1, &x2, &y2))
gimp_display_shell_expose_full (shell); {
gimp_display_shell_transform_xy_f (shell, x1, y1, &x1, &y1, FALSE);
gimp_display_shell_transform_xy_f (shell, x2, y2, &x2, &y2, FALSE);
gimp_display_shell_expose_region (shell, x1, y1, x2, y2, 2);
}
} }
void void