app: remove "gboolean use_offsets" from gimpdisplayshell-transform.[ch]

This commit is contained in:
Michael Natterer
2010-09-23 10:50:39 +02:00
parent a0cb4fe805
commit ddc63de6d6
20 changed files with 100 additions and 246 deletions

View File

@ -282,8 +282,7 @@ gimp_canvas_handle_transform (GimpCanvasItem *item,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
private->x, private->y, private->x, private->y,
x, y, x, y);
FALSE);
switch (private->type) switch (private->type)
{ {

View File

@ -195,12 +195,10 @@ gimp_canvas_line_transform (GimpCanvasItem *item,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
private->x1, private->y1, private->x1, private->y1,
x1, y1, x1, y1);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
private->x2, private->y2, private->x2, private->y2,
x2, y2, x2, y2);
FALSE);
*x1 = PROJ_ROUND (*x1) + 0.5; *x1 = PROJ_ROUND (*x1) + 0.5;
*y1 = PROJ_ROUND (*y1) + 0.5; *y1 = PROJ_ROUND (*y1) + 0.5;

View File

@ -185,8 +185,7 @@ gimp_canvas_polygon_transform (GimpCanvasItem *item,
private->points[i].x, private->points[i].x,
private->points[i].y, private->points[i].y,
&points[i].x, &points[i].x,
&points[i].y, &points[i].y);
FALSE);
points[i].x = PROJ_ROUND (points[i].x) + 0.5; points[i].x = PROJ_ROUND (points[i].x) + 0.5;
points[i].y = PROJ_ROUND (points[i].y) + 0.5; points[i].y = PROJ_ROUND (points[i].y) + 0.5;

View File

@ -212,15 +212,13 @@ gimp_canvas_rectangle_transform (GimpCanvasItem *item,
private->x + private->width), private->x + private->width),
MIN (private->y, MIN (private->y,
private->y + private->height), private->y + private->height),
x, y, x, y);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
MAX (private->x, MAX (private->x,
private->x + private->width), private->x + private->width),
MAX (private->y, MAX (private->y,
private->y + private->height), private->y + private->height),
w, h, w, h);
FALSE);
*w -= *x; *w -= *x;
*h -= *y; *h -= *y;

View File

@ -845,8 +845,8 @@ gimp_display_paint_area (GimpDisplay *display,
h = (y2 - y1); h = (y2 - y1);
/* display the area */ /* 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, y, &x1_f, &y1_f);
gimp_display_shell_transform_xy_f (shell, x + w, y + h, &x2_f, &y2_f, FALSE); gimp_display_shell_transform_xy_f (shell, x + w, y + h, &x2_f, &y2_f);
/* make sure to expose a superset of the transformed sub-pixel expose /* make sure to expose a superset of the transformed sub-pixel expose
* area, not a subset. bug #126942. --mitch * area, not a subset. bug #126942. --mitch

View File

@ -188,7 +188,7 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
/* ...but use the unsnapped display_coords for the info window */ /* ...but use the unsnapped display_coords for the info window */
if (display_x >= 0 && display_y >= 0) if (display_x >= 0 && display_y >= 0)
gimp_display_shell_untransform_xy (shell, display_x, display_y, gimp_display_shell_untransform_xy (shell, display_x, display_y,
&t_x, &t_y, FALSE, FALSE); &t_x, &t_y, FALSE);
gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view), gimp_cursor_view_update_cursor (GIMP_CURSOR_VIEW (cursor_view),
image, shell->unit, image, shell->unit,

View File

@ -158,7 +158,7 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
switch (gimp_guide_get_orientation (guide)) switch (gimp_guide_get_orientation (guide))
{ {
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
gimp_display_shell_transform_xy (shell, 0, position, &x, &y, FALSE); gimp_display_shell_transform_xy (shell, 0, position, &x, &y);
if (y >= y1 && y < y2) if (y >= y1 && y < y2)
{ {
cairo_move_to (cr, x1, y + 0.5); cairo_move_to (cr, x1, y + 0.5);
@ -167,7 +167,7 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
break; break;
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
gimp_display_shell_transform_xy (shell, position, 0, &x, &y, FALSE); gimp_display_shell_transform_xy (shell, position, 0, &x, &y);
if (x >= x1 && x < x2) if (x >= x1 && x < x2)
{ {
cairo_move_to (cr, x + 0.5, y1); cairo_move_to (cr, x + 0.5, y1);
@ -265,8 +265,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue; continue;
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
x, 0, &x_real, &y_real, x, 0, &x_real, &y_real);
FALSE);
if (x_real < x1 || x_real >= x2) if (x_real < x1 || x_real >= x2)
continue; continue;
@ -277,8 +276,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue; continue;
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
x, y, &x_real, &y_real, x, y, &x_real, &y_real);
FALSE);
if (y_real >= y1 && y_real < y2) if (y_real >= y1 && y_real < y2)
{ {
@ -296,8 +294,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue; continue;
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
x, 0, &x_real, &y_real, x, 0, &x_real, &y_real);
FALSE);
if (x_real + CROSSHAIR < x1 || x_real - CROSSHAIR >= x2) if (x_real + CROSSHAIR < x1 || x_real - CROSSHAIR >= x2)
continue; continue;
@ -308,8 +305,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue; continue;
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
x, y, &x_real, &y_real, x, y, &x_real, &y_real);
FALSE);
if (y_real + CROSSHAIR < y1 || y_real - CROSSHAIR >= y2) if (y_real + CROSSHAIR < y1 || y_real - CROSSHAIR >= y2)
continue; continue;
@ -345,11 +341,9 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
case GIMP_GRID_DOUBLE_DASH: case GIMP_GRID_DOUBLE_DASH:
case GIMP_GRID_SOLID: case GIMP_GRID_SOLID:
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
0, 0, &x0, &y0, 0, 0, &x0, &y0);
FALSE);
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
width, height, &x3, &y3, width, height, &x3, &y3);
FALSE);
for (x = x_offset; x < width; x += grid->xspacing) for (x = x_offset; x < width; x += grid->xspacing)
{ {
@ -357,8 +351,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue; continue;
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
x, 0, &x_real, &y_real, x, 0, &x_real, &y_real);
FALSE);
if (x_real >= x1 && x_real < x2) if (x_real >= x1 && x_real < x2)
{ {
@ -373,8 +366,7 @@ gimp_display_shell_draw_grid (GimpDisplayShell *shell,
continue; continue;
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
0, y, &x_real, &y_real, 0, y, &x_real, &y_real);
FALSE);
if (y_real >= y1 && y_real < y2) if (y_real >= y1 && y_real < y2)
{ {
@ -414,7 +406,7 @@ gimp_display_shell_draw_pen (GimpDisplayShell *shell,
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
points[0].x, points[0].y, points[0].x, points[0].y,
&x, &y, FALSE); &x, &y);
cairo_move_to (cr, x, y); cairo_move_to (cr, x, y);
@ -422,7 +414,7 @@ gimp_display_shell_draw_pen (GimpDisplayShell *shell,
{ {
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
points[i].x, points[i].y, points[i].x, points[i].y,
&x, &y, FALSE); &x, &y);
cairo_line_to (cr, x, y); cairo_line_to (cr, x, y);
} }
@ -465,7 +457,7 @@ gimp_display_shell_draw_sample_point (GimpDisplayShell *shell,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
sample_point->x + 0.5, sample_point->x + 0.5,
sample_point->y + 0.5, sample_point->y + 0.5,
&x, &y, FALSE); &x, &y);
sx1 = floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE); sx1 = floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE);
sx2 = ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE); sx2 = ceil (x + GIMP_SAMPLE_POINT_DRAW_SIZE);

