| 24 | } |
| 25 | |
| 26 | void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { |
| 27 | surface->PenColour(fore); |
| 28 | int ymid = (rc.bottom + rc.top) / 2; |
| 29 | if (style == INDIC_SQUIGGLE) { |
| 30 | int x = int(rc.left+0.5); |
| 31 | int xLast = int(rc.right+0.5); |
| 32 | int y = 0; |
| 33 | surface->MoveTo(x, rc.top + y); |
| 34 | while (x < xLast) { |
| 35 | if ((x + 2) > xLast) { |
| 36 | if (xLast > x) |
| 37 | y = 1; |
| 38 | x = xLast; |
| 39 | } else { |
| 40 | x += 2; |
| 41 | y = 2 - y; |
| 42 | } |
| 43 | surface->LineTo(x, rc.top + y); |
| 44 | } |
| 45 | } else if (style == INDIC_SQUIGGLEPIXMAP) { |
| 46 | PRectangle rcSquiggle = PixelGridAlign(rc); |
| 47 | |
| 48 | int width = Platform::Minimum(4000, rcSquiggle.Width()); |
| 49 | RGBAImage image(width, 3, 1.0, 0); |
| 50 | enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f }; |
| 51 | for (int x = 0; x < width; x++) { |
| 52 | if (x%2) { |
| 53 | // Two halfway columns have a full pixel in middle flanked by light pixels |
| 54 | image.SetPixel(x, 0, fore, alphaSide); |
| 55 | image.SetPixel(x, 1, fore, alphaFull); |
| 56 | image.SetPixel(x, 2, fore, alphaSide); |
| 57 | } else { |
| 58 | // Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre |
| 59 | image.SetPixel(x, (x%4) ? 0 : 2, fore, alphaFull); |
| 60 | image.SetPixel(x, 1, fore, alphaSide2); |
| 61 | } |
| 62 | } |
| 63 | surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels()); |
| 64 | } else if (style == INDIC_SQUIGGLELOW) { |
| 65 | surface->MoveTo(rc.left, rc.top); |
| 66 | int x = rc.left + 3; |
| 67 | int y = 0; |
| 68 | while (x < rc.right) { |
| 69 | surface->LineTo(x-1, rc.top + y); |
| 70 | y = 1 - y; |
| 71 | surface->LineTo(x, rc.top + y); |
| 72 | x += 3; |
| 73 | } |
| 74 | surface->LineTo(rc.right, rc.top + y); // Finish the line |
| 75 | } else if (style == INDIC_TT) { |
| 76 | surface->MoveTo(rc.left, ymid); |
| 77 | int x = rc.left + 5; |
| 78 | while (x < rc.right) { |
| 79 | surface->LineTo(x, ymid); |
| 80 | surface->MoveTo(x-3, ymid); |
| 81 | surface->LineTo(x-3, ymid+2); |
| 82 | x++; |
| 83 | surface->MoveTo(x, ymid); |
nothing calls this directly
no test coverage detected