~ubuntu-branches/ubuntu/raring/hplip/raring

« back to all changes in this revision

Viewing changes to prnt/hpijs/scaler.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2009-12-14 20:08:44 UTC
  • mfrom: (2.1.118 lucid)
  • Revision ID: james.westby@ubuntu.com-20091214200844-z8qhqwgppbu3t7ze
Tags: 3.9.10-4
KBSD patch from KiBi (Closes: #560796)

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
    ASSERT(denominator > 0);
44
44
 
45
45
    constructor_error=NO_ERROR;
 
46
    for (int i = COLORTYPE_COLOR; i < MAX_COLORTYPE; i++)
 
47
    {
 
48
        pOutputBuffer[i] = NULL;
 
49
    }
46
50
 
47
51
    ScaleFactor= (float)numerator / (float)denominator;
48
52
    if (ScaleFactor > (float)MAX_OUTPUT_RASTERS)      //
55
59
    rem *= 1000;
56
60
    remainder = (int)rem;
57
61
 
58
 
    iOutputWidth = (int)(
59
 
                             ((float)iInputWidth / (float)denominator) *
60
 
                                (float)numerator);
 
62
    iOutputWidth = (int) (((float) iInputWidth / (float) denominator) *
 
63
                          (float) numerator);
61
64
    iOutputWidth++;         // safety measure to protect against roundoff error
62
65
 
63
66
    if (numerator == denominator)
79
82
    {
80
83
        constructor_error=ALLOCMEM_ERROR;
81
84
        return;
82
 
    }
 
85
    }
 
86
 
 
87
//  Initialize RGB buffer to white
 
88
    if (vip)
 
89
    {
 
90
        memset(pOutputBuffer[COLORTYPE_COLOR], 0xFF, RSBuffSize);
 
91
    }
 
92
 
83
93
        int BlackBuffSize= (int)(((float)(iOutputWidth)) * ScaleBound );
84
94
    pOutputBuffer[COLORTYPE_BLACK]=(BYTE*)pSS->AllocMem(BlackBuffSize);
85
95
    if (pOutputBuffer[COLORTYPE_BLACK] == NULL)