View File

@ -83,8 +83,7 @@ gimp_display_shell_expose_guide (GimpDisplayShell *shell,
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
position, position, position, position,
&x, &y, &x, &y);
FALSE);
switch (gimp_guide_get_orientation (guide)) switch (gimp_guide_get_orientation (guide))
{ {
@ -117,8 +116,7 @@ gimp_display_shell_expose_sample_point (GimpDisplayShell *shell,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
sample_point->x + 0.5, sample_point->x + 0.5,
sample_point->y + 0.5, sample_point->y + 0.5,
&x, &y, &x, &y);
FALSE);
x1 = MAX (0, floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE)); x1 = MAX (0, floor (x - GIMP_SAMPLE_POINT_DRAW_SIZE));
y1 = MAX (0, floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE)); y1 = MAX (0, floor (y - GIMP_SAMPLE_POINT_DRAW_SIZE));
@ -141,8 +139,8 @@ gimp_display_shell_expose_vectors (GimpDisplayShell *shell,
if (gimp_vectors_bounds (vectors, &x1, &y1, &x2, &y2)) 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, x1, y1, &x1, &y1);
gimp_display_shell_transform_xy_f (shell, x2, y2, &x2, &y2, FALSE); gimp_display_shell_transform_xy_f (shell, x2, y2, &x2, &y2);
gimp_display_shell_expose_region (shell, x1, y1, x2, y2, 2); gimp_display_shell_expose_region (shell, x1, y1, x2, y2, 2);
} }

View File

@ -250,8 +250,7 @@ gimp_display_shell_preview_transform (GimpDisplayShell *shell,
\ \
gimp_display_shell_transform_xy_f (shell, \ gimp_display_shell_transform_xy_f (shell, \
tx1, ty1, \ tx1, ty1, \
&tx2, &ty2, \ &tx2, &ty2); \
FALSE); \
x[sub][index] = (gint) tx2; \ x[sub][index] = (gint) tx2; \
y[sub][index] = (gint) ty2; \ y[sub][index] = (gint) ty2; \
\ \

View File

@ -893,8 +893,7 @@ gimp_display_shell_scale_to (GimpDisplayShell *shell,
viewport_x, viewport_x,
viewport_y, viewport_y,
&image_focus_x, &image_focus_x,
&image_focus_y, &image_focus_y);
FALSE);
gimp_display_shell_calculate_scale_x_and_y (shell, scale, &scale_x, &scale_y); gimp_display_shell_calculate_scale_x_and_y (shell, scale, &scale_x, &scale_y);

View File

@ -408,7 +408,7 @@ selection_transform_segs (Selection *selection,
gint i; gint i;
gimp_display_shell_transform_segments (selection->shell, gimp_display_shell_transform_segments (selection->shell,
src_segs, dest_segs, n_segs, FALSE); src_segs, dest_segs, n_segs);
for (i = 0; i < n_segs; i++) for (i = 0; i < n_segs; i++)
{ {

View File

@ -96,7 +96,6 @@ gimp_display_shell_untransform_coordinate (const GimpDisplayShell *shell,
* @y: * @y:
* @nx: * @nx:
* @ny: * @ny:
* @use_offsets:
* *
* Transforms an image coordinate to a shell coordinate. * Transforms an image coordinate to a shell coordinate.
**/ **/
@ -105,11 +104,8 @@ gimp_display_shell_transform_xy (const GimpDisplayShell *shell,
gdouble x, gdouble x,
gdouble y, gdouble y,
gint *nx, gint *nx,
gint *ny, gint *ny)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
gint64 tx; gint64 tx;
gint64 ty; gint64 ty;
@ -117,17 +113,6 @@ gimp_display_shell_transform_xy (const GimpDisplayShell *shell,
g_return_if_fail (nx != NULL); g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL); g_return_if_fail (ny != NULL);
if (use_offsets)
{
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
x += offset_x;
y += offset_y;
}
tx = ((gint64) x * shell->x_src_dec) / shell->x_dest_inc; tx = ((gint64) x * shell->x_src_dec) / shell->x_dest_inc;
ty = ((gint64) y * shell->y_src_dec) / shell->y_dest_inc; ty = ((gint64) y * shell->y_src_dec) / shell->y_dest_inc;
@ -149,8 +134,6 @@ gimp_display_shell_transform_xy (const GimpDisplayShell *shell,
* @ny: returns y coordinate in image coordinates * @ny: returns y coordinate in image coordinates
* @round: if %TRUE, round the results to the nearest integer; * @round: if %TRUE, round the results to the nearest integer;
* if %FALSE, simply cast them to @gint. * if %FALSE, simply cast them to @gint.
* @use_offsets: if %TRUE, @nx and @ny will be returned in the coordinate
* system of the active drawable instead of the image
* *
* Transform from display coordinates to image coordinates, so that * Transform from display coordinates to image coordinates, so that
* points on the display can be mapped to the corresponding points * points on the display can be mapped to the corresponding points
@ -162,11 +145,8 @@ gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
gint y, gint y,
gint *nx, gint *nx,
gint *ny, gint *ny,
gboolean round, gboolean round)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
gint64 tx; gint64 tx;
gint64 ty; gint64 ty;
@ -174,14 +154,6 @@ gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
g_return_if_fail (nx != NULL); g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL); g_return_if_fail (ny != NULL);
if (use_offsets)
{
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
tx = (gint64) x + shell->offset_x; tx = (gint64) x + shell->offset_x;
ty = (gint64) y + shell->offset_y; ty = (gint64) y + shell->offset_y;
@ -194,8 +166,8 @@ gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
tx /= shell->x_src_dec; tx /= shell->x_src_dec;
ty /= shell->y_src_dec; ty /= shell->y_src_dec;
*nx = CLAMP (tx - offset_x, G_MININT, G_MAXINT); *nx = CLAMP (tx, G_MININT, G_MAXINT);
*ny = CLAMP (ty - offset_y, G_MININT, G_MAXINT); *ny = CLAMP (ty, G_MININT, G_MAXINT);
} }
/** /**
@ -205,8 +177,6 @@ gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
* @y: y coordinate of point in image coordinate * @y: y coordinate of point in image coordinate
* @nx: returns the transformed x coordinate * @nx: returns the transformed x coordinate
* @ny: returns the transformed y coordinate * @ny: returns the transformed y coordinate
* @use_offsets: if %TRUE, the @x and @y coordinates are in the coordinate
* system of the active drawable instead of the image
* *
* This function is identical to gimp_display_shell_transfrom_xy(), * This function is identical to gimp_display_shell_transfrom_xy(),
* except that it returns its results as doubles rather than ints. * except that it returns its results as doubles rather than ints.
@ -216,26 +186,14 @@ gimp_display_shell_transform_xy_f (const GimpDisplayShell *shell,
gdouble x, gdouble x,
gdouble y, gdouble y,
gdouble *nx, gdouble *nx,
gdouble *ny, gdouble *ny)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (nx != NULL); g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL); g_return_if_fail (ny != NULL);
if (use_offsets) *nx = SCALEX (shell, x) - shell->offset_x;
{ *ny = SCALEY (shell, y) - shell->offset_y;
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
*nx = SCALEX (shell, x + offset_x) - shell->offset_x;
*ny = SCALEY (shell, y + offset_y) - shell->offset_y;
} }
/** /**
@ -245,8 +203,6 @@ gimp_display_shell_transform_xy_f (const GimpDisplayShell *shell,
* @y: y coordinate in display coordinates * @y: y coordinate in display coordinates
* @nx: place to return x coordinate in image coordinates * @nx: place to return x coordinate in image coordinates
* @ny: place to return y coordinate in image coordinates * @ny: place to return y coordinate in image coordinates
* @use_offsets: if %TRUE, @nx and @ny will be returned in the coordinate
* system of the active drawable instead of the image
* *
* This function is identical to gimp_display_shell_untransform_xy(), * This function is identical to gimp_display_shell_untransform_xy(),
* except that the input and output coordinates are doubles rather than * except that the input and output coordinates are doubles rather than
@ -257,26 +213,14 @@ gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell,
gdouble x, gdouble x,
gdouble y, gdouble y,
gdouble *nx, gdouble *nx,
gdouble *ny, gdouble *ny)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (nx != NULL); g_return_if_fail (nx != NULL);
g_return_if_fail (ny != NULL); g_return_if_fail (ny != NULL);
if (use_offsets) *nx = (x + shell->offset_x) / shell->scale_x;
{ *ny = (y + shell->offset_y) / shell->scale_y;
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
*nx = (x + shell->offset_x) / shell->scale_x - offset_x;
*ny = (y + shell->offset_y) / shell->scale_y - offset_y;
} }
/** /**
@ -285,8 +229,6 @@ gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell,
* @points: array of GimpVectors2 coordinate pairs * @points: array of GimpVectors2 coordinate pairs
* @coords: returns the corresponding display coordinates * @coords: returns the corresponding display coordinates
* @n_points: number of points * @n_points: number of points
* @use_offsets: if %TRUE, the source coordinates are in the coordinate
* system of the active drawable instead of the image
* *
* Transforms from image coordinates to display coordinates, so that * Transforms from image coordinates to display coordinates, so that
* objects can be rendered at the correct points on the display. * objects can be rendered at the correct points on the display.
@ -295,27 +237,16 @@ void
gimp_display_shell_transform_points (const GimpDisplayShell *shell, gimp_display_shell_transform_points (const GimpDisplayShell *shell,
const GimpVector2 *points, const GimpVector2 *points,
GdkPoint *coords, GdkPoint *coords,
gint n_points, gint n_points)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
gint i; gint i;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (use_offsets)
{
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
for (i = 0; i < n_points ; i++) for (i = 0; i < n_points ; i++)
{ {
gdouble x = points[i].x + offset_x; gdouble x = points[i].x;
gdouble y = points[i].y + offset_y; gdouble y = points[i].y;
x = x * shell->x_src_dec / shell->x_dest_inc; x = x * shell->x_src_dec / shell->x_dest_inc;
y = y * shell->y_src_dec / shell->y_dest_inc; y = y * shell->y_src_dec / shell->y_dest_inc;
@ -333,8 +264,6 @@ gimp_display_shell_transform_points (const GimpDisplayShell *shell,
* @image_coords: array of image coordinates * @image_coords: array of image coordinates
* @disp_coords: returns the corresponding display coordinates * @disp_coords: returns the corresponding display coordinates
* @n_coords: number of coordinates * @n_coords: number of coordinates
* @use_offsets: if %TRUE, the source coordinates are in the coordinate
* system of the active drawable instead of the image
* *
* Transforms from image coordinates to display coordinates, so that * Transforms from image coordinates to display coordinates, so that
* objects can be rendered at the correct points on the display. * objects can be rendered at the correct points on the display.
@ -343,27 +272,16 @@ void
gimp_display_shell_transform_coords (const GimpDisplayShell *shell, gimp_display_shell_transform_coords (const GimpDisplayShell *shell,
const GimpCoords *image_coords, const GimpCoords *image_coords,
GdkPoint *disp_coords, GdkPoint *disp_coords,
gint n_coords, gint n_coords)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
gint i; gint i;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (use_offsets)
{
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item =GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
for (i = 0; i < n_coords ; i++) for (i = 0; i < n_coords ; i++)
{ {
gdouble x = image_coords[i].x + offset_x; gdouble x = image_coords[i].x;
gdouble y = image_coords[i].y + offset_y; gdouble y = image_coords[i].y;
x = x * shell->x_src_dec / shell->x_dest_inc; x = x * shell->x_src_dec / shell->x_dest_inc;
y = y * shell->y_src_dec / shell->y_dest_inc; y = y * shell->y_src_dec / shell->y_dest_inc;
@ -381,8 +299,6 @@ gimp_display_shell_transform_coords (const GimpDisplayShell *shell,
* @src_segs: array of segments in image coordinates * @src_segs: array of segments in image coordinates
* @dest_segs: returns the corresponding segments in display coordinates * @dest_segs: returns the corresponding segments in display coordinates
* @n_segs: number of segments * @n_segs: number of segments
* @use_offsets: if %TRUE, the source coordinates are in the coordinate
* system of the active drawable instead of the image
* *
* Transforms from image coordinates to display coordinates, so that * Transforms from image coordinates to display coordinates, so that
* objects can be rendered at the correct points on the display. * objects can be rendered at the correct points on the display.
@ -391,32 +307,21 @@ void
gimp_display_shell_transform_segments (const GimpDisplayShell *shell, gimp_display_shell_transform_segments (const GimpDisplayShell *shell,
const BoundSeg *src_segs, const BoundSeg *src_segs,
GdkSegment *dest_segs, GdkSegment *dest_segs,
gint n_segs, gint n_segs)
gboolean use_offsets)
{ {
gint offset_x = 0;
gint offset_y = 0;
gint i; gint i;
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell)); g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
if (use_offsets)
{
GimpImage *image = gimp_display_get_image (shell->display);
GimpItem *item = GIMP_ITEM (gimp_image_get_active_drawable (image));
gimp_item_get_offset (item, &offset_x, &offset_y);
}
for (i = 0; i < n_segs ; i++) for (i = 0; i < n_segs ; i++)
{ {
gint64 x1, x2; gint64 x1, x2;
gint64 y1, y2; gint64 y1, y2;
x1 = src_segs[i].x1 + offset_x; x1 = src_segs[i].x1;
x2 = src_segs[i].x2 + offset_x; x2 = src_segs[i].x2;
y1 = src_segs[i].y1 + offset_y; y1 = src_segs[i].y1;
y2 = src_segs[i].y2 + offset_y; y2 = src_segs[i].y2;
x1 = (x1 * shell->x_src_dec) / shell->x_dest_inc; x1 = (x1 * shell->x_src_dec) / shell->x_dest_inc;
x2 = (x2 * shell->x_src_dec) / shell->x_dest_inc; x2 = (x2 * shell->x_src_dec) / shell->x_dest_inc;
@ -456,11 +361,11 @@ gimp_display_shell_untransform_viewport (const GimpDisplayShell *shell,
gimp_display_shell_untransform_xy (shell, gimp_display_shell_untransform_xy (shell,
0, 0, 0, 0,
&x1, &y1, &x1, &y1,
FALSE, FALSE); FALSE);
gimp_display_shell_untransform_xy (shell, gimp_display_shell_untransform_xy (shell,
shell->disp_width, shell->disp_height, shell->disp_width, shell->disp_height,
&x2, &y2, &x2, &y2,
FALSE, FALSE); FALSE);
image = gimp_display_get_image (shell->display); image = gimp_display_get_image (shell->display);

View File

@ -30,44 +30,37 @@ void gimp_display_shell_transform_xy (const GimpDisplayShell *shell,
gdouble x, gdouble x,
gdouble y, gdouble y,
gint *nx, gint *nx,
gint *ny, gint *ny);
gboolean use_offsets);
void gimp_display_shell_untransform_xy (const GimpDisplayShell *shell, void gimp_display_shell_untransform_xy (const GimpDisplayShell *shell,
gint x, gint x,
gint y, gint y,
gint *nx, gint *nx,
gint *ny, gint *ny,
gboolean round, gboolean round);
gboolean use_offsets);
void gimp_display_shell_transform_xy_f (const GimpDisplayShell *shell, void gimp_display_shell_transform_xy_f (const GimpDisplayShell *shell,
gdouble x, gdouble x,
gdouble y, gdouble y,
gdouble *nx, gdouble *nx,
gdouble *ny, gdouble *ny);
gboolean use_offsets);
void gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell, void gimp_display_shell_untransform_xy_f (const GimpDisplayShell *shell,
gdouble x, gdouble x,
gdouble y, gdouble y,
gdouble *nx, gdouble *nx,
gdouble *ny, gdouble *ny);
gboolean use_offsets);
void gimp_display_shell_transform_points (const GimpDisplayShell *shell, void gimp_display_shell_transform_points (const GimpDisplayShell *shell,
const GimpVector2 *points, const GimpVector2 *points,
GdkPoint *coords, GdkPoint *coords,
gint n_points, gint n_points);
gboolean use_offsets);
void gimp_display_shell_transform_coords (const GimpDisplayShell *shell, void gimp_display_shell_transform_coords (const GimpDisplayShell *shell,
const GimpCoords *image_coords, const GimpCoords *image_coords,
GdkPoint *disp_coords, GdkPoint *disp_coords,
gint n_coords, gint n_coords);
gboolean use_offsets);
void gimp_display_shell_transform_segments (const GimpDisplayShell *shell, void gimp_display_shell_transform_segments (const GimpDisplayShell *shell,
const BoundSeg *src_segs, const BoundSeg *src_segs,
GdkSegment *dest_segs, GdkSegment *dest_segs,
gint n_segs, gint n_segs);
gboolean use_offsets);
void gimp_display_shell_untransform_viewport (const GimpDisplayShell *shell, void gimp_display_shell_untransform_viewport (const GimpDisplayShell *shell,
gint *x, gint *x,

View File

@ -1093,8 +1093,7 @@ gimp_display_shell_transform_overlay (GimpDisplayShell *shell,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
overlay->image_x, overlay->image_x,
overlay->image_y, overlay->image_y,
x, y, x, y);
FALSE);
gtk_widget_size_request (child, &requisition); gtk_widget_size_request (child, &requisition);
@ -1625,8 +1624,8 @@ gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
return FALSE; return FALSE;
} }
gimp_display_shell_transform_xy (shell, *x1, *y1, x1, y1, FALSE); gimp_display_shell_transform_xy (shell, *x1, *y1, x1, y1);
gimp_display_shell_transform_xy (shell, *x2, *y2, x2, y2, FALSE); gimp_display_shell_transform_xy (shell, *x2, *y2, x2, y2);
/* Make sure the extents are within bounds */ /* Make sure the extents are within bounds */
*x1 = CLAMP (*x1, 0, shell->disp_width); *x1 = CLAMP (*x1, 0, shell->disp_width);

View File

@ -1102,8 +1102,7 @@ gimp_image_window_keep_canvas_pos (GimpImageWindow *window)
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
0.0, 0.0, 0.0, 0.0,
&image_origin_shell_x, &image_origin_shell_y, &image_origin_shell_x, &image_origin_shell_y);
FALSE /*use_offsets*/);
gtk_widget_translate_coordinates (GTK_WIDGET (shell->canvas), gtk_widget_translate_coordinates (GTK_WIDGET (shell->canvas),
GTK_WIDGET (window), GTK_WIDGET (window),
image_origin_shell_x, image_origin_shell_y, image_origin_shell_x, image_origin_shell_y,

View File

@ -398,8 +398,7 @@ gimp_color_tool_motion (GimpTool *tool,
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
coords->x, coords->y, coords->x, coords->y,
&tx, &ty, &tx, &ty);
FALSE);
if (tx < 0 || tx > shell->disp_width || if (tx < 0 || tx > shell->disp_width ||
ty < 0 || ty > shell->disp_height) ty < 0 || ty > shell->disp_height)

View File

@ -402,8 +402,8 @@ gimp_draw_tool_calc_distance_square (GimpDrawTool *draw_tool,
shell = gimp_display_get_shell (display); shell = gimp_display_get_shell (display);
gimp_display_shell_transform_xy_f (shell, x1, y1, &tx1, &ty1, FALSE); gimp_display_shell_transform_xy_f (shell, x1, y1, &tx1, &ty1);
gimp_display_shell_transform_xy_f (shell, x2, y2, &tx2, &ty2, FALSE); gimp_display_shell_transform_xy_f (shell, x2, y2, &tx2, &ty2);
return SQR (tx2 - tx1) + SQR (ty2 - ty1); return SQR (tx2 - tx1) + SQR (ty2 - ty1);
} }
@ -476,12 +476,10 @@ gimp_draw_tool_draw_line (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x1, y1, x1, y1,
&tx1, &ty1, &tx1, &ty1);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x2, y2, x2, y2,
&tx2, &ty2, &tx2, &ty2);
FALSE);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR, gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), GIMP_CANVAS_STYLE_XOR,
PROJ_ROUND (tx1), PROJ_ROUND (ty1), PROJ_ROUND (tx1), PROJ_ROUND (ty1),
@ -517,12 +515,10 @@ gimp_draw_tool_draw_dashed_line (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x1, y1, x1, y1,
&tx1, &ty1, &tx1, &ty1);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x2, y2, x2, y2,
&tx2, &ty2, &tx2, &ty2);
FALSE);
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
GIMP_CANVAS_STYLE_XOR_DASHED, GIMP_CANVAS_STYLE_XOR_DASHED,
@ -559,12 +555,12 @@ gimp_draw_tool_draw_guide_line (GimpDrawTool *draw_tool,
switch (orientation) switch (orientation)
{ {
case GIMP_ORIENTATION_HORIZONTAL: case GIMP_ORIENTATION_HORIZONTAL:
gimp_display_shell_transform_xy (shell, 0, position, &x, &y, FALSE); gimp_display_shell_transform_xy (shell, 0, position, &x, &y);
y1 = y2 = y; y1 = y2 = y;
break; break;
case GIMP_ORIENTATION_VERTICAL: case GIMP_ORIENTATION_VERTICAL:
gimp_display_shell_transform_xy (shell, position, 0, &x, &y, FALSE); gimp_display_shell_transform_xy (shell, position, 0, &x, &y);
x1 = x2 = x; x1 = x2 = x;
break; break;
@ -618,12 +614,10 @@ gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
MIN (x, x + width), MIN (y, y + height), MIN (x, x + width), MIN (y, y + height),
&tx1, &ty1, &tx1, &ty1);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
MAX (x, x + width), MAX (y, y + height), MAX (x, x + width), MAX (y, y + height),
&tx2, &ty2, &tx2, &ty2);
FALSE);
tx1 = CLAMP (tx1, -1, shell->disp_width + 1); tx1 = CLAMP (tx1, -1, shell->disp_width + 1);
ty1 = CLAMP (ty1, -1, shell->disp_height + 1); ty1 = CLAMP (ty1, -1, shell->disp_height + 1);
@ -672,12 +666,10 @@ gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
MIN (x, x + width), MIN (y, y + height), MIN (x, x + width), MIN (y, y + height),
&tx1, &ty1, &tx1, &ty1);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
MAX (x, x + width), MAX (y, y + height), MAX (x, x + width), MAX (y, y + height),
&tx2, &ty2, &tx2, &ty2);
FALSE);
tx2 -= tx1; tx2 -= tx1;
ty2 -= ty1; ty2 -= ty1;
@ -729,8 +721,7 @@ gimp_draw_tool_draw_rectangle_by_anchor (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x, y, x, y,
&tx, &ty, &tx, &ty);
FALSE);
gimp_draw_tool_shift_to_north_west (tx, ty, gimp_draw_tool_shift_to_north_west (tx, ty,
width, height, width, height,
@ -770,8 +761,7 @@ gimp_draw_tool_draw_arc_by_anchor (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x, y, x, y,
&tx, &ty, &tx, &ty);
FALSE);
gimp_draw_tool_shift_to_north_west (tx, ty, gimp_draw_tool_shift_to_north_west (tx, ty,
width, height, width, height,
@ -804,8 +794,7 @@ gimp_draw_tool_draw_cross_by_anchor (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x, y, x, y,
&tx, &ty, &tx, &ty);
FALSE);
gimp_draw_tool_shift_to_center (tx, ty, gimp_draw_tool_shift_to_center (tx, ty,
width, height, width, height,
@ -942,8 +931,8 @@ gimp_draw_tool_draw_corner (GimpDrawTool *draw_tool,
shell = gimp_display_get_shell (draw_tool->display); shell = gimp_display_get_shell (draw_tool->display);
canvas = GIMP_CANVAS (shell->canvas); canvas = GIMP_CANVAS (shell->canvas);
gimp_display_shell_transform_xy (shell, x1, y1, &tx1, &ty1, FALSE); gimp_display_shell_transform_xy (shell, x1, y1, &tx1, &ty1);
gimp_display_shell_transform_xy (shell, x2, y2, &tx2, &ty2, FALSE); gimp_display_shell_transform_xy (shell, x2, y2, &tx2, &ty2);
tw = tx2 - tx1; tw = tx2 - tx1;
th = ty2 - ty1; th = ty2 - ty1;
@ -1361,7 +1350,7 @@ gimp_draw_tool_draw_lines (GimpDrawTool *draw_tool,
coords = g_new (GdkPoint, n_points); coords = g_new (GdkPoint, n_points);
gimp_display_shell_transform_points (shell, gimp_display_shell_transform_points (shell,
points, coords, n_points, FALSE); points, coords, n_points);
if (filled) if (filled)
{ {
@ -1409,7 +1398,7 @@ gimp_draw_tool_draw_strokes (GimpDrawTool *draw_tool,
coords = g_new (GdkPoint, n_points); coords = g_new (GdkPoint, n_points);
gimp_display_shell_transform_coords (shell, gimp_display_shell_transform_coords (shell,
points, coords, n_points, FALSE); points, coords, n_points);
if (filled) if (filled)
{ {
@ -1489,8 +1478,7 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
bound_segs[i].x1 + offset_x, bound_segs[i].x1 + offset_x,
bound_segs[i].y1 + offset_y, bound_segs[i].y1 + offset_y,
&x, &y, &x, &y);
FALSE);
gdk_points[0].x = PROJ_ROUND (CLAMP (x, -1, xmax)); gdk_points[0].x = PROJ_ROUND (CLAMP (x, -1, xmax));
gdk_points[0].y = PROJ_ROUND (CLAMP (y, -1, ymax)); gdk_points[0].y = PROJ_ROUND (CLAMP (y, -1, ymax));
@ -1521,8 +1509,7 @@ gimp_draw_tool_draw_boundary (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
bound_segs[i].x2 + offset_x, bound_segs[i].x2 + offset_x,
bound_segs[i].y2 + offset_y, bound_segs[i].y2 + offset_y,
&x, &y, &x, &y);
FALSE);
gdk_points[n_gdk_points].x = PROJ_ROUND (CLAMP (x, -1, xmax)); gdk_points[n_gdk_points].x = PROJ_ROUND (CLAMP (x, -1, xmax));
gdk_points[n_gdk_points].y = PROJ_ROUND (CLAMP (y, -1, ymax)); gdk_points[n_gdk_points].y = PROJ_ROUND (CLAMP (y, -1, ymax));
@ -1568,8 +1555,7 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
cursor->x, cursor->y, cursor->x, cursor->y,
&tx1, &ty1, &tx1, &ty1);
FALSE);
if (overwrite) if (overwrite)
{ {
@ -1579,8 +1565,7 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
cursor->x + cursor->width, cursor->x + cursor->width,
cursor->y + cursor->height, cursor->y + cursor->height,
&tx2, &ty2, &tx2, &ty2);
FALSE);
x = PROJ_ROUND (tx1); x = PROJ_ROUND (tx1);
y = PROJ_ROUND (ty1); y = PROJ_ROUND (ty1);
@ -1601,8 +1586,7 @@ gimp_draw_tool_draw_text_cursor (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
cursor->x, cursor->x,
cursor->y + cursor->height, cursor->y + cursor->height,
&tx2, &ty2, &tx2, &ty2);
FALSE);
/* vertical line */ /* vertical line */
gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas), gimp_canvas_draw_line (GIMP_CANVAS (shell->canvas),
@ -1659,12 +1643,10 @@ gimp_draw_tool_on_handle (GimpDrawTool *draw_tool,
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
x, y, x, y,
&tx, &ty, &tx, &ty);
FALSE);
gimp_display_shell_transform_xy_f (shell, gimp_display_shell_transform_xy_f (shell,
handle_x, handle_y, handle_x, handle_y,
&handle_tx, &handle_ty, &handle_tx, &handle_ty);
FALSE);
switch (type) switch (type)
{ {

View File

@ -523,8 +523,7 @@ gimp_move_tool_motion (GimpTool *tool,
gimp_display_shell_transform_xy (shell, gimp_display_shell_transform_xy (shell,
coords->x, coords->y, coords->x, coords->y,
&tx, &ty, &tx, &ty);
FALSE);
if (tx < 0 || tx >= shell->disp_width || if (tx < 0 || tx >= shell->disp_width ||
ty < 0 || ty >= shell->disp_height) ty < 0 || ty >= shell->disp_height)

View File

@ -394,7 +394,7 @@ gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel,
segs = g_new (GdkSegment, *num_segs); segs = g_new (GdkSegment, *num_segs);
gimp_display_shell_transform_segments (shell, bsegs, segs, *num_segs, FALSE); gimp_display_shell_transform_segments (shell, bsegs, segs, *num_segs);
g_free (bsegs); g_free (bsegs);
gimp_display_shell_unset_override_cursor (shell); gimp_display_shell_unset_override_cursor (shell);

View File

@ -1409,13 +1409,13 @@ gimp_transform_tool_force_expose_preview (GimpTransformTool *tr_tool)
shell = gimp_display_get_shell (GIMP_DRAW_TOOL (tr_tool)->display); shell = gimp_display_get_shell (GIMP_DRAW_TOOL (tr_tool)->display);
gimp_display_shell_transform_xy_f (shell, tr_tool->tx1, tr_tool->ty1, gimp_display_shell_transform_xy_f (shell, tr_tool->tx1, tr_tool->ty1,
dx + 0, dy + 0, FALSE); dx + 0, dy + 0);
gimp_display_shell_transform_xy_f (shell, tr_tool->tx2, tr_tool->ty2, gimp_display_shell_transform_xy_f (shell, tr_tool->tx2, tr_tool->ty2,
dx + 1, dy + 1, FALSE); dx + 1, dy + 1);
gimp_display_shell_transform_xy_f (shell, tr_tool->tx3, tr_tool->ty3, gimp_display_shell_transform_xy_f (shell, tr_tool->tx3, tr_tool->ty3,
dx + 2, dy + 2, FALSE); dx + 2, dy + 2);
gimp_display_shell_transform_xy_f (shell, tr_tool->tx4, tr_tool->ty4, gimp_display_shell_transform_xy_f (shell, tr_tool->tx4, tr_tool->ty4,
dx + 3, dy + 3, FALSE); dx + 3, dy + 3);
/* find bounding box around preview */ /* find bounding box around preview */
area_x = area_w = (gint) dx[0]; area_x = area_w = (gint) dx[0];
@ -1654,20 +1654,16 @@ gimp_transform_tool_handles_recalc (GimpTransformTool *tr_tool,
gimp_display_shell_transform_xy (gimp_display_get_shell (display), gimp_display_shell_transform_xy (gimp_display_get_shell (display),
tr_tool->tx1, tr_tool->ty1, tr_tool->tx1, tr_tool->ty1,
&dx1, &dy1, &dx1, &dy1);
FALSE);
gimp_display_shell_transform_xy (gimp_display_get_shell (display), gimp_display_shell_transform_xy (gimp_display_get_shell (display),
tr_tool->tx2, tr_tool->ty2, tr_tool->tx2, tr_tool->ty2,
&dx2, &dy2, &dx2, &dy2);
FALSE);
gimp_display_shell_transform_xy (gimp_display_get_shell (display), gimp_display_shell_transform_xy (gimp_display_get_shell (display),
tr_tool->tx3, tr_tool->ty3, tr_tool->tx3, tr_tool->ty3,
&dx3, &dy3, &dx3, &dy3);
FALSE);
gimp_display_shell_transform_xy (gimp_display_get_shell (display), gimp_display_shell_transform_xy (gimp_display_get_shell (display),
tr_tool->tx4, tr_tool->ty4, tr_tool->tx4, tr_tool->ty4,
&dx4, &dy4, &dx4, &dy4);
FALSE);
x1 = MIN (MIN (dx1, dx2), MIN (dx3, dx4)); x1 = MIN (MIN (dx1, dx2), MIN (dx3, dx4));
y1 = MIN (MIN (dy1, dy2), MIN (dy3, dy4)); y1 = MIN (MIN (dy1, dy2), MIN (dy3, dy4));