mirror of https://github.com/GNOME/gimp.git
app: update image-projection priority rect when switching displays
Update the image-projection priority rect to the current display's viewport when the display becomes active, so that the right region is rendered first when switching between different displays of the same image.
This commit is contained in:
parent
43e91d632e
commit
582930aa61
|
@ -179,6 +179,9 @@ static void gimp_display_shell_quality_notify_handler (GObject *c
|
|||
static void gimp_display_shell_color_config_notify_handler (GObject *config,
|
||||
GParamSpec *param_spec,
|
||||
GimpDisplayShell *shell);
|
||||
static void gimp_display_shell_display_changed_handler (GimpContext *context,
|
||||
GimpDisplay *display,
|
||||
GimpDisplayShell *shell);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -190,6 +193,7 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||
GimpContainer *vectors;
|
||||
GimpDisplayConfig *config;
|
||||
GimpColorConfig *color_config;
|
||||
GimpContext *user_context;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
@ -204,6 +208,8 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||
config = shell->display->config;
|
||||
color_config = GIMP_CORE_CONFIG (config)->color_management;
|
||||
|
||||
user_context = gimp_get_user_context (shell->display->gimp);
|
||||
|
||||
g_signal_connect (image, "clean",
|
||||
G_CALLBACK (gimp_display_shell_clean_dirty_handler),
|
||||
shell);
|
||||
|
@ -384,6 +390,10 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
|
|||
G_CALLBACK (gimp_display_shell_color_config_notify_handler),
|
||||
shell);
|
||||
|
||||
g_signal_connect (user_context, "display-changed",
|
||||
G_CALLBACK (gimp_display_shell_display_changed_handler),
|
||||
shell);
|
||||
|
||||
gimp_display_shell_active_vectors_handler (image, shell);
|
||||
gimp_display_shell_invalidate_preview_handler (image, shell);
|
||||
gimp_display_shell_quick_mask_changed_handler (image, shell);
|
||||
|
@ -414,6 +424,7 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
|||
GimpContainer *vectors;
|
||||
GimpDisplayConfig *config;
|
||||
GimpColorConfig *color_config;
|
||||
GimpContext *user_context;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
@ -428,6 +439,8 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
|||
config = shell->display->config;
|
||||
color_config = GIMP_CORE_CONFIG (config)->color_management;
|
||||
|
||||
user_context = gimp_get_user_context (shell->display->gimp);
|
||||
|
||||
gimp_display_shell_icon_update_stop (shell);
|
||||
|
||||
gimp_canvas_layer_boundary_set_layer (GIMP_CANVAS_LAYER_BOUNDARY (shell->layer_boundary),
|
||||
|
@ -436,6 +449,10 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
|
|||
gimp_canvas_canvas_boundary_set_image (GIMP_CANVAS_CANVAS_BOUNDARY (shell->canvas_boundary),
|
||||
NULL);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (user_context,
|
||||
gimp_display_shell_display_changed_handler,
|
||||
shell);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (color_config,
|
||||
gimp_display_shell_color_config_notify_handler,
|
||||
shell);
|
||||
|
@ -1214,3 +1231,12 @@ gimp_display_shell_color_config_notify_handler (GObject *config,
|
|||
shell->color_config_set = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_display_changed_handler (GimpContext *context,
|
||||
GimpDisplay *display,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
if (shell->display == display)
|
||||
gimp_display_shell_update_priority_rect (shell);
|
||||
}
|
||||
|
|
|
@ -964,23 +964,6 @@ gimp_display_shell_popup_menu (GtkWidget *widget)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_set_priority_viewport (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image = gimp_display_get_image (shell->display);
|
||||
|
||||
if (image)
|
||||
{
|
||||
GimpProjection *projection = gimp_image_get_projection (image);
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
|
||||
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||
&x, &y, &width, &height);
|
||||
gimp_projection_set_priority_rect (projection, x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_real_scaled (GimpDisplayShell *shell)
|
||||
{
|
||||
|
@ -995,7 +978,7 @@ gimp_display_shell_real_scaled (GimpDisplayShell *shell)
|
|||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
{
|
||||
gimp_display_shell_set_priority_viewport (shell);
|
||||
gimp_display_shell_update_priority_rect (shell);
|
||||
|
||||
gimp_ui_manager_update (shell->popup_manager, shell->display);
|
||||
}
|
||||
|
@ -1015,7 +998,7 @@ gimp_display_shell_real_scrolled (GimpDisplayShell *shell)
|
|||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
{
|
||||
gimp_display_shell_set_priority_viewport (shell);
|
||||
gimp_display_shell_update_priority_rect (shell);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1034,7 +1017,7 @@ gimp_display_shell_real_rotated (GimpDisplayShell *shell)
|
|||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
{
|
||||
gimp_display_shell_set_priority_viewport (shell);
|
||||
gimp_display_shell_update_priority_rect (shell);
|
||||
|
||||
gimp_ui_manager_update (shell->popup_manager, shell->display);
|
||||
}
|
||||
|
@ -1802,7 +1785,7 @@ gimp_display_shell_set_show_all (GimpDisplayShell *shell,
|
|||
|
||||
if (shell->display == gimp_context_get_display (user_context))
|
||||
{
|
||||
gimp_display_shell_set_priority_viewport (shell);
|
||||
gimp_display_shell_update_priority_rect (shell);
|
||||
|
||||
gimp_ui_manager_update (shell->popup_manager, shell->display);
|
||||
}
|
||||
|
@ -1860,6 +1843,27 @@ gimp_display_shell_get_bounding_box (GimpDisplayShell *shell)
|
|||
return bounding_box;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_update_priority_rect (GimpDisplayShell *shell)
|
||||
{
|
||||
GimpImage *image;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
image = gimp_display_get_image (shell->display);
|
||||
|
||||
if (image)
|
||||
{
|
||||
GimpProjection *projection = gimp_image_get_projection (image);
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
|
||||
gimp_display_shell_untransform_viewport (shell, ! shell->show_all,
|
||||
&x, &y, &width, &height);
|
||||
gimp_projection_set_priority_rect (projection, x, y, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_flush (GimpDisplayShell *shell)
|
||||
{
|
||||
|
|
|
@ -318,6 +318,9 @@ GimpPickable * gimp_display_shell_get_pickable (GimpDisplayShell *shell);
|
|||
GeglRectangle gimp_display_shell_get_bounding_box
|
||||
(GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_update_priority_rect
|
||||
(GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_flush (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_display_shell_pause (GimpDisplayShell *shell);
|
||||
|
|
Loading…
Reference in New Issue