IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 21, 2005, 1:28:39 PM (21 years ago)
Author:
desonia
Message:

in-process of changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psPixels.c

    r3737 r3741  
    77 *  @author Robert DeSonia, MHPCC
    88 *
    9  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2005-04-21 21:18:23 $
     9 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2005-04-21 23:28:39 $
    1111 *
    1212 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    1919#include "psMemory.h"
    2020
    21 typedef struct
    22 {
    23     psS32 x;
    24     psS32 y;
    25 }
    26 p_psPixelCoord;
    27 
    2821typedef int(*qsortCompareFcn)(const void *, const void *);
    2922
     
    3124{
    3225    if (pixels != NULL) {
    33         psFree(pixels->x);
    34         psFree(pixels->y);
     26        psFree(pixels->data);
    3527    }
    3628}
    3729
    3830// for use by qsort, etc.
    39 static int comparePixelCoord(p_psPixelCoord* coord1, p_psPixelCoord* coord2)
     31static int comparePixelCoord(psPixelCoord* coord1, psPixelCoord* coord2)
    4032{
    4133    // check row first
     
    6557
    6658    if (size > 0) {
    67         out->x = psVectorAlloc(size, PS_TYPE_S32);
    68         out->y = psVectorAlloc(size, PS_TYPE_S32);
     59        out->data = psAlloc(sizeof(psPixelCoord)*size);
    6960    } else {
    70         out->x = NULL;
    71         out->y = NULL;
     61        out->data = NULL;
    7262    }
    7363
     
    8373    }
    8474
    85     pixels->x = psVectorRealloc(pixels->x, size);
    86     pixels->y = psVectorRealloc(pixels->y, size);
     75    pixels->data = psRealloc(pixels->data, sizeof(psPixelCoord)*size);
    8776
    8877    return pixels;
     
    9786        return NULL;
    9887    }
    99     psVector* xVec = pixels->x;
    100     psVector* yVec = pixels->y;
    101     if (xVec == NULL || yVec == NULL) {
    102         // XXX: Error message
    103         psFree(out);
    104         return NULL;
    105     }
    106     if (xVec->type.type != PS_TYPE_S32) {
    107         // XXX: Error message
    108         psFree(out);
    109         return NULL;
    110     }
    111     if (yVec->type.type != PS_TYPE_S32) {
     88    psPixelCoord* data = pixels->data;
     89    if (data == NULL) {
    11290        // XXX: Error message
    11391        psFree(out);
     
    151129
    152130    // determine the length of the pixel vector
    153     int length = pixels->x->n;
    154     if (pixels->y->n != length) {
    155         // XXX: warning message
    156         if (pixels->y->n < length) {
    157             length = pixels->y->n;
    158         }
    159     }
     131    int length = pixels->n;
    160132
    161133    // cycle through the vector of pixels and insert pixels into image
    162134    psMaskType** outData = out->data.PS_TYPE_MASK_DATA;
    163135    for (int p = 0; p < length; p++) {
    164         psS32 x = xVec->data.S32[p];
    165         psS32 y = yVec->data.S32[p];
     136        psS32 x = data[p].x;
     137        psS32 y = data[p].y;
    166138        // pixel in region?
    167139        if (x >= x0 && x < x1 && y >= y0 && y < y1) {
     
    198170        out = psPixelsAlloc(minPixels);
    199171    }
    200     psVector* xVec = out->x;
    201     psVector* yVec = out->y;
     172    psPixelCoord* data = out->data;
    202173
    203174    // check the x and y vector validity (type/minimum size)
Note: See TracChangeset for help on using the changeset viewer.