Project

General

Profile

Revision 112

fixed problemin 3rd function

View differences:

lab5.c
184 184
        if (vg_exit()) printf("%s: vg_exit failed to exit to text mode.\n", __func__);
185 185
        return 1;
186 186
    }
187

  
187 188
    uint16_t W = get_XRes()/no_rectangles;
188 189
    uint16_t H = get_YRes()/no_rectangles;
189 190
    uint32_t color, R, G, B;
190 191
    for(uint8_t row = 0; row < no_rectangles; ++row){
191 192
        for(uint8_t col = 0; col < no_rectangles; ++col){
192
            if(mode == 0x105){
193
            if(get_bytes_pixel() == 1){
193 194
                color = (first + (row * no_rectangles + col) * step) % (1 << get_bits_pixel());
194 195
            }else{
195
                R = (first + col*step) % (1 << get_RedMaskSize());
196
                G = (first + row*step) % (1 << get_GreenMaskSize());
197
                B = (first + (col+row)*step) % (1 << get_BlueMaskSize());
196
                R = (0xFF&(first>>16) + col*step) % (1 << get_RedMaskSize());
197
                G = (0xFF&(first>> 8) + row*step) % (1 << get_GreenMaskSize());
198
                B = (0xFF&(first    ) + (col+row)*step) % (1 << get_BlueMaskSize());
198 199
                color = (R<<16) | (G<<8) | (B);
199 200
            }
200 201
            if (vg_draw_rectangle(col*W,row*H,W,H,color)) {

Also available in: Unified diff