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

Diff of /qemacs/image.c

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

revision 1.3 by chqrlie, Sun May 8 16:31:48 2005 UTC revision 1.4 by chqrlie, Wed May 11 15:12:14 2005 UTC
# Line 45  int qe_bitmap_format_to_pix_fmt(int form Line 45  int qe_bitmap_format_to_pix_fmt(int form
45  {  {
46      int dst_pix_fmt;      int dst_pix_fmt;
47    
48      switch(format) {      switch (format) {
49      case QEBITMAP_FORMAT_YUV420P:      case QEBITMAP_FORMAT_YUV420P:
50          dst_pix_fmt = PIX_FMT_YUV420P;          dst_pix_fmt = PIX_FMT_YUV420P;
51          break;          break;
# Line 113  void draw_alpha_grid(EditState *s, int x Line 113  void draw_alpha_grid(EditState *s, int x
113      int state, x, y;      int state, x, y;
114      unsigned int color;      unsigned int color;
115            
116      for(y = 0; y < h; y += 16) {      for (y = 0; y < h; y += 16) {
117          for(x = 0; x < w; x += 16) {          for (x = 0; x < w; x += 16) {
118              state = (x ^ y) & 16;              state = (x ^ y) & 16;
119              if (state)              if (state)
120                  color = QERGB(0x94, 0x94, 0x94);                  color = QERGB(0x94, 0x94, 0x94);
# Line 301  static int read_image_cb(void *opaque, A Line 301  static int read_image_cb(void *opaque, A
301          return AVERROR_NOMEM;          return AVERROR_NOMEM;
302      ib->interleaved = info->interleaved;      ib->interleaved = info->interleaved;
303      b->data = ib;      b->data = ib;
304      for(i=0;i<4;i++) {      for (i = 0; i < 4; i++) {
305          info->pict.linesize[i] = ib->pict.linesize[i];          info->pict.linesize[i] = ib->pict.linesize[i];
306          info->pict.data[i] = ib->pict.data[i];          info->pict.data[i] = ib->pict.data[i];
307      }      }
# Line 425  static void update_bmp(EditState *s) Line 425  static void update_bmp(EditState *s)
425          bg_r = (is->background_color >> 16) & 0xff;          bg_r = (is->background_color >> 16) & 0xff;
426          bg_g = (is->background_color >> 8) & 0xff;          bg_g = (is->background_color >> 8) & 0xff;
427          bg_b = (is->background_color) & 0xff;          bg_b = (is->background_color) & 0xff;
428          for(y = 0; y < is->h; y++) {          for (y = 0; y < is->h; y++) {
429              d = d1;              d = d1;
430              for(x = 0; x < is->w; x++) {              for (x = 0; x < is->w; x++) {
431                  if (is->background_color == 0) {                  if (is->background_color == 0) {
432                      state = (x ^ y) & 16;                      state = (x ^ y) & 16;
433                      if (state) {                      if (state) {
# Line 459  static void update_bmp(EditState *s) Line 459  static void update_bmp(EditState *s)
459      bmp_lock(s->screen, is->disp_bmp, &pict,      bmp_lock(s->screen, is->disp_bmp, &pict,
460               0, 0, is->w, is->h);               0, 0, is->w, is->h);
461            
462      for(i=0;i<4;i++) {      for (i = 0; i < 4; i++) {
463          avpict.data[i] = pict.data[i];          avpict.data[i] = pict.data[i];
464          avpict.linesize[i] = pict.linesize[i];          avpict.linesize[i] = pict.linesize[i];
465      }      }
# Line 557  static void image_scroll_up_down(EditSta Line 557  static void image_scroll_up_down(EditSta
557    
558      h = SCROLL_MHEIGHT;      h = SCROLL_MHEIGHT;
559      if (abs(dir) == 2) {      if (abs(dir) == 2) {
560          /* move 50% */          /* move 50% */
561          d = s->height / 2;          d = s->height / 2;
562          dir /= 2;          dir /= 2;
563      }      }
564      if (d < 1)      if (d < 1)
565          d = 1;          d = 1;
# Line 597  static int img_rotate(AVPicture *dst, Line 597  static int img_rotate(AVPicture *dst,
597      uint8_t *d, *d1;      uint8_t *d, *d1;
598      const uint8_t *s, *s1;      const uint8_t *s, *s1;
599    
600      switch(pix_fmt) {      switch (pix_fmt) {
601      case PIX_FMT_GRAY8:      case PIX_FMT_GRAY8:
602      case PIX_FMT_PAL8:      case PIX_FMT_PAL8:
603          bpp = 1;          bpp = 1;
# Line 617  static int img_rotate(AVPicture *dst, Line 617  static int img_rotate(AVPicture *dst,
617      dlinesize = dst->linesize[0];      dlinesize = dst->linesize[0];
618      d1 = dst->data[0] + (h - 1) * bpp;      d1 = dst->data[0] + (h - 1) * bpp;
619            
620      for(y=0;y<h;y++) {      for (y = 0; y < h; y++) {
621          s = s1;          s = s1;
622          d = d1;          d = d1;
623                    
624          switch(pix_fmt) {          switch (pix_fmt) {
625          case PIX_FMT_PAL8:          case PIX_FMT_PAL8:
626          case PIX_FMT_GRAY8:          case PIX_FMT_GRAY8:
627              for(x=0;x<w;x++) {              for (x = 0; x < w; x++) {
628                  d[0] = s[0];                  d[0] = s[0];
629                  s++;                  s++;
630                  d += dlinesize;                  d += dlinesize;
# Line 632  static int img_rotate(AVPicture *dst, Line 632  static int img_rotate(AVPicture *dst,
632              break;              break;
633          case PIX_FMT_RGB24:          case PIX_FMT_RGB24:
634          case PIX_FMT_BGR24:          case PIX_FMT_BGR24:
635              for(x=0;x<w;x++) {              for (x = 0; x < w; x++) {
636                  d[0] = s[0];                  d[0] = s[0];
637                  d[1] = s[1];                  d[1] = s[1];
638                  d[2] = s[2];                  d[2] = s[2];
# Line 641  static int img_rotate(AVPicture *dst, Line 641  static int img_rotate(AVPicture *dst,
641              }              }
642              break;              break;
643          case PIX_FMT_RGBA32:          case PIX_FMT_RGBA32:
644              for(x=0;x<w;x++) {              for (x = 0; x < w; x++) {
645                  ((uint32_t *)d)[0] = ((uint32_t *)s)[0];                  ((uint32_t *)d)[0] = ((uint32_t *)s)[0];
646                  s += 4;                  s += 4;
647                  d += dlinesize;                  d += dlinesize;
# Line 712  static void image_convert(EditState *e, Line 712  static void image_convert(EditState *e,
712      ImageBuffer *ib1;      ImageBuffer *ib1;
713      const char *name;      const char *name;
714            
715      for(i = 0; i < PIX_FMT_NB; i++) {      for (i = 0; i < PIX_FMT_NB; i++) {
716          name = avcodec_get_pix_fmt_name(i);          name = avcodec_get_pix_fmt_name(i);
717          if (!strcmp(pix_fmt_str, name))          if (!strcmp(pix_fmt_str, name))
718              goto found;              goto found;
# Line 790  static void pixel_format_completion(Stri Line 790  static void pixel_format_completion(Stri
790      const char *name;      const char *name;
791            
792      len = strlen(str);      len = strlen(str);
793      for(i = 0; i < PIX_FMT_NB; i++) {      for (i = 0; i < PIX_FMT_NB; i++) {
794          name = avcodec_get_pix_fmt_name(i);          name = avcodec_get_pix_fmt_name(i);
795          if (!strncmp(name, str, len))          if (!strncmp(name, str, len))
796              add_string(cs, name);              add_string(cs, name);
# Line 801  static void pixel_format_completion(Stri Line 801  static void pixel_format_completion(Stri
801  static CmdDef image_commands[] = {  static CmdDef image_commands[] = {
802      CMD0( 't', KEY_NONE, "image-rotate", image_rotate)      CMD0( 't', KEY_NONE, "image-rotate", image_rotate)
803      CMD_( 'c', KEY_NONE, "image-convert", image_convert,      CMD_( 'c', KEY_NONE, "image-convert", image_convert,
804            "s{New pixel format: }[pixel_format]|pixel_format|")            "s{New pixel format: }[pixel_format]|pixel_format|")
805      CMD_( 'b', KEY_NONE, "image-set-background-color",      CMD_( 'b', KEY_NONE, "image-set-background-color",
806            image_set_background_color,            image_set_background_color,
807            "s{Background color (use 'transparent' for tiling): }")            "s{Background color (use 'transparent' for tiling): }")
808  #if 0  #if 0
809      CMD0( 'n', KEY_NONE, "image-normal-size", image_normal_size)      CMD0( 'n', KEY_NONE, "image-normal-size", image_normal_size)
810      CMD1( '>', KEY_NONE, "image-double-size", image_mult_size, 100)      CMD1( '>', KEY_NONE, "image-double-size", image_mult_size, 100)
# Line 812  static CmdDef image_commands[] = { Line 812  static CmdDef image_commands[] = {
812      CMD1( '.', KEY_NONE, "image-larger-10", image_mult_size, 10)      CMD1( '.', KEY_NONE, "image-larger-10", image_mult_size, 10)
813      CMD1( ',', KEY_NONE, "image-smaller-10", image_mult_size, -10)      CMD1( ',', KEY_NONE, "image-smaller-10", image_mult_size, -10)
814      CMD_( 'S', KEY_NONE, "image-set-display-size", image_set_size,      CMD_( 'S', KEY_NONE, "image-set-display-size", image_set_size,
815            "i{Displayed width: }i{Displayed height: }")            "i{Displayed width: }i{Displayed height: }")
816  #endif  #endif
817      CMD_DEF_END,      CMD_DEF_END,
818  };  };

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

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