| 351 | static const uint32_t all_ones = 0xffffffff; |
| 352 | |
| 353 | void |
| 354 | Bitmap::fill (unsigned int y, unsigned int x1, unsigned int x2) |
| 355 | { |
| 356 | unsigned int b1 = x1 / 32; |
| 357 | |
| 358 | uint32_t *sl = scanline (y); |
| 359 | sl += b1; |
| 360 | |
| 361 | unsigned int b = x2 / 32 - b1; |
| 362 | if (b == 0) { |
| 363 | |
| 364 | *sl |= (masks [x2 % 32] & ~masks [x1 % 32]); |
| 365 | |
| 366 | } else if (b > 0) { |
| 367 | |
| 368 | *sl++ |= ~masks [x1 % 32]; |
| 369 | while (b > 1) { |
| 370 | *sl++ |= all_ones; |
| 371 | b--; |
| 372 | } |
| 373 | |
| 374 | unsigned int m = masks [x2 % 32]; |
| 375 | // Hint: if x2==width and width%32==0, sl must not be accessed. This is guaranteed by |
| 376 | // checking if m != 0. |
| 377 | if (m) { |
| 378 | *sl |= m; |
| 379 | } |
| 380 | |
| 381 | } |
| 382 | } |
| 383 | |
| 384 | void |
| 385 | Bitmap::clear (unsigned int y, unsigned int x1, unsigned int x2) |
no outgoing calls
no test coverage detected