summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d153958)
raw | patch | inline | side by side (parent: d153958)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 27 Feb 2007 03:37:57 +0000 (03:37 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 27 Feb 2007 03:37:57 +0000 (03:37 +0000) |
src/display/canvas-arena.cpp | patch | blob | history | |
src/display/sp-canvas.cpp | patch | blob | history |
index 3212d0bd2f6887fe3f164568a44d47d5ac0d931a..a7615b3d7c571ca3556c03797fe98585c64fe9e4 100644 (file)
bh = buf->rect.y1 - buf->rect.y0;
if ((bw < 1) || (bh < 1)) return;
+ // FIXME: currently this function is a huge waste. It receives a buffer but creates a new one and loops
+ // within the large one, doing arena painting in several blocks. This just makes no sense because the
+ // buf that we are given is already only a strip of the screen, created by one iteration of a loop in
+ // sp_canvas_paint_rect_internal. With the current numbers, this function's buffer is always 1/4
+ // smaller than the one we get, because they both are the same number of bytes but
+ // buf uses 3 bytes per pixel (24bpp, packed) while the pixblock created here uses 4 bytes (32bpp).
+ // Eventually I want to switch buf to using 4 bytes (see comment in canvas.cpp) and then remove
+ // from here the sw/sh calculation, the loop, and creating the intermediate buffer, allowing arena
+ // just render into buf in one go.
+
if (arena->arena->rendermode != RENDERMODE_OUTLINE) { // use 256K as a compromise to not slow down gradients
/* 256K is the cached buffer and we need 4 channels */
if (bw * bh < 65536) { // 256K/4
index f716d383a26bb21dfe3a2d6cfde502dd52b699b0..75ffeed846cb82c530a7133d855be596c36e8e0d 100644 (file)
@@ -1560,7 +1560,13 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
x1 - x0, y1 - y0);
} else {
/*
- CAIRO FIXME: after SPCanvasBuf is made 32bpp throughout, this rgb_draw below can be replaced with:
+// CAIRO FIXME: after SPCanvasBuf is made 32bpp throughout, this rgb_draw below can be replaced with the below.
+// Why this must not be done currently:
+// - all canvas items (handles, nodes etc) paint themselves assuming 24bpp
+// - cairo assumes bgra, but we have rgba, so r and b get swapped (until we paint all with cairo too)
+// - it does not seem to be any faster; in fact since with 32bpp, buf contains less pixels,
+// we need more bufs to paint a given area and as a result it's even a bit slower
+
cairo_surface_t* cst = cairo_image_surface_create_for_data (
buf.buf,
CAIRO_FORMAT_RGB24, // unpacked, i.e. 32 bits! one byte is unused
@@ -1570,7 +1576,6 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
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);