summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 463ba66)
raw | patch | inline | side by side (parent: 463ba66)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Sat, 17 Feb 2007 22:56:16 +0000 (22:56 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Sat, 17 Feb 2007 22:56:16 +0000 (22:56 +0000) |
index 7b3e5bc94b2f11d042044dd5d473fced36f74ace..3212d0bd2f6887fe3f164568a44d47d5ac0d931a 100644 (file)
/* fixme: RGB transformed bitmap blit is not implemented (Lauris) */
/* And even if it would be, unless it uses MMX there is little reason to go RGB */
+// CAIRO FIXME: undefine this so that arena renders directly into SPCanvasBuf, without blitting and squishing (32bpp -> 24bpp packed) from a pixblock
#define STRICT_RGBA
for (y = buf->rect.y0; y < buf->rect.y1; y += sh) {
pb.empty = FALSE;
#endif
+// CAIRO FIXME: switch this to R8G8B8A8P and 4 * ...
nr_pixblock_setup_extern (&cb, NR_PIXBLOCK_MODE_R8G8B8, area.x0, area.y0, area.x1, area.y1,
buf->buf + (y - buf->rect.y0) * buf->buf_rowstride + 3 * (x - buf->rect.x0),
buf->buf_rowstride,
index e4f2c7b755ed5d7f444ec413400ee8642b9437f8..284328d7f85f94ba1979d3b44b9b5578d2721072 100644 (file)
} else {
int y;
for (y = buf->rect.y0; y < buf->rect.y1; y++) {
- memset (buf->buf + (y - buf->rect.y0) * buf->buf_rowstride, r, 3 * (buf->rect.x1 - buf->rect.x0));
+ memset (buf->buf + (y - buf->rect.y0) * buf->buf_rowstride, r, 3 * (buf->rect.x1 - buf->rect.x0)); // CAIRO FIXME: for cairo output we need 32bpp, so it will be 4 * ...
}
}
}
index c8de868849c18c44da5f0c2a13a1526b1478646a..39ebc17d1d2fb7f0f0c20e2b75eff179332ad141 100644 (file)
@@ -1524,7 +1524,7 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
buf.buf = nr_pixelstore_1M_new (FALSE, 0);
}
- buf.buf_rowstride = sw * 3;
+ buf.buf_rowstride = sw * 3; // CAIRO FIXME: for cairo output, the buffer must be RGB unpacked, i.e. sw * 4
buf.rect.x0 = x0;
buf.rect.y0 = y0;
buf.rect.x1 = x1;
@@ -1551,6 +1551,23 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
x0 - canvas->x0, y0 - canvas->y0,
x1 - x0, y1 - y0);
} else {
+/*
+ CAIRO FIXME: after SPCanvasBuf is made 32bpp throughout, this rgb_draw below can be replaced with:
+ cairo_surface_t* cst = cairo_image_surface_create_for_data (
+ buf.buf,
+ CAIRO_FORMAT_RGB24, // unpacked, i.e. 32 bits! one byte is unused
+ x1 - x0, y1 - y0,
+ buf.buf_rowstride
+ );
+ cairo_t *ct = gdk_cairo_create(SP_CANVAS_WINDOW (canvas));
+ cairo_set_source_surface (ct, cst, x0 - canvas->x0, y0 - canvas->y0);
+ cairo_paint (ct);
+
+ cairo_destroy (ct);
+ cairo_surface_finish (cst);
+ cairo_surface_destroy (cst);
+*/
+
gdk_draw_rgb_image_dithalign (SP_CANVAS_WINDOW (canvas),
canvas->pixmap_gc,
x0 - canvas->x0, y0 - canvas->y0,
@@ -1588,7 +1605,8 @@ sp_canvas_paint_rect_internal (SPCanvas *canvas, NRRectL *rect, NR::ICoord *x_ab
int bh = draw_y2 - draw_y1;
if ((bw < 1) || (bh < 1))
return 0;
- int sw, sh;
+
+ int sw, sh; // CAIRO FIXME: the sw/sh calculations below all assume 24bpp, need fixing for 32bpp
if (canvas->rendermode != RENDERMODE_OUTLINE) { // use 256K as a compromise to not slow down gradients
/* 256K is the cached buffer and we need 3 channels */
if (bw * bh < 87381) { // 256K/3
index b32607a65f018db078d0a35124fc8ea1e2ba9f0c..85f8fdc606663af846a1edd63095f62d95041422 100644 (file)
# include "config.h"
#endif
#include <livarot/Path.h>
-
+#include <color.h>
static void sp_ctrlline_class_init (SPCtrlLineClass *klass);
area.y0=buf->rect.y0;
area.y1=buf->rect.y1;
+/*
+// CAIRO FIXME: after SPCanvasBuf is switched to unpacked 32bit rgb, rendering can be done via cairo:
+ cairo_surface_t* cst = cairo_image_surface_create_for_data (
+ buf->buf,
+ CAIRO_FORMAT_RGB24,
+ buf->rect.x1 - buf->rect.x0,
+ buf->rect.y1 - buf->rect.y0,
+ buf->buf_rowstride
+ );
+ cairo_t *ct = cairo_create (cst);
+
+ guint32 rgba = ctrlline->rgba;
+ cairo_set_source_rgba(ct, SP_RGBA32_R_F(rgba), SP_RGBA32_G_F(rgba), SP_RGBA32_B_F(rgba), SP_RGBA32_A_F(rgba));
+
+ cairo_set_line_width(ct, 0.5);
+ cairo_new_path(ct);
+
+ cairo_move_to (ct, ctrlline->s.x - buf->rect.x0, ctrlline->s.y - buf->rect.y0);
+ cairo_line_to (ct, ctrlline->e.x - buf->rect.x0, ctrlline->e.y - buf->rect.y0);
+
+ cairo_stroke(ct);
+ cairo_destroy (ct);
+ cairo_surface_finish (cst);
+ cairo_surface_destroy (cst);
+*/
+
+// CAIRO FIXME: instead of this:
if (ctrlline->shp) {
sp_canvas_prepare_buffer (buf);
nr_pixblock_render_ctrl_rgba (ctrlline->shp,ctrlline->rgba,area,(char*)buf->buf, buf->buf_rowstride);
static void
sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags)
{
- NRRect dbox;
-
SPCtrlLine *cl = SP_CTRLLINE (item);
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
@@ -128,6 +153,24 @@ sp_ctrlline_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int f
sp_canvas_item_reset_bounds (item);
+/*
+// CAIRO FIXME: all that is needed for update with cairo:
+ NR::Point s = NR::Point(cl->s.x, cl->s.y) * affine;
+ NR::Point e = NR::Point(cl->e.x, cl->e.y) * affine;
+
+ cl->s.x = s[NR::X];
+ cl->s.y = s[NR::Y];
+ cl->e.x = e[NR::X];
+ cl->e.y = e[NR::Y];
+
+ item->x1 = (int)(MIN(s[NR::X], e[NR::X]) - 1);
+ item->y1 = (int)(MIN(s[NR::Y], e[NR::Y]) - 1);
+ item->x2 = (int)(MAX(s[NR::X], e[NR::X]) + 1);
+ item->y2 = (int)(MAX(s[NR::Y], e[NR::Y]) + 1);
+*/
+
+// CAIRO FIXME: instead of:
+ NRRect dbox;
dbox.x0=dbox.x1=dbox.y0=dbox.y1=0;
if (cl->shp) {
delete cl->shp;