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

Move GimpDisplayShell's expose functions to separate files

parent 6c46d1ec
......@@ -47,6 +47,8 @@ libappdisplay_a_sources = \
gimpdisplayshell-dnd.h \
gimpdisplayshell-draw.c \
gimpdisplayshell-draw.h \
gimpdisplayshell-expose.c \
gimpdisplayshell-expose.h \
gimpdisplayshell-handlers.c \
gimpdisplayshell-handlers.h \
gimpdisplayshell-filter.c \
......
......@@ -40,6 +40,7 @@
#include "gimpdisplay.h"
#include "gimpdisplay-handlers.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-handlers.h"
#include "gimpdisplayshell-icon.h"
#include "gimpdisplayshell-transform.h"
......
......@@ -42,6 +42,7 @@
#include "gimpdisplayoptions.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-selection.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
......
......@@ -35,6 +35,7 @@
#include "gimpcursorview.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-transform.h"
#include "gimpimagewindow.h"
#include "gimpstatusbar.h"
......
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "display-types.h"
#include "core/gimpguide.h"
#include "core/gimpsamplepoint.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-transform.h"
void
gimp_display_shell_expose_area (GimpDisplayShell *shell,
gint x,
gint y,
gint w,
gint h)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gtk_widget_queue_draw_area (shell->canvas, x, y, w, h);
}
void
gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide)
{
gint position;
gint x, y;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_GUIDE (guide));
position = gimp_guide_get_position (guide);
if (position < 0)
return;
gimp_display_shell_transform_xy (shell,
position, position,
&x, &y,
FALSE);
switch (gimp_guide_get_orientation (guide))
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_display_shell_expose_area (shell, 0, y, shell->disp_width, 1);
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_display_shell_expose_area (shell, x, 0, 1, shell->disp_height);
break;
default:
break;
}
}
void
gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point)
{
gdouble x, y;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (sample_point != NULL);
if (sample_point->x < 0)
return;
gimp_display_shell_transform_xy_f (shell,
sample_point->x + 0.5,
sample_point->y + 0.5,
&x, &y,
FALSE);
x1 = MAX (0, floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE));
y1 = MAX (0, floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE));
x2 = MIN (shell->disp_width, ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE));
y2 = MIN (shell->disp_height, ceil (y + GIMP_SAMPLE_POINT_DRAW_SIZE));
/* HACK: add 3 instead of 1 so the number gets cleared too */
gimp_display_shell_expose_area (shell, x1, y1, x2 - x1 + 3, y2 - y1 + 3);
}
void
gimp_display_shell_expose_full (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gtk_widget_queue_draw (shell->canvas);
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_DISPLAY_SHELL_EXPOSE_H__
#define __GIMP_DISPLAY_SHELL_EXPOSE_H__
void gimp_display_shell_expose_area (GimpDisplayShell *shell,
gint x,
gint y,
gint w,
gint h);
void gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide);
void gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point);
void gimp_display_shell_expose_full (GimpDisplayShell *shell);
#endif /* __GIMP_DISPLAY_SHELL_EXPOSE_H__ */
......@@ -27,6 +27,7 @@
#include "config/gimpcoreconfig.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-filter.h"
......
......@@ -44,6 +44,7 @@
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-callbacks.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-handlers.h"
#include "gimpdisplayshell-icon.h"
#include "gimpdisplayshell-scale.h"
......
......@@ -34,6 +34,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
#include "gimpdisplayshell-title.h"
......
......@@ -38,6 +38,7 @@
#include "gimpdisplay-foreach.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-scale.h"
#include "gimpdisplayshell-scroll.h"
......
......@@ -35,6 +35,7 @@
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-appearance.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-selection.h"
#include "gimpdisplayshell-transform.h"
......
......@@ -37,14 +37,12 @@
#include "core/gimp.h"
#include "core/gimpchannel.h"
#include "core/gimpcontext.h"
#include "core/gimpguide.h"
#include "core/gimpimage.h"
#include "core/gimpimage-grid.h"
#include "core/gimpimage-guides.h"
#include "core/gimpimage-snap.h"
#include "core/gimpprojection.h"
#include "core/gimpmarshal.h"
#include "core/gimpsamplepoint.h"
#include "core/gimptemplate.h"
#include "widgets/gimpactiongroup.h"
......@@ -65,7 +63,7 @@
#include "gimpdisplayshell-cursor.h"
#include "gimpdisplayshell-dnd.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-draw.h"
#include "gimpdisplayshell-expose.h"
#include "gimpdisplayshell-filter.h"
#include "gimpdisplayshell-handlers.h"
#include "gimpdisplayshell-progress.h"
......@@ -1497,89 +1495,6 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
return ((*x2 - *x1) > 0) && ((*y2 - *y1) > 0);
}
void
gimp_display_shell_expose_area (GimpDisplayShell *shell,
gint x,
gint y,
gint w,
gint h)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gtk_widget_queue_draw_area (shell->canvas, x, y, w, h);
}
void
gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide)
{
gint position;
gint x, y;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (GIMP_IS_GUIDE (guide));
position = gimp_guide_get_position (guide);
if (position < 0)
return;
gimp_display_shell_transform_xy (shell,
position, position,
&x, &y,
FALSE);
switch (gimp_guide_get_orientation (guide))
{
case GIMP_ORIENTATION_HORIZONTAL:
gimp_display_shell_expose_area (shell, 0, y, shell->disp_width, 1);
break;
case GIMP_ORIENTATION_VERTICAL:
gimp_display_shell_expose_area (shell, x, 0, 1, shell->disp_height);
break;
default:
break;
}
}
void
gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point)
{
gdouble x, y;
gint x1, y1, x2, y2;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (sample_point != NULL);
if (sample_point->x < 0)
return;
gimp_display_shell_transform_xy_f (shell,
sample_point->x + 0.5,
sample_point->y + 0.5,
&x, &y,
FALSE);
x1 = MAX (0, floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE));
y1 = MAX (0, floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE));
x2 = MIN (shell->disp_width, ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE));
y2 = MIN (shell->disp_height, ceil (y + GIMP_SAMPLE_POINT_DRAW_SIZE));
/* HACK: add 3 instead of 1 so the number gets cleared too */
gimp_display_shell_expose_area (shell, x1, y1, x2 - x1 + 3, y2 - y1 + 3);
}
void
gimp_display_shell_expose_full (GimpDisplayShell *shell)
{
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
gtk_widget_queue_draw (shell->canvas);
}
void
gimp_display_shell_flush (GimpDisplayShell *shell,
gboolean now)
......
......@@ -257,17 +257,6 @@ gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
gint *x2,
gint *y2);
void gimp_display_shell_expose_area (GimpDisplayShell *shell,
gint x,
gint y,
gint w,
gint h);
void gimp_display_shell_expose_guide (GimpDisplayShell *shell,
GimpGuide *guide);
void gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
GimpSamplePoint *sample_point);
void gimp_display_shell_expose_full (GimpDisplayShell *shell);
void gimp_display_shell_flush (GimpDisplayShell *shell,
gboolean now);
......
......@@ -55,6 +55,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplayshell.h"
#include "display/gimpdisplayshell-appearance.h"
#include "display/gimpdisplayshell-expose.h"
#include "display/gimpdisplayshell-transform.h"
#include "gimptoolcontrol.h"
......
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