nr-arena-shape.cpp revision 776877aa300b25ef93a53a1c2a451ddb1ca78250
#define __NR_ARENA_SHAPE_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 <display/nr-arena.h>
#include <display/nr-arena-shape.h>
#include <libnr/n-art-bpath.h>
#include <libnr/nr-pixops.h>
#include <libnr/nr-matrix-ops.h>
#include <livarot/float-line.h>
#include <livarot/int-line.h>
#include <style.h>
//int showRuns=0;
static void nr_arena_shape_set_child_position(NRArenaItem *item, NRArenaItem *child, NRArenaItem *ref);
static guint nr_arena_shape_update(NRArenaItem *item, NRRectL *area, NRGC *gc, guint state, guint reset);
static unsigned int nr_arena_shape_render(NRArenaItem *item, NRRectL *area, NRPixBlock *pb, unsigned int flags);
static NRArenaItem *nr_arena_shape_pick(NRArenaItem *item, NR::Point p, double delta, unsigned int sticky);
static NRArenaItemClass *shape_parent_class;
nr_arena_shape_get_type(void)
{
if (!type) {
"NRArenaShape",
sizeof(NRArenaShapeClass),
sizeof(NRArenaShape),
(void (*)(NRObjectClass *)) nr_arena_shape_class_init,
(void (*)(NRObject *)) nr_arena_shape_init);
}
return type;
}
static void
{
}
static void
{
shape->cached_fpartialy = false;
shape->cached_spartialy = false;
shape->delayed_shp = false;
}
static void
{
}
static NRArenaItem *
{
}
static void
{
if (!ref) {
} else {
}
}
static void
{
} else {
}
}
static void
{
} else {
}
if (!ref) {
} else {
}
}
void nr_arena_shape_update_fill(NRArenaShape *shape, NRGC *gc, NRRectL *area, bool force_shape = false);
static guint
{
unsigned int beststate = NR_ARENA_ITEM_STATE_ALL;
unsigned int newstate;
}
if (!(state & NR_ARENA_ITEM_STATE_RENDER)) {
/* We do not have to create rendering structures */
if (state & NR_ARENA_ITEM_STATE_BBOX) {
/* fixme: */
}
if (beststate & NR_ARENA_ITEM_STATE_BBOX) {
}
}
}
}
shape->delayed_shp=true;
/* fixme: */
}
// those pesky miters, now
if ( miterMax > 0.01 ) {
// grunt mode. we should compute the various miters instead (one for each point on the curve)
}
}
} else {
}
/* Release state data */
/* Concept test */
}
}
if (shape->stroke_shp) {
delete shape->stroke_shp;
}
if (shape->fill_painter) {
}
if (shape->stroke_painter) {
}
{
return NR_ARENA_ITEM_STATE_ALL;
}
/* Build state data */
if ( shape->delayed_shp ) {
} else {
}
}
}
}
}
{
// don't merge item opacity with paint opacity if there is a stroke on the fill
}
if (beststate & NR_ARENA_ITEM_STATE_BBOX) {
}
}
return NR_ARENA_ITEM_STATE_ALL;
}
// transposition
tp[0]=p[0];
for (int i = 4; i < 6; i++) // shut valgrind up :)
tp[i] = p[i] = 0;
// Is the adjunct nearly an identity function?
// the transformation is an isometry -> no need to recompute
// the uncrossed polygon
if ( p.det() < 0 )
return -1;
else
return 1;
}
return 0;
}
return (outer.x0 <= inner.x0 && outer.y0 <= inner.y0 && outer.x1 >= inner.x1 && outer.y1 >= inner.y1);
}
/** force_shape is used for clipping paths, when we need the shape for clipping even if it's not filled */
void
{
int isometry = 0;
if ( shape->cached_fill ) {
} else {
}
isometry = 0;
}
if ( isometry == 0 ) {
{
}
shape->cached_fpartialy = false;
} else {
shape->cached_fpartialy = true;
}
// alternatively, this speeds up rendering of oddeven shapes but disables AA :(
//shape->cached_fill->Copy(theShape);
} else {
}
delete theShape;
delete thePath;
} else if ( 2 == isometry ) {
}
} else {
if ( isometry == 1 ) {
}
}
}
}
}
void
{
int isometry = 0;
if ( shape->cached_stroke ) {
} else {
}
isometry = 0;
}
if ( isometry == 0 ) {
{
}
// add some padding to the rendering area, so clipped path does not go into a render area
if ((style->stroke_dash.n_dash && NR_ARENA_ITEM(shape)->arena->rendermode != RENDERMODE_OUTLINE) || is_inner_area(padded_area, NR_ARENA_ITEM(shape)->bbox)) {
shape->cached_spartialy = false;
}
else {
thePath->Convert(&padded_area, (NR_ARENA_ITEM(shape)->arena->rendermode != RENDERMODE_OUTLINE) ? 1.0 : 4.0);
shape->cached_spartialy = true;
}
double dlen = 0.0;
}
if (dlen >= 1.0) {
}
for (int i=1; i<nbD; i++) {
}
// modulo dlen
}
}
case NRArenaShape::BUTT_CAP:
break;
case NRArenaShape::ROUND_CAP:
butt = butt_round;
break;
case NRArenaShape::SQUARE_CAP:
butt = butt_square;
break;
}
case NRArenaShape::MITRE_JOIN:
join = join_pointy;
break;
case NRArenaShape::ROUND_JOIN:
join = join_round;
break;
case NRArenaShape::BEVEL_JOIN:
break;
}
}
// speeds it up, but uses evenodd for the stroke shape (which does not matter for 1-pixel wide outline)
} else {
}
delete thePath;
delete theShape;
} else if ( 2 == isometry ) {
}
} else {
shape->stroke_shp->Reset(shape->cached_stroke->numberOfPoints(), shape->cached_stroke->numberOfEdges());
if ( isometry == 1 ) {
} else if ( isometry == -1 ) {
}
}
}
}
void
{
if ( shape->stroke_shp ) {
}
} else {
}
}
} else {
}
}
}
} else {
}
}
} else {
}
}
}
static unsigned int
{
if ( shape->delayed_shp ) {
shape->delayed_shp = false;
/* NRRect bbox;
bbox.x0 = bbox.y0 = bbox.x1 = bbox.y1 = 0.0;
nr_arena_shape_add_bboxes(shape,bbox);
item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
item->bbox.x1 = (gint32)(bbox.x1 + 1.0F);
item->bbox.y1 = (gint32)(bbox.y1 + 1.0F);
shape->approx_bbox=item->bbox;*/
} else {
}
}
NRPixBlock m;
// do not render fill in any way
if ( item->render_opacity ) {
} else {
}
if (shape->fill_painter) {
}
}
nr_pixblock_release(&m);
}
if ( shape->stroke_shp ) {
NRPixBlock m;
} else if ( item->render_opacity ) {
} else {
}
if (shape->stroke_painter) {
}
}
nr_pixblock_release(&m);
}
/* Just compose children into parent buffer */
unsigned int ret;
}
}
static guint
{
shape->delayed_shp = false;
} else {
}
}
NRPixBlock m;
/* fixme: We can OR in one step (Lauris) */
unsigned char *s, *d;
*d = NR_A7_NORMALIZED(*s,*d);
d ++;
s ++;
}
}
nr_pixblock_release(&m);
}
}
static NRArenaItem *
{
if ( shape->delayed_shp ) {
// njh: inset rect
if (shape->cached_stroke)
shape->delayed_shp = false;
/* NRRect bbox;
bbox.x0 = bbox.y0 = bbox.x1 = bbox.y1 = 0.0;
nr_arena_shape_add_bboxes(shape,bbox);
item->bbox.x0 = (gint32)(bbox.x0 - 1.0F);
item->bbox.y0 = (gint32)(bbox.y0 - 1.0F);
item->bbox.x1 = (gint32)(bbox.x1 + 1.0F);
item->bbox.y1 = (gint32)(bbox.y1 + 1.0F);
shape->approx_bbox=item->bbox;*/
}
}
}
}
if (delta > 1e-3) {
}
}
}
} else {
int wind = 0;
} else {
}
}
/* fixme: We do not take stroke width into account here (Lauris) */
}
}
return NULL;
}
/**
*
* Requests a render of the shape, then if the shape is already a curve it
* unrefs the old curve; if the new curve is valid it creates a copy of the
* curve and adds it to the shape. Finally, it requests an update of the
* arena for the shape.
*/
{
if ( justTrans == false ) {
// dirty cached versions
if ( shape->cached_fill ) {
delete shape->cached_fill;
}
if ( shape->cached_stroke ) {
delete shape->cached_stroke;
}
}
}
if (curve) {
}
}
}
}
}
}
}
}
}
}
}
}
}
/** nr_arena_shape_set_style
*
* Unrefs any existing style and ref's to the given one, then requests an update of the arena
*/
void
{
case SP_PAINT_TYPE_NONE: {
break;
}
case SP_PAINT_TYPE_COLOR: {
break;
}
case SP_PAINT_TYPE_PAINTSERVER: {
break;
}
default: {
}
}
case SP_WIND_RULE_EVENODD: {
break;
}
case SP_WIND_RULE_NONZERO: {
break;
}
default: {
}
}
case SP_PAINT_TYPE_NONE: {
break;
}
case SP_PAINT_TYPE_COLOR: {
break;
}
case SP_PAINT_TYPE_PAINTSERVER: {
break;
}
default: {
}
}
case SP_STROKE_LINECAP_ROUND: {
break;
}
case SP_STROKE_LINECAP_SQUARE: {
break;
}
case SP_STROKE_LINECAP_BUTT: {
break;
}
default: {
}
}
case SP_STROKE_LINEJOIN_ROUND: {
break;
}
case SP_STROKE_LINEJOIN_BEVEL: {
break;
}
case SP_STROKE_LINEJOIN_MITER: {
break;
}
default: {
}
}
}
void
{
} else {
/* fixme: We kill warning, although not sure what to do here (Lauris) */
}
}
{
}
static void
{
if ( vst > 0.999 ) {
/* Simple copy */
while (len > 0) {
d[0] = 255;
d += 1;
len -= 1;
}
} else {
sv*=256;
c0_24&=0xFF;
while (len > 0) {
unsigned int da;
/* Draw */
d[0] = NR_PREMUL_SINGLE(da);
d += 1;
len -= 1;
}
}
} else {
sv*=256;
c0_24&=0xFF;
unsigned int da;
/* Draw */
d[0] = NR_PREMUL_SINGLE(da);
} else {
sv*=16777216;
dv*=16777216;
while (len > 0) {
/* Draw */
d[0] = NR_PREMUL_SINGLE(da);
d += 1;
len -= 1;
}
}
}
}
{
/* This is the FloatLigne version. See svn (prior to Apr 2006) for versions using BitLigne or direct BitLigne. */
int curPt;
float curY;
}
theS->EndQuickRaster();
delete theI;
delete theIL;
}
/*
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 :