/[qemacs]/qemacs/image.c
ViewVC logotype

Diff of /qemacs/image.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by chqrlie, Wed May 11 15:12:14 2005 UTC revision 1.5 by chqrlie, Fri May 13 10:14:37 2005 UTC
# Line 148  static void image_display(EditState *s) Line 148  static void image_display(EditState *s)
148      }      }
149  }  }
150    
151  #if 0  #if 1
152    
153  static int gcd(int a, int b)  static int gcd(int a, int b)
154  {  {
# Line 168  static int gcd(int a, int b) Line 168  static int gcd(int a, int b)
168  static void image_resize(EditState *s)  static void image_resize(EditState *s)
169  {  {
170      ImageState *is = s->mode_data;      ImageState *is = s->mode_data;
171        ImageBuffer *ib = s->b->data;
172      int d, w, h;      int d, w, h;
173            
174      /* simplify factors */      /* simplify factors */
# Line 179  static void image_resize(EditState *s) Line 180  static void image_resize(EditState *s)
180      is->yfactor_num /= d;      is->yfactor_num /= d;
181      is->yfactor_den /= d;      is->yfactor_den /= d;
182    
183      w = ((long long)is->img.width * (long long)is->xfactor_num) /      w = ((long long)ib->width * (long long)is->xfactor_num) /
184          is->xfactor_den;          is->xfactor_den;
185      h = ((long long)is->img.height * (long long)is->yfactor_num) /      h = ((long long)ib->height * (long long)is->yfactor_num) /
186          is->yfactor_den;          is->yfactor_den;
187    
188      if (w < 1)      if (w < 1)
# Line 193  static void image_resize(EditState *s) Line 194  static void image_resize(EditState *s)
194      if (w == is->w &&      if (w == is->w &&
195          h == is->h)          h == is->h)
196          return;          return;
197    
198        edit_invalidate(s);
199  }  }
200    
201    
# Line 218  static void image_mult_size(EditState *s Line 221  static void image_mult_size(EditState *s
221      is->xfactor_den *= 100;      is->xfactor_den *= 100;
222      is->yfactor_num *= (100 + percent);      is->yfactor_num *= (100 + percent);
223      is->yfactor_den *= 100;      is->yfactor_den *= 100;
224    
225      image_resize(s);      image_resize(s);
226  }  }
227    
228  static void image_set_size(EditState *s, int w, int h)  static void image_set_size(EditState *s, int w, int h)
229  {  {
230      ImageState *is = s->mode_data;      ImageState *is = s->mode_data;
231        ImageBuffer *ib = s->b->data;
232    
233      if (w < 1 || h < 1) {      if (w < 1 || h < 1) {
234          put_status(s, "Invalid image size");          put_status(s, "Invalid image size");
# Line 231  static void image_set_size(EditState *s, Line 236  static void image_set_size(EditState *s,
236      }      }
237            
238      is->xfactor_num = w;      is->xfactor_num = w;
239      is->xfactor_den = is->img.width;      is->xfactor_den = ib->width;
240      is->yfactor_num = h;      is->yfactor_num = h;
241      is->yfactor_den = is->img.height;      is->yfactor_den = ib->height;
242            
243      image_resize(s);      image_resize(s);
244  }  }
# Line 555  static void image_scroll_up_down(EditSta Line 560  static void image_scroll_up_down(EditSta
560  {  {
561      int d;      int d;
562    
563      h = SCROLL_MHEIGHT;      d = SCROLL_MHEIGHT;
564      if (abs(dir) == 2) {      if (abs(dir) == 2) {
565          /* move 50% */          /* move 50% */
566          d = s->height / 2;          d = s->height / 2;
# Line 805  static CmdDef image_commands[] = { Line 810  static CmdDef image_commands[] = {
810      CMD_( 'b', KEY_NONE, "image-set-background-color",      CMD_( 'b', KEY_NONE, "image-set-background-color",
811            image_set_background_color,            image_set_background_color,
812            "s{Background color (use 'transparent' for tiling): }")            "s{Background color (use 'transparent' for tiling): }")
813  #if 0  #if 1
814      CMD0( 'n', KEY_NONE, "image-normal-size", image_normal_size)      CMD0( 'n', KEY_NONE, "image-normal-size", image_normal_size)
815      CMD1( '>', KEY_NONE, "image-double-size", image_mult_size, 100)      CMD1( '>', KEY_NONE, "image-double-size", image_mult_size, 100)
816      CMD1( '<', KEY_NONE, "image-halve-size", image_mult_size, -50)      CMD1( '<', KEY_NONE, "image-halve-size", image_mult_size, -50)

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26