From: buliabyak Date: Tue, 24 Jun 2008 02:26:17 +0000 (+0000) Subject: update for 32 instead of 24 bpp canvas buf X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=2748588ecde62686a15c24a597507dbf8a13782b;p=inkscape.git update for 32 instead of 24 bpp canvas buf --- diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index 78fe6f38b..2bfac655e 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -70,7 +70,7 @@ sp_caxonomgrid_setpixel (SPCanvasBuf *buf, gint x, gint y, guint32 rgba) g = NR_RGBA32_G (rgba); b = NR_RGBA32_B (rgba); a = NR_RGBA32_A (rgba); - guchar * p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3; + guchar * p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; p[0] = NR_COMPOSEN11_1111 (r, a, p[0]); p[1] = NR_COMPOSEN11_1111 (g, a, p[1]); p[2] = NR_COMPOSEN11_1111 (b, a, p[2]); @@ -137,7 +137,7 @@ sp_grid_vline (SPCanvasBuf *buf, gint x, gint ys, gint ye, guint32 rgba) a = NR_RGBA32_A (rgba); y0 = MAX (buf->rect.y0, ys); y1 = MIN (buf->rect.y1, ye + 1); - p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3; + p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; for (y = y0; y < y1; y++) { p[0] = NR_COMPOSEN11_1111 (r, a, p[0]); p[1] = NR_COMPOSEN11_1111 (g, a, p[1]); diff --git a/src/display/canvas-grid.cpp b/src/display/canvas-grid.cpp index 2bc57784d..81e017f12 100644 --- a/src/display/canvas-grid.cpp +++ b/src/display/canvas-grid.cpp @@ -826,12 +826,12 @@ grid_hline (SPCanvasBuf *buf, gint y, gint xs, gint xe, guint32 rgba) a = NR_RGBA32_A (rgba); x0 = MAX (buf->rect.x0, xs); x1 = MIN (buf->rect.x1, xe + 1); - p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3; + p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4; for (x = x0; x < x1; x++) { p[0] = NR_COMPOSEN11_1111 (r, a, p[0]); p[1] = NR_COMPOSEN11_1111 (g, a, p[1]); p[2] = NR_COMPOSEN11_1111 (b, a, p[2]); - p += 3; + p += 4; } } } @@ -849,7 +849,7 @@ grid_vline (SPCanvasBuf *buf, gint x, gint ys, gint ye, guint32 rgba) a = NR_RGBA32_A (rgba); y0 = MAX (buf->rect.y0, ys); y1 = MIN (buf->rect.y1, ye + 1); - p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3; + p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; for (y = y0; y < y1; y++) { p[0] = NR_COMPOSEN11_1111 (r, a, p[0]); p[1] = NR_COMPOSEN11_1111 (g, a, p[1]); @@ -870,7 +870,7 @@ grid_dot (SPCanvasBuf *buf, gint x, gint y, guint32 rgba) g = NR_RGBA32_G (rgba); b = NR_RGBA32_B (rgba); a = NR_RGBA32_A (rgba); - p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3; + p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; p[0] = NR_COMPOSEN11_1111 (r, a, p[0]); p[1] = NR_COMPOSEN11_1111 (g, a, p[1]); p[2] = NR_COMPOSEN11_1111 (b, a, p[2]); diff --git a/src/display/guideline.cpp b/src/display/guideline.cpp index 3b279f724..b1fc7501c 100644 --- a/src/display/guideline.cpp +++ b/src/display/guideline.cpp @@ -102,7 +102,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) int p0 = buf->rect.y0; int p1 = buf->rect.y1; int step = buf->buf_rowstride; - unsigned char *d = buf->buf + 3 * (position - buf->rect.x0); + unsigned char *d = buf->buf + 4 * (position - buf->rect.x0); for (int p = p0; p < p1; p++) { d[0] = NR_COMPOSEN11_1111(r, a, d[0]); @@ -118,7 +118,7 @@ static void sp_guideline_render(SPCanvasItem *item, SPCanvasBuf *buf) int p0 = buf->rect.x0; int p1 = buf->rect.x1; - int step = 3; + int step = 4; unsigned char *d = buf->buf + (position - buf->rect.y0) * buf->buf_rowstride; for (int p = p0; p < p1; p++) { @@ -269,7 +269,7 @@ sp_guideline_setpixel (SPCanvasBuf *buf, gint x, gint y, guint32 rgba) g = NR_RGBA32_G (rgba); b = NR_RGBA32_B (rgba); a = NR_RGBA32_A (rgba); - guchar * p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3; + guchar * p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; p[0] = NR_COMPOSEN11_1111 (r, a, p[0]); p[1] = NR_COMPOSEN11_1111 (g, a, p[1]); p[2] = NR_COMPOSEN11_1111 (b, a, p[2]); diff --git a/src/display/sodipodi-ctrl.cpp b/src/display/sodipodi-ctrl.cpp index 0172cc8bb..db199d3a5 100644 --- a/src/display/sodipodi-ctrl.cpp +++ b/src/display/sodipodi-ctrl.cpp @@ -512,7 +512,7 @@ sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf) bool colormode; for (y = y0; y <= y1; y++) { - p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3; + p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4; q = ctrl->cache + ((y - ctrl->box.y0) * (ctrl->span*2+1) + (x0 - ctrl->box.x0)) * 4; for (x = x0; x <= x1; x++) { a = *(q + 3); @@ -527,13 +527,13 @@ sp_ctrl_render (SPCanvasItem *item, SPCanvasBuf *buf) p[1] = COMPOSE_N (p[1], q[1], a); p[2] = COMPOSE_N (p[2], q[2], a); q += 4; - p += 3; + p += 4; } else if (ctrl->mode == SP_CTRL_MODE_XOR) { p[0] = COMPOSE_X (p[0], q[0], a); p[1] = COMPOSE_X (p[1], q[1], a); p[2] = COMPOSE_X (p[2], q[2], a); q += 4; - p += 3; + p += 4; } } } diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index be3b8dc45..28c76e704 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -100,14 +100,14 @@ static void sp_ctrlrect_hline(SPCanvasBuf *buf, gint y, gint xs, gint xe, guint3 guint const a = RGBA_A(rgba); gint const x0 = MAX(buf->rect.x0, xs); gint const x1 = MIN(buf->rect.x1, xe + 1); - guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3; + guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4; for (gint x = x0; x < x1; x++) { if (!dashed || ((x / DASH_LENGTH) % 2)) { p[0] = INK_COMPOSE(r, a, p[0]); p[1] = INK_COMPOSE(g, a, p[1]); p[2] = INK_COMPOSE(b, a, p[2]); } - p += 3; + p += 4; } } } @@ -121,7 +121,7 @@ static void sp_ctrlrect_vline(SPCanvasBuf *buf, gint x, gint ys, gint ye, guint3 guint const a = RGBA_A(rgba); gint const y0 = MAX(buf->rect.y0, ys); gint const y1 = MIN(buf->rect.y1, ye + 1); - guchar *p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 3; + guchar *p = buf->buf + (y0 - buf->rect.y0) * buf->buf_rowstride + (x - buf->rect.x0) * 4; for (gint y = y0; y < y1; y++) { if (!dashed || ((y / DASH_LENGTH) % 2)) { p[0] = INK_COMPOSE(r, a, p[0]); @@ -145,12 +145,12 @@ static void sp_ctrlrect_area(SPCanvasBuf *buf, gint xs, gint ys, gint xe, gint y gint const y0 = MAX(buf->rect.y0, ys); gint const y1 = MIN(buf->rect.y1, ye + 1); for (gint y = y0; y < y1; y++) { - guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 3; + guchar *p = buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + (x0 - buf->rect.x0) * 4; for (gint x = x0; x < x1; x++) { p[0] = INK_COMPOSE(r, a, p[0]); p[1] = INK_COMPOSE(g, a, p[1]); p[2] = INK_COMPOSE(b, a, p[2]); - p += 3; + p += 4; } } }