1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-22 00:47:13 +01:00

Fix cross-platform one-pixel differences in line drawing...

... Make all line drawing go through our AColor which wraps the wxDC
line-drawing functions.

Despite what wxWidgets documentation says, the functions still don't
consistently include the first point and omit the last point of a line.  I
observed inclusion of both on Mac, while on Windows, omission sometimes of the
first point instead of the last.

Discrepancies could be observed in 2.3.0 between Windows and Mac, using the
Window magnifier or command+alt+ +, zooming in closely on the ends of the
shadow lines below and right of tracks, or at the bottom-right corners of the
bevels drawn around vertical rulers.

So where there is an observable one-pixel difference of drawing between
platforms, there is the question, which was the intent when the drawing code
was written?  Should the coordinates be corrected by one or not?

I reviewed each case and used my judgment.

Most of the calls are in drawing rulers.  Major tick lines were drawn five
pixels long, and minor, three, on Mac.  I keep this behavior, but you might
argue for making them four and two.

On the other hand the drawing of ruler grid lines, which you can see in
the equalization and frequency analysis windows, did need a one-pixel correction
to avoid straying out of bounds.
This commit is contained in:
Paul Licameli
2018-11-17 09:25:26 -05:00
parent 2d144bfbc2
commit e6324e86ac
7 changed files with 79 additions and 68 deletions

View File

@@ -63,7 +63,14 @@ class AColor {
static void ReInit();
static void Arrow(wxDC & dc, wxCoord x, wxCoord y, int width, bool down = true);
// Draw a line, INCLUSIVE of both endpoints
// (unlike what wxDC::DrawLine() documentation specifies)
static void Line(wxDC & dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
// Draw lines, INCLUSIVE of all endpoints
static void Lines(wxDC &dc, size_t nPoints, const wxPoint points[]);
static void DrawFocus(wxDC & dc, wxRect & r);
static void Bevel(wxDC & dc, bool up, const wxRect & r);
static void Bevel2