Commit ebeb9333 authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

app: add gimp_display_shell_expose_item() and use it in the draw tool

parent 7367ec1b
......@@ -29,6 +29,7 @@
#include "vectors/gimpvectors.h"
#include "gimpcanvasitem.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-transform.h"
......@@ -66,6 +67,27 @@ gimp_display_shell_expose_region (GimpDisplayShell *shell,
h + 2 * border);
}
void
gimp_display_shell_expose_item (GimpDisplayShell *shell,
GimpCanvasItem *item)
{
GdkWindow *window;
GdkRegion *region;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_CANVAS_ITEM (item));
window = gtk_widget_get_window (shell->canvas);
region = gimp_canvas_item_get_extents (item, shell);
if (region)
{
gdk_window_invalidate_region (window, region, TRUE);
gdk_region_destroy (region);
}
}
void
gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide)
......
......@@ -24,6 +24,8 @@ void gimp_display_shell_expose_area (GimpDisplayShell *shell,
gint y,
gint w,
gint h);
void gimp_display_shell_expose_item (GimpDisplayShell *shell,
GimpCanvasItem *item);
void gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide);
void gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
......
......@@ -45,6 +45,7 @@
#include "display/gimpcanvastextcursor.h"
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-expose.h"
#include "display/gimpdisplayshell-transform.h"
#include "gimpdrawtool.h"
......@@ -184,17 +185,9 @@ gimp_draw_tool_invalidate_items (GimpDrawTool *draw_tool)
{
if (draw_tool->item)
{
GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
GdkWindow *window = gtk_widget_get_window (shell->canvas);
GdkRegion *region;
region = gimp_canvas_item_get_extents (draw_tool->item, shell);
GimpDisplayShell *shell = gimp_display_get_shell (draw_tool->display);
if (region)
{
gdk_window_invalidate_region (window, region, TRUE);
gdk_region_destroy (region);
}
gimp_display_shell_expose_item (shell, draw_tool->item);
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment