~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/core/gimpimage-crop.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
87
87
                 gboolean     crop_layers)
88
88
{
89
89
  gint width, height;
 
90
  gint previous_width, previous_height;
90
91
 
91
92
  g_return_if_fail (GIMP_IS_IMAGE (image));
92
93
  g_return_if_fail (GIMP_IS_CONTEXT (context));
93
94
 
 
95
  previous_width  = gimp_image_get_width (image);
 
96
  previous_height = gimp_image_get_height (image);
 
97
 
94
98
  width  = x2 - x1;
95
99
  height = y2 - y1;
96
100
 
123
127
 
124
128
      if (crop_layers)
125
129
        gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_CROP,
126
 
                                     Q_("command|Crop Image"));
 
130
                                     C_("command", "Crop Image"));
127
131
      else
128
132
        gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_IMAGE_RESIZE,
129
133
                                     _("Resize Image"));
130
134
 
131
135
      /*  Push the image size to the stack  */
132
 
      gimp_image_undo_push_image_size (image, NULL);
 
136
      gimp_image_undo_push_image_size (image,
 
137
                                       NULL,
 
138
                                       x1,
 
139
                                       y1,
 
140
                                       width,
 
141
                                       height);
133
142
 
134
143
      /*  Set the new width and height  */
135
144
      g_object_set (image,
179
188
 
180
189
              gimp_item_offsets (item, &off_x, &off_y);
181
190
 
182
 
              lx1 = CLAMP (off_x, 0, image->width);
183
 
              ly1 = CLAMP (off_y, 0, image->height);
 
191
              lx1 = CLAMP (off_x, 0, gimp_image_get_width  (image));
 
192
              ly1 = CLAMP (off_y, 0, gimp_image_get_height (image));
184
193
              lx2 = CLAMP (gimp_item_width  (item) + off_x,
185
 
                           0, image->width);
 
194
                           0, gimp_image_get_width (image));
186
195
              ly2 = CLAMP (gimp_item_height (item) + off_y,
187
 
                           0, image->height);
 
196
                           0, gimp_image_get_height (image));
188
197
 
189
198
              width  = lx2 - lx1;
190
199
              height = ly2 - ly1;
199
208
        }
200
209
 
201
210
      /*  Reposition or remove all guides  */
202
 
      list = image->guides;
 
211
      list = gimp_image_get_guides (image);
203
212
      while (list)
204
213
        {
205
214
          GimpGuide *guide        = list->data;
235
244
        }
236
245
 
237
246
      /*  Reposition or remove sample points  */
238
 
      list = image->sample_points;
 
247
      list = gimp_image_get_sample_points (image);
239
248
      while (list)
240
249
        {
241
250
          GimpSamplePoint *sample_point        = list->data;
262
271
 
263
272
      gimp_image_undo_group_end (image);
264
273
 
265
 
      gimp_image_update (image, 0, 0, image->width, image->height);
266
 
 
267
 
      gimp_viewable_size_changed (GIMP_VIEWABLE (image));
 
274
      gimp_image_update (image,
 
275
                         0, 0,
 
276
                         gimp_image_get_width  (image),
 
277
                         gimp_image_get_height (image));
 
278
 
 
279
      gimp_image_size_changed_detailed (image,
 
280
                                        -x1,
 
281
                                        -y1,
 
282
                                        previous_width,
 
283
                                        previous_height);
 
284
 
268
285
      g_object_thaw_notify (G_OBJECT (image));
269
286
    }
270
287