Changeset 6377


Ignore:
Timestamp:
01/07/12 21:59:06 (18 months ago)
Author:
cristy
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ImageMagick/branches/ImageMagick-6.7.4/magick/attribute.c

    r6375 r6377  
    853853      return(MagickTrue); 
    854854    } 
    855   /* 
    856     Scale pixels to desired depth. 
    857   */ 
    858   status=MagickTrue; 
    859855  range=GetQuantumRange(depth); 
    860   exception=(&image->exception); 
    861   image_view=AcquireCacheView(image); 
    862 #if defined(MAGICKCORE_OPENMP_SUPPORT) 
    863   #pragma omp parallel for schedule(static,4) shared(status) 
    864 #endif 
    865   for (y=0; y < (ssize_t) image->rows; y++) 
    866   { 
    867     register IndexPacket 
    868       *restrict indexes; 
    869  
    870     register ssize_t 
    871       x; 
    872  
    873     register PixelPacket 
    874       *restrict q; 
    875  
    876     if (status == MagickFalse) 
    877       continue; 
    878     q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1, 
    879       exception); 
    880     if (q == (PixelPacket *) NULL) 
    881       { 
    882         status=MagickFalse; 
    883         continue; 
    884       } 
    885     indexes=GetCacheViewAuthenticIndexQueue(image_view); 
    886     for (x=0; x < (ssize_t) image->columns; x++) 
    887     { 
    888       if ((channel & RedChannel) != 0) 
    889         SetPixelRed(q,ScaleAnyToQuantum(ScaleQuantumToAny(GetPixelRed(q), 
    890           range),range)); 
    891       if ((channel & GreenChannel) != 0) 
    892         SetPixelGreen(q,ScaleAnyToQuantum(ScaleQuantumToAny(GetPixelGreen(q), 
    893           range),range)); 
    894       if ((channel & BlueChannel) != 0) 
    895         SetPixelBlue(q,ScaleAnyToQuantum(ScaleQuantumToAny(GetPixelBlue(q), 
    896           range),range)); 
    897       if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse)) 
    898         SetPixelOpacity(q,ScaleAnyToQuantum(ScaleQuantumToAny( 
    899           GetPixelOpacity(q),range),range)); 
    900       q++; 
    901     } 
    902     if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) 
    903       { 
    904         status=MagickFalse; 
    905         continue; 
    906       } 
    907   } 
    908   image_view=DestroyCacheView(image_view); 
    909856  if (image->storage_class == PseudoClass) 
    910857    { 
     
    932879        p++; 
    933880      } 
    934     } 
    935   image->depth=depth; 
     881      status=SyncImage(image); 
     882      if (status != MagickFalse) 
     883        image->depth=depth; 
     884      return(status); 
     885    } 
     886  /* 
     887    Scale pixels to desired depth. 
     888  */ 
     889  status=MagickTrue; 
     890  exception=(&image->exception); 
     891  image_view=AcquireCacheView(image); 
     892#if defined(MAGICKCORE_OPENMP_SUPPORT) 
     893  #pragma omp parallel for schedule(static,4) shared(status) 
     894#endif 
     895  for (y=0; y < (ssize_t) image->rows; y++) 
     896  { 
     897    register ssize_t 
     898      x; 
     899 
     900    register PixelPacket 
     901      *restrict q; 
     902 
     903    if (status == MagickFalse) 
     904      continue; 
     905    q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); 
     906    if (q == (PixelPacket *) NULL) 
     907      { 
     908        status=MagickFalse; 
     909        continue; 
     910      } 
     911    for (x=0; x < (ssize_t) image->columns; x++) 
     912    { 
     913      if ((channel & RedChannel) != 0) 
     914        SetPixelRed(q,ScaleAnyToQuantum(ScaleQuantumToAny(GetPixelRed(q), 
     915          range),range)); 
     916      if ((channel & GreenChannel) != 0) 
     917        SetPixelGreen(q,ScaleAnyToQuantum(ScaleQuantumToAny(GetPixelGreen(q), 
     918          range),range)); 
     919      if ((channel & BlueChannel) != 0) 
     920        SetPixelBlue(q,ScaleAnyToQuantum(ScaleQuantumToAny(GetPixelBlue(q), 
     921          range),range)); 
     922      if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse)) 
     923        SetPixelOpacity(q,ScaleAnyToQuantum(ScaleQuantumToAny( 
     924          GetPixelOpacity(q),range),range)); 
     925      q++; 
     926    } 
     927    if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) 
     928      { 
     929        status=MagickFalse; 
     930        continue; 
     931      } 
     932  } 
     933  image_view=DestroyCacheView(image_view); 
     934  if (status != MagickFalse) 
     935    image->depth=depth; 
    936936  return(status); 
    937937} 
Note: See TracChangeset for help on using the changeset viewer.