static void selection_undraw (Selection *selection) { gint x1, y1, x2, y2; selection_stop (selection); if (gimp_display_shell_mask_bounds (selection->shell, &x1, &y1, &x2, &y2)) { /* expose will restart the selection */ gimp_display_shell_expose_area (selection->shell, x1, y1, (x2 - x1), (y2 - y1)); } else { selection_start (selection); } }
static void gimp_display_shell_item_update (GimpCanvasItem *item, cairo_region_t *region, GimpDisplayShell *shell) { if (shell->rotate_transform) { gint n_rects; gint i; n_rects = cairo_region_num_rectangles (region); for (i = 0; i < n_rects; i++) { cairo_rectangle_int_t rect; gdouble tx1, ty1; gdouble tx2, ty2; gint x1, y1, x2, y2; cairo_region_get_rectangle (region, i, &rect); gimp_display_shell_rotate_transform_bounds (shell, rect.x, rect.y, rect.x + rect.width, rect.y + rect.height, &tx1, &ty1, &tx2, &ty2); x1 = floor (tx1 - 0.5); y1 = floor (ty1 - 0.5); x2 = ceil (tx2 + 0.5); y2 = ceil (ty2 + 0.5); gimp_display_shell_expose_area (shell, x1, y1, x2 - x1, y2 - y1); } } else { gimp_display_shell_expose_region (shell, region); } }
static void gimp_display_paint_area (GimpDisplay *display, gint x, gint y, gint w, gint h) { GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell); gint x1, y1, x2, y2; gdouble x1_f, y1_f, x2_f, y2_f; /* Bounds check */ x1 = CLAMP (x, 0, display->image->width); y1 = CLAMP (y, 0, display->image->height); x2 = CLAMP (x + w, 0, display->image->width); y2 = CLAMP (y + h, 0, display->image->height); x = x1; y = y1; w = (x2 - x1); h = (y2 - y1); /* display the area */ gimp_display_shell_transform_xy_f (shell, x, y, &x1_f, &y1_f, FALSE); gimp_display_shell_transform_xy_f (shell, x + w, y + h, &x2_f, &y2_f, FALSE); /* make sure to expose a superset of the transformed sub-pixel expose * area, not a subset. bug #126942. --mitch * * also acommodate for spill introduced by potential box filtering. * (bug #474509). --simon */ x1 = floor (x1_f - 0.5); y1 = floor (y1_f - 0.5); x2 = ceil (x2_f + 0.5); y2 = ceil (y2_f + 0.5); gimp_display_shell_expose_area (shell, x1, y1, x2 - x1, y2 - y1); }
void gimp_display_shell_update_cursor (GimpDisplayShell *shell, gint display_x, gint display_y, gint image_x, gint image_y) { GimpDialogFactory *factory; GimpSessionInfo *session_info; GimpImage *image; gboolean new_cursor; g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); image = shell->display->image; new_cursor = (shell->draw_cursor && shell->proximity && display_x >= 0 && display_y >= 0); /* Erase old cursor, if necessary */ if (shell->have_cursor && (! new_cursor || display_x != shell->cursor_x || display_y != shell->cursor_y)) { gimp_display_shell_expose_area (shell, shell->cursor_x - 7, shell->cursor_y - 7, 15, 15); if (! new_cursor) shell->have_cursor = FALSE; } shell->have_cursor = new_cursor; shell->cursor_x = display_x; shell->cursor_y = display_y; /* use the passed image_coords for the statusbar because they are * possibly snapped... */ gimp_statusbar_update_cursor (GIMP_STATUSBAR (shell->statusbar), image_x, image_y); factory = gimp_dialog_factory_from_name ("dock"); session_info = gimp_dialog_factory_find_session_info (factory, "gimp-cursor-view"); if (session_info && session_info->widget) { GtkWidget *cursor_view; cursor_view = gtk_bin_get_child (GTK_BIN (session_info->widget)); if (cursor_view) { gint t_x = -1; gint t_y = -1; /* ...but use the unsnapped display_coords for the info window */ if (display_x >= 0 && display_y >= 0) gimp_display_shell_untransform_xy (shell, display_x, display_y, &t_x, &t_y, FALSE, FALSE); gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view), shell->display->image, shell->unit, t_x, t_y); } } }