nr-arena-item.cpp revision ec3cef722801728184cc83bd46740d0fdcadf908
#define __NR_ARENA_ITEM_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
*/
#define noNR_ARENA_ITEM_VERBOSE
#define noNR_ARENA_ITEM_DEBUG_CASCADE
#include <cstring>
#include <string>
#include "display/cairo-utils.h"
#include "nr-arena.h"
#include "nr-arena-item.h"
#include "gc-core.h"
#include "nr-filter.h"
#include "nr-arena-group.h"
#include "preferences.h"
static NRObjectClass *parent_class;
nr_arena_item_get_type (void)
{
if (!type) {
"NRArenaItem",
sizeof (NRArenaItemClass),
sizeof (NRArenaItem),
(void (*)(NRObjectClass *))
(void (*)(NRObject *))
}
return type;
}
static void
{
}
static void
{
item->background_new = false;
}
static void
{
}
{
return NULL;
}
{
} else {
if (ref)
return ref;
}
}
void
{
}
void
{
}
void
{
}
{
return item;
}
{
return NULL;
}
unsigned int
{
#ifdef NR_ARENA_ITEM_DEBUG_CASCADE
printf ("Update %s:%p %x %x %x\n",
#endif
/* return if in error */
/* Set reset flags according to propagation status */
}
/* Reset our state */
/* Return if NOP */
/* Test whether to return immediately */
}
/* Reset image cache, if not to be kept */
}
/* Set up local gc */
}
/* Remember the transformation matrix */
/* Invoke the real method */
// that will update bbox
// get a copy of bbox
/* Enlarge the drawbox to contain filter effects */
}
// fixme: to fix the display glitches, in outline mode bbox must be a combination of
// full item bbox and its clip and mask (after we have the API to get these)
/* Clipping */
// FIXME: since here we only need bbox, consider passing
// ((state & !(NR_ARENA_ITEM_STATE_RENDER)) | NR_ARENA_ITEM_STATE_BBOX)
// instead of state, so it does not have to create rendering structures in nr_arena_shape_update
if (newstate & NR_ARENA_ITEM_STATE_INVALID) {
}
// for clipping, we need geometric bbox
}
/* Masking */
if (newstate & NR_ARENA_ITEM_STATE_INVALID) {
}
// for masking, we need full drawbox of mask
}
// now that we know drawbox, dirty the corresponding rect on canvas:
// unless filtered, groups do not need to render by themselves, only their members
}
}
/**
* Render item to pixblock.
*
* \return Has NR_ARENA_ITEM_STATE_RENDER set on success.
*/
unsigned int
{
//bool print_colors = (item->arena->rendermode == Inkscape::RENDERMODE_PRINT_COLORS_PREVIEW);
#ifdef NR_ARENA_ITEM_VERBOSE
#endif
/* If we are invisible, just return successfully */
// carea is the bounding box for intermediate rendering.
// NOTE: carea might be larger than area, because of filter effects.
if (nr_rect_l_test_empty(carea))
}
if (outline) {
// No caching in outline mode for now; investigate if it really gives any advantage with cairo.
// Also no attempts to clip anything; just render everything: item, clip, mask
// First, render the object itself
if (state & NR_ARENA_ITEM_STATE_INVALID) {
/* Clean up and return error */
}
// render clip and mask, if any
// render clippath as an object, using a different color
item->arena->outlinecolor = prefs->getInt("/options/wireframecolors/clips", 0x00ff00ff); // green clips
}
// render mask as an object, using a different color
item->arena->outlinecolor = prefs->getInt("/options/wireframecolors/masks", 0x0000ffff); // blue masks
}
}
using namespace Inkscape;
// clipping and masks
unsigned int state;
bool needs_intermediate_rendering = false;
bool &nir = needs_intermediate_rendering;
// this item needs an intermediate rendering if:
if (needs_intermediate_rendering) {
} else {
}
// The pipeline needs to be different for filters.
// First we render the item into an intermediate surface. Then the filter rotates
// the surface to user coordinates (if necessary) and runs the rendering.
// Once that's done we retrieve the result, rotating it back to screen coords.
// Clipping and masking happens after the filter result is ready.
}
// always clip the base context, not the one on the intermediate surface
// this is because filters must be done before clipping
if (state & NR_ARENA_ITEM_STATE_INVALID) {
}
}
// render mask on the intermediate context and store it
// handle opacity of a masked object by composing it with the mask
// this uses 1/4 the memory of composing it with full rendering
if (needs_opacity) {
}
if (state & NR_ARENA_ITEM_STATE_INVALID) {
}
if (needs_opacity) {
}
}
/*if (mask) {
drawgroup.push();
}*/
// render the object (possibly to the intermediate surface)
if (state & NR_ARENA_ITEM_STATE_INVALID) {
/* Clean up and return error */
}
// apply filter
}
if (needs_intermediate_rendering) {
if (mask) {
// bring mask into the coordinate system of ct
// opacity of masked objects is handled by premultiplying the mask
} else {
// opacity of non-masked objects must be rendered explicitly
if (needs_opacity) {
} else {
}
}
cairo_set_source_rgba(ct,0,0,0,0);
}
}
unsigned int
{
/* we originally short-circuited if the object state included
* NR_ARENA_ITEM_STATE_CLIP (and showed a warning on the console);
* anyone know why we stopped doing so?
*/
/*nr_return_val_if_fail ((pb->area.x1 - pb->area.x0) >=
(area->x1 - area->x0),
NR_ARENA_ITEM_STATE_INVALID);
nr_return_val_if_fail ((pb->area.y1 - pb->area.y0) >=
(area->y1 - area->y0),
NR_ARENA_ITEM_STATE_INVALID);*/
#ifdef NR_ARENA_ITEM_VERBOSE
printf ("Invoke clip by %p: %d %d - %d %d, item bbox %d %d - %d %d\n",
#endif
/* Need render that item */
}
}
}
unsigned int sticky)
{
// Sometimes there's no BBOX in item->state, reason unknown (bug 992817); I made this not an assert to remove the warning
return NULL;
return NULL;
// TODO: rewrite using Geom::Rect
const double x = p[Geom::X];
const double y = p[Geom::Y];
}
return NULL;
}
void
unsigned int propagate)
{
} else {
}
}
}
void
{
}
/* Public */
{
}
return NULL;
}
void
{
}
void
{
nr_arena_item_set_transform (item, &t);
}
void
{
return;
/* Set to identity affine */
} else {
}
}
}
void
{
}
void
{
}
void
{
}
void
{
if (clip)
}
}
void
{
if (mask)
}
}
void
{
return;
int pos = 0;
break;
pos += 1;
}
}
}
void
{
}
/** Returns a background image for use with filter effects. */
{
return NULL;
}
/* Helpers */
{
if (prev)
if (next)
return child;
}
{
if (prev)
if (next)
return next;
}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :