| 494 | } |
| 495 | |
| 496 | void PiuCodeHilite(PiuCode* self, PiuView* view, int32_t fromColumn, int32_t fromLine, int32_t toColumn, int32_t toLine) |
| 497 | { |
| 498 | PiuStyle* style = (*self)->computedStyle; |
| 499 | PiuCoordinate x, y; |
| 500 | PiuDimension width, height; |
| 501 | int32_t line = toLine - fromLine; |
| 502 | if (line == 0) { |
| 503 | int32_t column = toColumn - fromColumn; |
| 504 | x = (PiuCoordinate)c_floor((*style)->margins.left + (fromColumn * (*self)->columnWidth)); |
| 505 | if (column == 0) { |
| 506 | x--; |
| 507 | width = 2; |
| 508 | } |
| 509 | else |
| 510 | width = (PiuDimension)c_ceil((toColumn - fromColumn) * (*self)->columnWidth); |
| 511 | y = (PiuCoordinate)c_floor((*style)->margins.top + (fromLine * (*self)->lineHeight)); |
| 512 | height = (PiuDimension)c_ceil((*self)->lineHeight); |
| 513 | PiuViewFillColor(view, x, y, width, height); |
| 514 | } |
| 515 | else { |
| 516 | x = (PiuCoordinate)c_floor((*style)->margins.left + (fromColumn * (*self)->columnWidth)); |
| 517 | width = 0x7FFF; |
| 518 | y = (PiuCoordinate)c_floor((*style)->margins.top + (fromLine * (*self)->lineHeight)); |
| 519 | height = (PiuDimension)c_ceil((*self)->lineHeight); |
| 520 | PiuViewFillColor(view, x, y, width, height); |
| 521 | if (line > 1) { |
| 522 | x = (*style)->margins.left; |
| 523 | width = 0x7FFF; |
| 524 | y = (PiuCoordinate)c_floor((*style)->margins.top + ((fromLine + 1) * (*self)->lineHeight)); |
| 525 | height = (PiuDimension)c_ceil((line - 1) * (*self)->lineHeight); |
| 526 | PiuViewFillColor(view, x, y, width, height); |
| 527 | } |
| 528 | x = (*style)->margins.left; |
| 529 | width = (PiuDimension)c_ceil(toColumn * (*self)->columnWidth); |
| 530 | y = (PiuCoordinate)c_floor((*style)->margins.top + (toLine * (*self)->lineHeight)); |
| 531 | height = (PiuDimension)c_ceil((*self)->lineHeight); |
| 532 | PiuViewFillColor(view, x, y, width, height); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | int32_t PiuCodeHitOffset(PiuCode* self, double x, double y) |
| 537 | { |
no test coverage detected