예제 #1
0
FUNC_STATUS WORD mat_getActualTraits (
    IP_XFORM_HANDLE  hXform,         /* in:  handle for xform */
    DWORD            dwInputAvail,   /* in:  # avail bytes in input buf */
    PBYTE            pbInputBuf,     /* in:  ptr to input buffer */
    PDWORD           pdwInputUsed,   /* out: # bytes used from input buf */
    PDWORD           pdwInputNextPos,/* out: file-pos to read from next */
    PIP_IMAGE_TRAITS pIntraits,      /* out: input image traits */
    PIP_IMAGE_TRAITS pOutTraits)     /* out: output image traits */
{
    PMAT_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* Since there is no header, we'll report no usage of input */
    *pdwInputUsed    = 0;
    *pdwInputNextPos = 0;

    *pIntraits  = g->traits;   /* structure copies */
    *pOutTraits = g->traits;

    /* At this point, nothing will change, so compute internal variables */
    g->dwBytesPerRow = (g->traits.iPixelsPerRow*g->traits.iBitsPerPixel + 7) / 8;

    if (g->traits.iBitsPerPixel == 24) {
        int i;
        for (i=0; i<9; i++) {
            /* we'll use 16 bits of fraction instead of 24 */
            g->mat[i] = (g->mat[i]+(1<<7)) >> 8;
        }
    }
예제 #2
0
EXPORT(WORD) ipGetImageTraits (
    IP_HANDLE         hJob,          /* in:  handle to conversion job */
    LPIP_IMAGE_TRAITS pInputTraits,  /* out: traits of input image */
    LPIP_IMAGE_TRAITS pOutputTraits) /* out: traits of output image */
{
    PINST       g;
    PXFORM_INFO pTail;

    PRINT0 (_T("ipGetImageTraits: hJob=%p\n"), (void*)hJob);
    HANDLE_TO_PTR (hJob, g);
    INSURE (g->xfCount > 0);
    pTail = &(g->xfArray[g->xfCount-1]);

    if (pInputTraits != NULL) {
        INSURE (g->xfArray[0].eState > XS_PARSING_HEADER);
        *pInputTraits = g->xfArray[0].inTraits;
        PRINT0 (_T("InputTraits: hJob=%p PixelsPerRow=%d BitsPerPixel=%d ComponentsPerPixel=%d HorzDPI=%ld VertDPI=%ld Rows=%ld Pages=%d PageNum=%d\n"), 
                       (void*)hJob, pInputTraits->iPixelsPerRow, pInputTraits->iBitsPerPixel, pInputTraits->iComponentsPerPixel, pInputTraits->lHorizDPI, 
                        pInputTraits->lVertDPI, pInputTraits->lNumRows, pInputTraits->iNumPages, pInputTraits->iPageNum);
    }

    if (pOutputTraits != NULL) {
        INSURE (pTail->eState > XS_PARSING_HEADER);
        *pOutputTraits = pTail->outTraits;
        PRINT0 (_T("OutputTraits: hJob=%p PixelsPerRow=%d BitsPerPixel=%d ComponentsPerPixel=%d HorzDPI=%ld VertDPI=%ld Rows=%ld Pages=%d PageNum=%d\n"), 
                       (void*)hJob, pOutputTraits->iPixelsPerRow, pOutputTraits->iBitsPerPixel, pOutputTraits->iComponentsPerPixel, pOutputTraits->lHorizDPI, 
                        pOutputTraits->lVertDPI, pOutputTraits->lNumRows, pOutputTraits->iNumPages, pOutputTraits->iPageNum);
    }

    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #3
0
파일: xtable.c 프로젝트: rfabbri/hplip
static WORD table_getActualTraits (
    IP_XFORM_HANDLE  hXform,         /* in:  handle for xform */
    DWORD            dwInputAvail,   /* in:  # avail bytes in input buf */
    PBYTE            pbInputBuf,     /* in:  ptr to input buffer */
    PDWORD           pdwInputUsed,   /* out: # bytes used from input buf */
    PDWORD           pdwInputNextPos,/* out: file-pos to read from next */
    PIP_IMAGE_TRAITS pIntraits,      /* out: input image traits */
    PIP_IMAGE_TRAITS pOutTraits)     /* out: output image traits */
{
    PTBL_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* Since there is no header, we'll report no usage of input */
    *pdwInputUsed    = 0;
    *pdwInputNextPos = 0;

    *pIntraits  = g->traits;   /* structure copies */
    *pOutTraits = g->traits;

    return IP_DONE | IP_READY_FOR_DATA;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #4
0
FUNC_STATUS WORD invert_convert (
    IP_XFORM_HANDLE hXform,
    DWORD           dwInputAvail,     /* in:  # avail bytes in in-buf */
    PBYTE           pbInputBuf,       /* in:  ptr to in-buffer */
    PDWORD          pdwInputUsed,     /* out: # bytes used from in-buf */
    PDWORD          pdwInputNextPos,  /* out: file-pos to read from next */
    DWORD           dwOutputAvail,    /* in:  # avail bytes in out-buf */
    PBYTE           pbOutputBuf,      /* in:  ptr to out-buffer */
    PDWORD          pdwOutputUsed,    /* out: # bytes written in out-buf */
    PDWORD          pdwOutputThisPos) /* out: file-pos to write the data */
{
    PINVERT_INST g;
    int       nBytes,i;
    PBYTE     pIn, pOut;

    HANDLE_TO_PTR (hXform, g);

    /**** Check if we were told to flush ****/

    if (pbInputBuf == NULL) {
        PRINT (_T("invert_convert: Told to flush.\n"), 0, 0);
        *pdwInputUsed = *pdwOutputUsed = 0;
        *pdwInputNextPos  = g->dwInNextPos;
        *pdwOutputThisPos = g->dwOutNextPos;
        return IP_DONE;
    }

    /**** Output a Row ****/

    nBytes = g->dwBytesPerRow;
    INSURE (dwInputAvail  >= (DWORD)nBytes );
    INSURE (dwOutputAvail >= (DWORD)nBytes);

    pIn  = pbInputBuf;
    pOut = pbOutputBuf;

    /* At this point, pIn is your input buffer, and pOut is your output buffer.
     * Do whatever you are going to do here.
     */
    for (i=0;i<nBytes;i++) {
        pOut[i]=~pIn[i]+g->dwAddToNot;
    }

    *pdwInputUsed     = nBytes;
    g->dwInNextPos   += nBytes;
    *pdwInputNextPos  = g->dwInNextPos;

    *pdwOutputUsed    = nBytes;
    *pdwOutputThisPos = g->dwOutNextPos;
    g->dwOutNextPos  += nBytes;

    g->dwRowsDone += 1;

    return IP_CONSUMED_ROW | IP_PRODUCED_ROW | IP_READY_FOR_DATA;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #5
0
EXPORT(WORD) ipGetOutputTraits (
    IP_HANDLE         hJob,      /* in:  handle to conversion job */
    LPIP_IMAGE_TRAITS pTraits)   /* out: output image traits */
{
    PINST           g;
    IP_IMAGE_TRAITS inTraits, outTraits;
    int        iXform;
    PXFORM_INFO     pXform;
    WORD        result;
    DWORD        dwHeaderLen;
    DWORD        dwInUsed, dwInNextPos;

    HANDLE_TO_PTR (hJob, g);
    INSURE (g->xfCount>=1);
    inTraits = g->xfArray[0].inTraits;  /* set by SetDefaultInputTraits */

    for (iXform=0; iXform<g->xfCount; iXform++) {
        pXform = &(g->xfArray[iXform]);
        INSURE (pXform->eState == XS_NONEXISTENT);

        /* Open the xform, set it up, get the traits, and close it */

        result = pXform->pXform->openXform (&pXform->hXform);
        INSURE (result == IP_DONE);

        result = pXform->pXform->setDefaultInputTraits (
                    pXform->hXform, &inTraits);
        INSURE (result == IP_DONE);

        result = pXform->pXform->setXformSpec (
                    pXform->hXform, pXform->aXformInfo);
        INSURE (result == IP_DONE);

        result = pXform->pXform->getHeaderBufSize (
                    pXform->hXform, &dwHeaderLen);
        INSURE (result == IP_DONE);
        INSURE (dwHeaderLen == 0);

        result = pXform->pXform->getActualTraits (
                    pXform->hXform,
                    0, NULL, &dwInUsed, &dwInNextPos,
                    &inTraits, &outTraits);
        INSURE (result & IP_DONE);

        result = pXform->pXform->closeXform (pXform->hXform);
        INSURE (result == IP_DONE);

        inTraits = outTraits;
        pXform->hXform = NULL;
    }

    *pTraits = outTraits;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #6
0
파일: xcrop.c 프로젝트: Distrotech/hplip
static WORD crop_convert (
    IP_XFORM_HANDLE hXform,
    DWORD           dwInputAvail,     /* in:  # avail bytes in in-buf */
    PBYTE           pbInputBuf,       /* in:  ptr to in-buffer */
    PDWORD          pdwInputUsed,     /* out: # bytes used from in-buf */
    PDWORD          pdwInputNextPos,  /* out: file-pos to read from next */
    DWORD           dwOutputAvail,    /* in:  # avail bytes in out-buf */
    PBYTE           pbOutputBuf,      /* in:  ptr to out-buffer */
    PDWORD          pdwOutputUsed,    /* out: # bytes written in out-buf */
    PDWORD          pdwOutputThisPos) /* out: file-pos to write the data */
{
    PCROP_INST g;
    DWORD      dwOutBytes;

    HANDLE_TO_PTR (hXform, g);

    /**** Check if we were told to flush ****/

    if (pbInputBuf == NULL) {
        PRINT (_T("crop_convert: Told to flush.\n"), 0, 0);
        *pdwInputUsed = *pdwOutputUsed = 0;
        *pdwInputNextPos  = g->dwInNextPos;
        *pdwOutputThisPos = g->dwOutNextPos;
        return IP_DONE;
    }

    /**** Check if we should discard the row (vertical cropping) ****/

    dwOutBytes = (g->dwInRows < g->dwTop  ||  g->dwOutRows >= g->dwMaxOutRows)
                  ? 0 : g->dwOutBytesPerRow;

    /**** Output a Row ****/

    INSURE (dwInputAvail  >= g->dwInBytesPerRow);
    INSURE (dwOutputAvail >= dwOutBytes);

    if (dwOutBytes > 0) {
        memcpy (pbOutputBuf, pbInputBuf+g->dwLeftCropBytes, dwOutBytes);
        g->dwOutRows += 1;
    }

    g->dwInRows += 1;

    *pdwInputUsed     = g->dwInBytesPerRow;
    g->dwInNextPos   += g->dwInBytesPerRow;
    *pdwInputNextPos  = g->dwInNextPos;

    *pdwOutputUsed    = dwOutBytes;
    *pdwOutputThisPos = g->dwOutNextPos;
    g->dwOutNextPos  += dwOutBytes;

    return IP_CONSUMED_ROW | IP_PRODUCED_ROW | IP_READY_FOR_DATA;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #7
0
파일: transaction.c 프로젝트: 01org/murphy
static int add_handle(char *name, mqi_handle_t handle)
{
    if (init() < 0)
        return -1;

    if (mdb_hash_add(transact_handles, 0,name, HANDLE_TO_PTR(handle)) < 0)
        return -1;

    return 0;
}
예제 #8
0
파일: xpnm.c 프로젝트: Distrotech/hplip
FUNC_STATUS WORD pnm_getActualTraits (
    IP_XFORM_HANDLE  hXform,         /* in:  handle for xform */
    DWORD            dwInputAvail,   /* in:  # avail bytes in input buf */
    PBYTE            pbInputBuf,     /* in:  ptr to input buffer */
    PDWORD           pdwInputUsed,   /* out: # bytes used from input buf */
    PDWORD           pdwInputNextPos,/* out: file-pos to read from next */
    PIP_IMAGE_TRAITS pInTraits,      /* out: input image traits */
    PIP_IMAGE_TRAITS pOutTraits)     /* out: output image traits */
{
    PPNM_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* If there is no header, we'll report no usage of input */
    *pdwInputUsed = 0;

    /* Parse the header for decode operations. */
    if (!g->fIsEncode) {
        unsigned char c;
        unsigned int maxval;

        GET_CHAR(&c);
        if (c!='P') {
            return IP_INPUT_ERROR;
        }
        GET_CHAR(&c);
        if (c=='4') {
            /* PBM */
            g->traits.iComponentsPerPixel=1;
            g->traits.iBitsPerPixel=1;

        } else if (c=='5') {
            /* PGM */
            g->traits.iComponentsPerPixel=1;
            g->traits.iBitsPerPixel=0;

        } else if (c=='6') {
            /* PPM */
            g->traits.iComponentsPerPixel=3;
            g->traits.iBitsPerPixel=0;

        } else {
            /* "Plain" (all-ASCII) formats (1-3) not (yet) supported. */
            return IP_INPUT_ERROR;
        }

        GET_INT(&g->traits.iPixelsPerRow);
        GET_INT(&g->traits.lNumRows);
        if (!g->traits.iBitsPerPixel) {
            GET_INT(&maxval);
            while (maxval) {
                g->traits.iBitsPerPixel++;
                maxval>>=1;
            }
        }
예제 #9
0
파일: xthumb.c 프로젝트: Distrotech/hplip
static WORD thumb_newPage (
    IP_XFORM_HANDLE hXform)
{
    PTN_INST g;

    HANDLE_TO_PTR (hXform, g);
    return IP_DONE;   /* can't insert page-breaks, so ignore this call */

    fatal_error:
    return IP_FATAL_ERROR;

}
예제 #10
0
파일: xthumb.c 프로젝트: Distrotech/hplip
static WORD thumb_setXformSpec (
    IP_XFORM_HANDLE hXform,         /* in: handle for xform */
    DWORD_OR_PVOID  aXformInfo[])   /* in: xform information */
{
    PTN_INST g;

    HANDLE_TO_PTR (hXform, g);
    g->iFactorSpec = (int)aXformInfo[IP_THUMB_SCALE_SPEC].dword;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #11
0
파일: xtonemap.c 프로젝트: rfabbri/hplip
static WORD tonemap_newPage (
    IP_XFORM_HANDLE hXform)
{
    PTMAP_INST g;

    HANDLE_TO_PTR (hXform, g);
    /* todo: return fatal error if convert is called again? */
    return IP_DONE;   /* can't insert page-breaks, so ignore this call */

    fatal_error:
    return IP_FATAL_ERROR;

}
예제 #12
0
FUNC_STATUS WORD fakeMono_setXformSpec (
    IP_XFORM_HANDLE hXform,         /* in: handle for xform */
    DWORD_OR_PVOID  aXformInfo[])   /* in: xform information */
{
    PFMON_INST g;
    HANDLE_TO_PTR (hXform, g);
    g->iFakeDPI = aXformInfo[IP_FAKE_MONO_BPP].dword;
    INSURE (g->iFakeDPI==1 || g->iFakeDPI==8);
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #13
0
FUNC_STATUS WORD invert_newPage (
    IP_XFORM_HANDLE hXform)
{
    PINVERT_INST g;

    HANDLE_TO_PTR (hXform, g);
    /* todo: return fatal error if convert is called again? */
    return IP_DONE;   /* can't insert page-breaks, so ignore this call */

    fatal_error:
    return IP_FATAL_ERROR;

}
예제 #14
0
FUNC_STATUS WORD fakeMono_getActualBufSizes (
    IP_XFORM_HANDLE hXform,          /* in:  handle for xform */
    PDWORD          pdwMinInBufLen,  /* out: min input buf size */
    PDWORD          pdwMinOutBufLen) /* out: min output buf size */
{
    PFMON_INST g;
    HANDLE_TO_PTR (hXform, g);
    *pdwMinInBufLen = *pdwMinOutBufLen = g->dwBytesPerRow;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #15
0
파일: xtonemap.c 프로젝트: rfabbri/hplip
static WORD tonemap_closeXform (IP_XFORM_HANDLE hXform)
{
    PTMAP_INST g;

    HANDLE_TO_PTR (hXform, g);

    g->dwValidChk = 0;
    IP_MEM_FREE (g);       /* free memory for the instance */

    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #16
0
FUNC_STATUS WORD invert_closeXform (IP_XFORM_HANDLE hXform)
{
    PINVERT_INST g;

    HANDLE_TO_PTR (hXform, g);

    g->dwValidChk = 0;
    IP_MEM_FREE (g);       /* free memory for the instance */

    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #17
0
파일: xtonemap.c 프로젝트: rfabbri/hplip
static WORD tonemap_setXformSpec (
    IP_XFORM_HANDLE hXform,         /* in: handle for xform */
    DWORD_OR_PVOID  aXformInfo[])   /* in: xform information */
{
    PTMAP_INST g;

    HANDLE_TO_PTR (hXform, g);
    memcpy (g->tonemap, aXformInfo[IP_TONEMAP_POINTER].pvoid, 256);
    g->bLumSpace = aXformInfo[IP_TONEMAP_LUM_SPACE].dword;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #18
0
EXPORT(WORD) ipGetClientDataPtr (
    IP_HANDLE  hJob,            /* in:  handle to conversion job */
    PVOID     *ppvClientData)   /* out: ptr to client's memory area */
{
    PINST g;

    PRINT0 (_T("ipGetClientDataPtr\n"));
    HANDLE_TO_PTR (hJob, g);
    *ppvClientData = (PVOID)((PBYTE)g + sizeof(INST));
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #19
0
EXPORT(WORD) ipResultMask (
    IP_HANDLE  hJob,     /* in:  handle to conversion job */
    WORD       wMask)    /* in:  result bits you are interested in */
{
    PINST g;

    PRINT0 (_T("ipResultMask: hJob=%p, wMask=%04x\n"), (void*)hJob, wMask);
    HANDLE_TO_PTR (hJob, g);
    g->wResultMask = wMask | PERMANENT_RESULTS;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #20
0
파일: xthumb.c 프로젝트: Distrotech/hplip
static WORD thumb_getActualBufSizes (
    IP_XFORM_HANDLE hXform,          /* in:  handle for xform */
    PDWORD          pdwMinInBufLen,  /* out: min input buf size */
    PDWORD          pdwMinOutBufLen) /* out: min output buf size */
{
    PTN_INST g;

    HANDLE_TO_PTR (hXform, g);
    *pdwMinInBufLen  = g->dwInRowBytes;
    *pdwMinOutBufLen = g->dwOutRowBytes;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #21
0
파일: xthumb.c 프로젝트: Distrotech/hplip
static WORD thumb_setDefaultInputTraits (
    IP_XFORM_HANDLE  hXform,     /* in: handle for xform */
    PIP_IMAGE_TRAITS pTraits)    /* in: default image traits */
{
    PTN_INST g;

    HANDLE_TO_PTR (hXform, g);

    INSURE (pTraits->iPixelsPerRow > 0);
    g->inTraits = *pTraits;   /* a structure copy */
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #22
0
파일: xtable.c 프로젝트: rfabbri/hplip
static WORD table_setXformSpec (
    IP_XFORM_HANDLE hXform,         /* in: handle for xform */
    DWORD_OR_PVOID  aXformInfo[])   /* in: xform information */
{
    PTBL_INST g;

    HANDLE_TO_PTR (hXform, g);

    if (! generateTable(g,aXformInfo))
        goto fatal_error;
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #23
0
파일: xthumb.c 프로젝트: Distrotech/hplip
static WORD thumb_closeXform (IP_XFORM_HANDLE hXform)
{
    PTN_INST g;

    HANDLE_TO_PTR (hXform, g);

    if (g->pulSums != NULL)
        IP_MEM_FREE (g->pulSums);
    g->dwValidChk = 0;
    IP_MEM_FREE (g);       /* free memory for the instance */

    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #24
0
파일: xcrop.c 프로젝트: Distrotech/hplip
static WORD crop_setDefaultInputTraits (
    IP_XFORM_HANDLE  hXform,     /* in: handle for xform */
    PIP_IMAGE_TRAITS pTraits)    /* in: default image traits */
{
    PCROP_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* insure that traits we care about are known */
    INSURE (pTraits->iPixelsPerRow>0 && pTraits->iBitsPerPixel>0);
    g->traits = *pTraits;   /* a structure copy */
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #25
0
파일: xpnm.c 프로젝트: Distrotech/hplip
FUNC_STATUS WORD pnmEncode_openXform (
    IP_XFORM_HANDLE *pXform)   /* out: returned handle */
{
    WORD wResult=pnmDecode_openXform(pXform);
    if (wResult==IP_DONE) {
        PPNM_INST g;

        HANDLE_TO_PTR (*pXform, g);

        g->dwOutNextPos=MAX_ENCODE_HEADER_SIZE;
        g->fIsEncode=TRUE;
    }
    return wResult;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #26
0
FUNC_STATUS WORD mat_setXformSpec (
    IP_XFORM_HANDLE hXform,         /* in: handle for xform */
    DWORD_OR_PVOID  aXformInfo[])   /* in: xform information */
{
    PMAT_INST g;
    int       *ptr;

    HANDLE_TO_PTR (hXform, g);

    ptr = (int*)aXformInfo[0].pvoid;
    INSURE (ptr != NULL);
    memcpy (g->mat, ptr, sizeof(g->mat));

    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #27
0
FUNC_STATUS WORD invert_setXformSpec (
    IP_XFORM_HANDLE hXform,         /* in: handle for xform */
    DWORD_OR_PVOID  aXformInfo[])   /* in: xform information */
{
    PINVERT_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* Check your options in aXformInfo here, and save them.
     * Use the INSURE macro like you'd use assert.  INSURE jumps to
     * fatal_error below if it fails.
     */

    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #28
0
FUNC_STATUS WORD mat_setDefaultInputTraits (
    IP_XFORM_HANDLE  hXform,     /* in: handle for xform */
    PIP_IMAGE_TRAITS pTraits)    /* in: default image traits */
{
    PMAT_INST g;

    HANDLE_TO_PTR (hXform, g);

    /* insure that traits we care about are known */
    INSURE (pTraits->iPixelsPerRow > 0);
    INSURE (pTraits->iBitsPerPixel==24 || pTraits->iBitsPerPixel==48);
    INSURE (pTraits->iComponentsPerPixel == 3);

    g->traits = *pTraits;   /* a structure copy */
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #29
0
파일: xpnm.c 프로젝트: Distrotech/hplip
FUNC_STATUS WORD pnm_setDefaultInputTraits (
    IP_XFORM_HANDLE  hXform,     /* in: handle for xform */
    PIP_IMAGE_TRAITS pTraits)    /* in: default image traits */
{
    PPNM_INST g;

    HANDLE_TO_PTR (hXform, g);

    g->traits = *pTraits;   /* a structure copy */
    if (g->fIsEncode) {
        /* insure that traits we care about are known */
        INSURE (pTraits->iPixelsPerRow>0 && pTraits->iBitsPerPixel>0);
        g->dwBytesPerRow = (g->traits.iPixelsPerRow*g->traits.iBitsPerPixel + 7) / 8;
    }
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}
예제 #30
0
파일: xpnm.c 프로젝트: Distrotech/hplip
FUNC_STATUS WORD pnm_getHeaderBufSize (
    IP_XFORM_HANDLE  hXform,         /* in:  handle for xform */
    DWORD           *pdwInBufLen)    /* out: buf size for parsing header */
{
    PPNM_INST g;

    HANDLE_TO_PTR (hXform, g);

    if (!g->fIsEncode) {
        *pdwInBufLen = MAX_DECODE_HEADER_SIZE;
    } else {
        /* since input is raw pixels, there is no header, so set it to zero */
        *pdwInBufLen = 0;
    }
    return IP_DONE;

    fatal_error:
    return IP_FATAL_ERROR;
}