canvas-arena.cpp revision 2453611c60c910cc3120bed5342fa66c9952a480
#define __SP_CANVAS_ARENA_C__
/*
* RGBA display list system for inkscape
*
* Author:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 2001-2002 Lauris Kaplinski
* Copyright (C) 2001 Ximian, Inc.
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <gtk/gtksignal.h>
#include <display/display-forward.h>
#include <display/sp-canvas-util.h>
#include <helper/sp-marshal.h>
#include <display/nr-arena.h>
#include <display/nr-arena-group.h>
#include <display/canvas-arena.h>
#include <display/inkscape-cairo.h>
enum {
};
static void sp_canvas_arena_update (SPCanvasItem *item, NR::Matrix const &affine, unsigned int flags);
{NULL},
};
static SPCanvasItemClass *parent_class;
sp_canvas_arena_get_type (void)
{
if (!type) {
GtkTypeInfo info = {
"SPCanvasArena",
sizeof (SPCanvasArena),
sizeof (SPCanvasArenaClass),
};
}
return type;
}
static void
{
}
static void
{
nr_active_object_add_listener ((NRActiveObject *) arena->arena, (NRObjectEventVector *) &carenaev, sizeof (carenaev), arena);
}
static void
{
}
}
}
}
static void
{
NRArenaItem *new_arena = nr_arena_item_invoke_pick (arena->root, arena->c, arena->arena->delta, arena->sticky);
/* fixme: */
}
/* fixme: This is not optimal - better track ::destroy (Lauris) */
}
}
}
}
static void
{
gint x, y;
// 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
// 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 */
/* We can go with single buffer */
} else if (bw <= 4096) {
/* Go with row buffer */
} else if (bh <= 4096) {
/* Go with column buffer */
} else {
sw = 256;
sh = 256;
}
} else { // paths only, so 1M works faster
/* 1M is the cached buffer and we need 4 channels */
/* We can go with single buffer */
} else if (bw <= 8192) {
/* Go with row buffer */
} else if (bh <= 8192) {
/* Go with column buffer */
} else {
sw = 512;
sh = 512;
}
}
/*
This define chooses between two modes: When on, arena renders into a temporary
32bpp buffer, and the result is then squished into the SPCanvasBuf. When off, arena
renders directly to SPCanvasBuf. However currently this gives no speed advantage,
perhaps because the lack of squishing is offset by the need for arena items to render
to the inconvenient (and probably slower) 24bpp buffer. When SPCanvasBuf is
switched to 32bpp and cairo drawing, however, this define should be removed to
streamline rendering.
*/
#define STRICT_RGBA
#ifdef STRICT_RGBA
#endif
#ifdef STRICT_RGBA
#endif
// CAIRO FIXME: switch this to R8G8B8A8P and 4 * ...
#ifdef STRICT_RGBA
// this does the 32->24 squishing, using an assembler routine:
}
cairo_destroy (ct);
}
#else
#endif
}
}
}
static double
{
NRArenaItem *picked = nr_arena_item_invoke_pick (arena->root, p, arena->arena->delta, arena->sticky);
if (picked) {
*actual_item = item;
return 0.0;
}
return 1e18;
}
static gint
{
case GDK_ENTER_NOTIFY:
//g_warning ("Cursor entered to arena with already active item");
}
/* TODO ... event -> arena transform? */
/* fixme: Not sure abut this, but seems the right thing (Lauris) */
nr_arena_item_invoke_update (arena->root, NULL, &arena->gc, NR_ARENA_ITEM_STATE_PICK, NR_ARENA_ITEM_STATE_NONE);
arena->active = nr_arena_item_invoke_pick (arena->root, arena->c, arena->arena->delta, arena->sticky);
}
break;
case GDK_LEAVE_NOTIFY:
}
break;
case GDK_MOTION_NOTIFY:
/* TODO ... event -> arena transform? */
/* fixme: Not sure abut this, but seems the right thing (Lauris) */
nr_arena_item_invoke_update (arena->root, NULL, &arena->gc, NR_ARENA_ITEM_STATE_PICK, NR_ARENA_ITEM_STATE_NONE);
/* fixme: */
}
}
}
break;
default:
/* Just send event */
break;
}
return ret;
}
static gint
{
/* Send event to arena */
return ret;
}
static void
{
}
static void
{
}
void
{
/* fixme: repick? */
}
void
{
/* fixme: repick? */
}
void
{
/* fixme: */
}