diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2007-12-16 23:28:17 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2007-12-16 23:28:17 +0000 |
| commit | e339920107dadc15e1d9ca5c5aed702b1546e102 (patch) | |
| tree | 7b0c23c988e388eb0eb9c6dca0b74f60bc613382 /src | |
| parent | start of getting angled guidelines. (diff) | |
| download | inkscape-e339920107dadc15e1d9ca5c5aed702b1546e102.tar.gz inkscape-e339920107dadc15e1d9ca5c5aed702b1546e102.zip | |
prepare for adding angled guideline rendering
(bzr r4244)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/guideline.cpp | 49 | ||||
| -rw-r--r-- | src/display/guideline.h | 8 |
2 files changed, 32 insertions, 25 deletions
diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index b029be7a0..154b7c3b8 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -1,12 +1,14 @@ #define __SP_GUIDELINE_C__ /* - * Infinite horizontal/vertical line + * Horizontal/vertical but can also be angled line * - * Author: + * Authors: * Lauris Kaplinski <lauris@kaplinski.com> + * Johan Engelen * * Copyright (C) 2000-2002 Lauris Kaplinski + * Copyright (C) 2007 Johan Engelen * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -87,37 +89,40 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) unsigned int const b = NR_RGBA32_B (gl->rgba); unsigned int const a = NR_RGBA32_A (gl->rgba); - int p0, p1, step; - unsigned char *d; - if (gl->normal[Geom::Y] == 0.) { - if (gl->position < buf->rect.x0 || gl->position >= buf->rect.x1) { return; } - p0 = buf->rect.y0; - p1 = buf->rect.y1; - step = buf->buf_rowstride; - d = buf->buf + 3 * (gl->position - buf->rect.x0); - - } else { + int p0 = buf->rect.y0; + int p1 = buf->rect.y1; + int step = buf->buf_rowstride; + unsigned char *d = buf->buf + 3 * (gl->position - buf->rect.x0); + for (int p = p0; p < p1; p++) { + d[0] = NR_COMPOSEN11_1111(r, a, d[0]); + d[1] = NR_COMPOSEN11_1111(g, a, d[1]); + d[2] = NR_COMPOSEN11_1111(b, a, d[2]); + d += step; + } + } else if (gl->normal[Geom::X] == 0.) { if (gl->position < buf->rect.y0 || gl->position >= buf->rect.y1) { return; } - p0 = buf->rect.x0; - p1 = buf->rect.x1; - step = 3; - d = buf->buf + (gl->position - buf->rect.y0) * buf->buf_rowstride; - } + int p0 = buf->rect.x0; + int p1 = buf->rect.x1; + int step = 3; + unsigned char *d = buf->buf + (gl->position - buf->rect.y0) * buf->buf_rowstride; - for (int p = p0; p < p1; p++) { - d[0] = NR_COMPOSEN11_1111(r, a, d[0]); - d[1] = NR_COMPOSEN11_1111(g, a, d[1]); - d[2] = NR_COMPOSEN11_1111(b, a, d[2]); - d += step; + for (int p = p0; p < p1; p++) { + d[0] = NR_COMPOSEN11_1111(r, a, d[0]); + d[1] = NR_COMPOSEN11_1111(g, a, d[1]); + d[2] = NR_COMPOSEN11_1111(b, a, d[2]); + d += step; + } + } else { + // render angled line } } diff --git a/src/display/guideline.h b/src/display/guideline.h index 85f39754b..a9bfc809b 100644 --- a/src/display/guideline.h +++ b/src/display/guideline.h @@ -2,12 +2,14 @@ #define __SP_GUIDELINE_H__ /* - * Infinite horizontal/vertical line; the visual representation of SPGuide. + * The visual representation of SPGuide. * - * Author: + * Authors: * Lauris Kaplinski <lauris@kaplinski.com> + * Johan Engelen * * Copyright (C) 2000-2002 Lauris Kaplinski + * Copyright (C) 2007 Johan Engelen * * Released under GNU GPL, read the file 'COPYING' for more information */ @@ -26,7 +28,7 @@ struct SPGuideLine { int position; Geom::Point normal; -// unsigned int vertical : 1; + unsigned int sensitive : 1; }; |
