| 285 | | // advance by x_step, but don't go over the edge |
|---|
| 286 | | if (cc3_g_current_frame.x_step == 1) { |
|---|
| 287 | | x++; |
|---|
| 288 | | } else if (cc3_g_current_frame.x_step + x |
|---|
| 289 | | >= cc3_g_current_frame.x1) { |
|---|
| 290 | | //printf("outside the window\n"); |
|---|
| 291 | | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.raw_width - x - 1) / 2); |
|---|
| 292 | | // and we're done with this row |
|---|
| | 287 | // advance by x_step |
|---|
| | 288 | x += cc3_g_current_frame.x_step; |
|---|
| | 289 | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.x_step - 1) / 2); |
|---|
| | 290 | } |
|---|
| | 291 | |
|---|
| | 292 | break; |
|---|
| | 293 | |
|---|
| | 294 | case CC3_RED: |
|---|
| | 295 | for (j = 0; j < width; j++) { |
|---|
| | 296 | uint8_t *p = ((uint8_t *) mem) + (r * width + j); |
|---|
| | 297 | |
|---|
| | 298 | if ((j & 0x1) == 0 || cc3_g_current_frame.x_step > 1) { |
|---|
| | 299 | // read |
|---|
| | 300 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 301 | *p = _cc3_pixbuf_read_subpixel (); |
|---|
| | 302 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 303 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 311 | break; |
|---|
| | 312 | |
|---|
| | 313 | case CC3_GREEN: |
|---|
| | 314 | for (j = 0; j < width; j++) { |
|---|
| | 315 | uint8_t *p = ((uint8_t *) mem) + (r * width + j); |
|---|
| | 316 | |
|---|
| | 317 | if ((j & 0x1) == 0 || cc3_g_current_frame.x_step > 1) { |
|---|
| | 318 | // read |
|---|
| | 319 | *p = _cc3_pixbuf_read_subpixel (); |
|---|
| | 320 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 321 | _cc3_second_green = _cc3_pixbuf_read_subpixel (); |
|---|
| | 322 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 323 | } else { |
|---|
| | 324 | *p = _cc3_second_green; |
|---|
| | 325 | } |
|---|
| | 326 | |
|---|
| | 327 | x += cc3_g_current_frame.x_step; |
|---|
| | 328 | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.x_step - 1) / 2); |
|---|
| | 329 | } |
|---|
| | 330 | break; |
|---|
| | 331 | |
|---|
| | 332 | case CC3_BLUE: |
|---|
| | 333 | for (j = 0; j < width; j++) { |
|---|
| | 334 | uint8_t *p = ((uint8_t *) mem) + (r * width + j); |
|---|
| | 335 | |
|---|
| | 336 | if ((j & 0x1) == 0 || cc3_g_current_frame.x_step > 1) { |
|---|
| | 337 | // read |
|---|
| | 338 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 339 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 340 | _cc3_pixbuf_skip_subpixel (); |
|---|
| | 341 | *p = _cc3_pixbuf_read_subpixel (); |
|---|
| | 342 | } else { |
|---|
| | 343 | *p = *(p - 1); |
|---|
| | 344 | } |
|---|
| | 345 | |
|---|
| | 346 | x += cc3_g_current_frame.x_step; |
|---|
| | 347 | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.x_step - 1) / 2); |
|---|
| | 348 | } |
|---|
| | 349 | break; |
|---|
| 300 | | else { |
|---|
| 301 | | // we are just reading 1 channel |
|---|
| 302 | | // FIXME |
|---|
| 303 | | } |
|---|
| 304 | | |
|---|
| 305 | | |
|---|
| 306 | | // advance by y_step, but don't go over the edge |
|---|
| 307 | | if (cc3_g_current_frame.y_step == 1) { |
|---|
| 308 | | cc3_g_current_frame.y_loc++; |
|---|
| 309 | | } else if (cc3_g_current_frame.y_step + cc3_g_current_frame.y_loc |
|---|
| 310 | | >= cc3_g_current_frame.y1) { |
|---|
| 311 | | // we're done |
|---|
| 312 | | cc3_g_current_frame.y_loc += cc3_g_current_frame.y_step; |
|---|
| 313 | | } else { |
|---|
| 314 | | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.y_step - 1) |
|---|
| 315 | | * cc3_g_current_frame.raw_width / 2); |
|---|
| 316 | | cc3_g_current_frame.y_loc += cc3_g_current_frame.y_step; |
|---|
| 317 | | } |
|---|
| | 351 | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.raw_width - x) / 2); |
|---|
| | 352 | |
|---|
| | 353 | |
|---|
| | 354 | // advance by y_step |
|---|
| | 355 | _cc3_pixbuf_skip_pixels ((cc3_g_current_frame.y_step - 1) * cc3_g_current_frame.raw_width / 2); |
|---|
| | 356 | cc3_g_current_frame.y_loc += cc3_g_current_frame.y_step; |
|---|