mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 12:02:32 +00:00
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:
parent
ec2be9b415
commit
ae0cf760ab
|
@ -27,6 +27,8 @@
|
|||
#include "core/gimpguide.h"
|
||||
#include "core/gimpsamplepoint.h"
|
||||
|
||||
#include "vectors/gimpvectors.h"
|
||||
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-expose.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);
|
||||
}
|
||||
|
||||
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
|
||||
gimp_display_shell_expose_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide)
|
||||
|
@ -111,11 +133,19 @@ void
|
|||
gimp_display_shell_expose_vectors (GimpDisplayShell *shell,
|
||||
GimpVectors *vectors)
|
||||
{
|
||||
gdouble x1, y1;
|
||||
gdouble x2, y2;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (vectors != NULL);
|
||||
|
||||
// FIXME
|
||||
gimp_display_shell_expose_full (shell);
|
||||
if (gimp_vectors_bounds (vectors, &x1, &y1, &x2, &y2))
|
||||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue