diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2015-05-06 11:55:31 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2015-05-06 11:55:31 +0000 |
| commit | 12fb2762bc936c08538f041be261c79f43ee80e0 (patch) | |
| tree | 5d332dbf8e53ae8a718bd608b935d744a7432f7e /src/display/canvas-grid.cpp | |
| parent | Converted unit test fr dir-util for Google Test. (diff) | |
| download | inkscape-12fb2762bc936c08538f041be261c79f43ee80e0.tar.gz inkscape-12fb2762bc936c08538f041be261c79f43ee80e0.zip | |
Compromise solution for dot grid visibilty. See bug #1357611.
(bzr r14114)
Diffstat (limited to 'src/display/canvas-grid.cpp')
| -rw-r--r-- | src/display/canvas-grid.cpp | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 4eda9b194..decf93626 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -906,7 +906,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) gdouble const syg = floor ((buf->rect.top() - ow[Geom::Y]) / sw[Geom::Y]) * sw[Geom::Y] + ow[Geom::Y]; gint const ylinestart = round((syg - ow[Geom::Y]) / sw[Geom::Y]); - //set correct coloring, depending preference (when zoomed out, always major coloring or minor coloring) + // no_emphasize_when_zoomedout determines color (minor or major) when only major grid lines/dots shown. Inkscape::Preferences *prefs = Inkscape::Preferences::get(); guint32 _empcolor; bool no_emp_when_zoomed_out = prefs->getBool("/options/grids/no_emphasize_when_zoomedout", false); @@ -922,6 +922,7 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) cairo_set_line_cap(buf->ct, CAIRO_LINE_CAP_SQUARE); if (!render_dotted) { + // Line grid gint ylinenum; gdouble y; for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { @@ -944,8 +945,23 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) } } } else { + // Dotted grid gint ylinenum; gdouble y; + + // alpha needs to be larger than in the line case to maintain a similar visual impact but + // setting it to the maximal value makes the dots dominant in some cases. Solution, + // increase the alpha by a factor of 4. This then allows some user adjustment. + guint32 _empdot = (_empcolor & 0xff) << 2; + if (_empdot > 0xff) + _empdot = 0xff; + _empdot += (_empcolor & 0xffffff00); + + guint32 _colordot = (color & 0xff) << 2; + if (_colordot > 0xff) + _colordot = 0xff; + _colordot += (color & 0xffffff00); + for (y = syg, ylinenum = ylinestart; y < buf->rect.bottom(); y += sw[Geom::Y], ylinenum++) { gint const iy = round(y); @@ -957,13 +973,15 @@ CanvasXYGrid::Render (SPCanvasBuf *buf) || (!scaled[Geom::Y] && (ylinenum % empspacing) != 0) || ((scaled[Geom::X] || scaled[Geom::Y]) && no_emp_when_zoomed_out) ) { - grid_dot (buf, ix, iy, color | (guint32)0x000000FF); // put alpha to max value + // Minor point: dot only + grid_dot (buf, ix, iy, _colordot); // | (guint32)0x000000FF); // put alpha to max value } else { + // Major point: small cross gint const pitch = 1; grid_dot (buf, ix-pitch, iy, _empcolor); grid_dot (buf, ix+pitch, iy, _empcolor); - grid_dot (buf, ix, iy, _empcolor | (guint32)0x000000FF); // put alpha to max value + grid_dot (buf, ix, iy, _empdot ); // | (guint32)0x000000FF); // put alpha to max value grid_dot (buf, ix, iy-pitch, _empcolor); grid_dot (buf, ix, iy+pitch, _empcolor); |
