[BACK]Return to amidisplaycc.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / amiga / dev

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/amiga/dev/amidisplaycc.c between version 1.12 and 1.13

version 1.12, 2003/07/14 15:56:39 version 1.13, 2003/11/12 17:26:36
Line 1396  amidisplaycc_free_screen(void *dp, void 
Line 1396  amidisplaycc_free_screen(void *dp, void 
         struct amidisplaycc_softc   * adp;          struct amidisplaycc_softc   * adp;
   
         scr = screen;          scr = screen;
         adp = (struct amidisplaycc_softc*)adp;          adp = (struct amidisplaycc_softc*)dp;
   
         if (scr == NULL)          if (scr == NULL)
                 return;                  return;
Line 1890  amidisplaycc_setcmap(view_t *view, struc
Line 1890  amidisplaycc_setcmap(view_t *view, struc
 {  {
         u_long      cmentries [MAXCOLORS];          u_long      cmentries [MAXCOLORS];
   
         int         green_div;  
         int         blue_div;  
         int         grey_div;  
         int         red_div;  
         u_int       colors;          u_int       colors;
         int         index;          int         index;
         int         count;          int         count;
         int         err;          int         err;
         colormap_t  cm;          colormap_t  cm;
         int         c;  
   
         if (view == NULL)          if (view == NULL)
                 return (EINVAL);                  return (EINVAL);
Line 1940  amidisplaycc_setcmap(view_t *view, struc
Line 1935  amidisplaycc_setcmap(view_t *view, struc
          */           */
   
         if (cm.type == CM_COLOR) {          if (cm.type == CM_COLOR) {
                   int c, green_div, blue_div, red_div;
   
                 red_div = 256 / (cm.red_mask + 1);                  red_div = 256 / (cm.red_mask + 1);
                 green_div = 256 / (cm.green_mask + 1);                  green_div = 256 / (cm.green_mask + 1);
                 blue_div = 256 / (cm.blue_mask + 1);                  blue_div = 256 / (cm.blue_mask + 1);
         } else if (cm.type == CM_GREYSCALE)  
                 grey_div = 256 / (cm.grey_mask + 1);                  for (c = 0 ; c < count ; c++)
         else  
                 return (EINVAL); /* Hmhh */  
   
         /* Copy our new values to the current colormap */  
   
         for (c = 0 ; c < count ; c++) {  
   
                 if (cm.type == CM_COLOR) {  
   
                         cm.entry[c + index] = MAKE_COLOR_ENTRY(                          cm.entry[c + index] = MAKE_COLOR_ENTRY(
                                 cmap->red[c] / red_div,                                  cmap->red[c] / red_div,
                                 cmap->green[c] / green_div,                                  cmap->green[c] / green_div,
                                 cmap->blue[c] / blue_div);                                  cmap->blue[c] / blue_div);
   
                 } else if (cm.type == CM_GREYSCALE) {          } else if (cm.type == CM_GREYSCALE) {
                   int c, grey_div;
   
                         /* Generate grey from average of r-g-b (?) */                  grey_div = 256 / (cm.grey_mask + 1);
   
                   /* Generate grey from average of r-g-b (?) */
                   for (c = 0 ; c < count ; c++)
                         cm.entry[c + index] = MAKE_COLOR_ENTRY(                          cm.entry[c + index] = MAKE_COLOR_ENTRY(
                                 0,                                  0,
                                 0,                                  0,
                                 (cmap->red[c] +                                  (cmap->red[c] +
                                  cmap->green[c] +                                   cmap->green[c] +
                                  cmap->blue[c]) / 3 / grey_div);                                   cmap->blue[c]) / 3 / grey_div);
                 }          } else
         }                  return (EINVAL); /* Hmhh */
   
   
         /*          /*
          * Now we have a new colormap that contains all the entries. Set           * Now we have a new colormap that contains all the entries. Set
Line 1994  amidisplaycc_getcmap(view_t *view, struc
Line 1984  amidisplaycc_getcmap(view_t *view, struc
 {  {
         u_long      cmentries [MAXCOLORS];          u_long      cmentries [MAXCOLORS];
   
         int         green_mul;  
         int         blue_mul;  
         int         grey_mul;  
         int         red_mul;  
         u_int       colors;          u_int       colors;
         int         index;          int         index;
         int         count;          int         count;
         int         err;          int         err;
         colormap_t  cm;          colormap_t  cm;
         int         c;  
   
         if (view == NULL)          if (view == NULL)
                 return (EINVAL);                  return (EINVAL);
Line 2025  amidisplaycc_getcmap(view_t *view, struc
Line 2010  amidisplaycc_getcmap(view_t *view, struc
         cm.first = index;          cm.first = index;
         cm.size  = count;          cm.size  = count;
   
   
         err = grf_get_colormap(view, &cm);          err = grf_get_colormap(view, &cm);
         if (err)          if (err)
                 return (err);                  return (err);
   
         if (cm.type == CM_COLOR) {  
                 red_mul   = 256 / (cm.red_mask + 1);  
                 green_mul = 256 / (cm.green_mask + 1);  
                 blue_mul  = 256 / (cm.blue_mask + 1);  
         } else if (cm.type == CM_GREYSCALE) {  
                 grey_mul  = 256 / (cm.grey_mask + 1);  
         } else  
                 return (EINVAL);  
   
         /*          /*
          * Copy color data to wscons-style structure. Translate to           * Copy color data to wscons-style structure. Translate to
          * 8 bits/gun from whatever resolution the color natively is.           * 8 bits/gun from whatever resolution the color natively is.
          */           */
           if (cm.type == CM_COLOR) {
                   int c, red_mul, green_mul, blue_mul;
   
                   red_mul   = 256 / (cm.red_mask + 1);
                   green_mul = 256 / (cm.green_mask + 1);
                   blue_mul  = 256 / (cm.blue_mask + 1);
   
         for (c = 0 ; c < count ; c++) {                  for (c = 0 ; c < count ; c++) {
                           cmap->red[c] = red_mul *
                 if (cm.type == CM_COLOR) {                                  CM_GET_RED(cm.entry[index+c]);
                           cmap->green[c] = green_mul *
                         cmap->red[c]   = CM_GET_RED(cm.entry[index+c]);                                  CM_GET_GREEN(cm.entry[index+c]);
                         cmap->green[c] = CM_GET_GREEN(cm.entry[index+c]);                          cmap->blue[c] = blue_mul *
                         cmap->blue[c]  = CM_GET_BLUE(cm.entry[index+c]);                                  CM_GET_BLUE(cm.entry[index+c]);
                   }
                         cmap->red[c]   *= red_mul;          } else if (cm.type == CM_GREYSCALE) {
                         cmap->green[c] *= green_mul;                  int c, grey_mul;
                         cmap->blue[c]  *= blue_mul;  
   
                 } else if (cm.type == CM_GREYSCALE) {                  grey_mul = 256 / (cm.grey_mask + 1);
                         cmap->red[c]   = CM_GET_GREY(cm.entry[index+c]);  
                         cmap->red[c]  *= grey_mul;  
   
                         cmap->green[c] = cmap->red[c];                  for (c = 0 ; c < count ; c++) {
                         cmap->blue[c]  = cmap->red[c];                          cmap->red[c] = grey_mul *
                                   CM_GET_GREY(cm.entry[index+c]);
                           cmap->green[c] = grey_mul *
                                   CM_GET_GREY(cm.entry[index+c]);
                           cmap->blue[c] = grey_mul *
                                   CM_GET_GREY(cm.entry[index+c]);
                 }                  }
         }          } else
                   return (EINVAL);
   
         return (0);          return (0);
 }  }

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

CVSweb <webmaster@jp.NetBSD.org>