Subversion Repositories HelenOS

Rev

Rev 1709 | Rev 1787 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1709 Rev 1720
Line 54... Line 54...
54
        *num += **data - '0';
54
        *num += **data - '0';
55
        (*data)++;
55
        (*data)++;
56
    }
56
    }
57
}
57
}
58
 
58
 
59
int ppm_get_data(unsigned char *data, size_t dtsz, int *width, int *height)
59
int ppm_get_data(unsigned char *data, size_t dtsz, unsigned int *width, unsigned int *height)
60
{
60
{
61
    /* Read magic */
61
    /* Read magic */
62
    if (data[0] != 'P' || data[1] != '6')
62
    if (data[0] != 'P' || data[1] != '6')
63
        return EINVAL;
63
        return EINVAL;
64
 
64
 
Line 87... Line 87...
87
         putpixel_cb_t putpixel, void *vport)
87
         putpixel_cb_t putpixel, void *vport)
88
{
88
{
89
    unsigned int width, height;
89
    unsigned int width, height;
90
    unsigned int maxcolor;
90
    unsigned int maxcolor;
91
    int i;
91
    int i;
92
    void *maxdatap = data + datasz;
-
 
93
    unsigned int color;
92
    unsigned int color;
94
    unsigned int coef;
93
    unsigned int coef;
95
 
94
 
96
    /* Read magic */
95
    /* Read magic */
97
    if (data[0] != 'P' || data[1] != '6')
96
    if (data[0] != 'P' || data[1] != '6')
Line 122... Line 121...
122
        color = ((data[0]*coef) << 16) + ((data[1]*coef) << 8) + data[2]*coef;
121
        color = ((data[0]*coef) << 16) + ((data[1]*coef) << 8) + data[2]*coef;
123
       
122
       
124
        (*putpixel)(vport, sx+(i % width), sy+(i / width), color);
123
        (*putpixel)(vport, sx+(i % width), sy+(i / width), color);
125
        data += 3;
124
        data += 3;
126
    }
125
    }
-
 
126
 
-
 
127
    return 0;
127
}
128
}