IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 31, 2004, 9:36:02 AM (22 years ago)
Author:
desonia
Message:

added test for psImage of PS_TYPE_PTR.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImage.c

    r1606 r1664  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-08-23 22:36:03 $
     8 *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-08-31 19:36:02 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6363                                 0,1,100,1,150,100
    6464                             };
    65     unsigned int types = 12;
     65    unsigned int types = 13;
    6666    psElemType type[] = { PS_TYPE_S8, PS_TYPE_S16, PS_TYPE_S32, PS_TYPE_S64,
    6767                          PS_TYPE_U8, PS_TYPE_U16, PS_TYPE_U32, PS_TYPE_U64,
    68                           PS_TYPE_F32, PS_TYPE_F64, PS_TYPE_C32, PS_TYPE_C64 };
     68                          PS_TYPE_F32, PS_TYPE_F64, PS_TYPE_C32, PS_TYPE_C64,
     69                          PS_TYPE_PTR };
    6970
    7071    psLogMsg(__func__,PS_LOG_INFO,"#546 - psImageAlloc shall allocate memory for a psImage structure");
     
    7475
    7576        for (unsigned int i=0;i<sizes;i++) {
     77
     78            if (numRows[i] == 0 || numCols[i] == 0) {
     79                psLogMsg(__func__,PS_LOG_INFO,"Following should be an error.");
     80            }
    7681
    7782            image = psImageAlloc(numCols[i],numRows[i],type[t]);
     
    206211                        }
    207212                    }
     213                }
     214                break;
     215            case PS_TYPE_PTR: {
     216                    unsigned int rows = numRows[i];
     217                    unsigned int cols = numCols[i];
     218                    psImage* temp = psImageAlloc(1,1,PS_TYPE_F32);
     219
     220                    for (int r=0;r<rows;r++) {
     221                        for (int c=0;c<cols;c++) {
     222                            image->data.PTR[r][c] = psMemIncrRefCounter(temp);
     223                        }
     224                    }
     225                    for (int r=0;r<rows;r++) {
     226                        for (int c=0;c<cols;c++) {
     227                            if (image->data.PTR[r][c] != temp) {
     228                                psError(__func__, "Could not set pixel in pointer image at (%d,%d): %x %x",
     229                                        c,r,image->data.PTR[r][c],temp);
     230                                psFree(image);
     231                                psFree(temp);
     232                                return 8;
     233                            }
     234                        }
     235                    }
     236                    psFree(temp);
    208237                }
    209238                break;
Note: See TracChangeset for help on using the changeset viewer.