~ubuntu-branches/debian/experimental/inkscape/experimental

« back to all changes in this revision

Viewing changes to src/live_effects/lpe-test-doEffect-stack.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Viehmann
  • Date: 2008-09-09 23:29:02 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20080909232902-c50iujhk1w79u8e7
Tags: 0.46-2.1
* Non-maintainer upload.
* Add upstream patch fixing a crash in the open dialog
  in the zh_CN.utf8 locale. Closes: #487623.
  Thanks to Luca Bruno for the patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#define INKSCAPE_LPE_DOEFFECT_STACK_CPP
 
2
 
 
3
/*
 
4
 * Copyright (C) Johan Engelen 2007 <j.b.c.engelen@utwente.nl>
 
5
 *
 
6
 * Released under GNU GPL, read the file 'COPYING' for more information
 
7
 */
 
8
 
 
9
#include "live_effects/lpe-test-doEffect-stack.h"
 
10
 
 
11
#include <2geom/piecewise.h>
 
12
#include <vector>
 
13
#include <libnr/n-art-bpath.h>
 
14
 
 
15
namespace Inkscape {
 
16
namespace LivePathEffect {
 
17
 
 
18
 
 
19
LPEdoEffectStackTest::LPEdoEffectStackTest(LivePathEffectObject *lpeobject) :
 
20
    Effect(lpeobject),
 
21
    step(_("Stack step"), (""), "step", &wr, this)
 
22
{
 
23
    registerParameter( dynamic_cast<Parameter *>(&step) );
 
24
}
 
25
 
 
26
LPEdoEffectStackTest::~LPEdoEffectStackTest()
 
27
{
 
28
 
 
29
}
 
30
 
 
31
void
 
32
LPEdoEffectStackTest::doEffect (SPCurve * curve)
 
33
{
 
34
    if (step >= 1) {
 
35
        Effect::doEffect(curve);
 
36
    } else {
 
37
        // return here
 
38
        return;
 
39
    }
 
40
}
 
41
 
 
42
NArtBpath *
 
43
LPEdoEffectStackTest::doEffect_nartbpath (NArtBpath * path_in)
 
44
{
 
45
    if (step >= 2) {
 
46
        return Effect::doEffect_nartbpath(path_in);
 
47
    } else {
 
48
        // return here
 
49
        NArtBpath *path_out;
 
50
 
 
51
        unsigned ret = 0;
 
52
        while ( path_in[ret].code != NR_END ) {
 
53
            ++ret;
 
54
        }
 
55
        unsigned len = ++ret;
 
56
 
 
57
        path_out = g_new(NArtBpath, len);
 
58
        memcpy(path_out, path_in, len * sizeof(NArtBpath));
 
59
        return path_out;
 
60
    }
 
61
}
 
62
 
 
63
std::vector<Geom::Path>
 
64
LPEdoEffectStackTest::doEffect_path (std::vector<Geom::Path> & path_in)
 
65
{
 
66
    if (step >= 3) {
 
67
        return Effect::doEffect_path(path_in);
 
68
    } else {
 
69
        // return here
 
70
        std::vector<Geom::Path> path_out = path_in;
 
71
        return path_out;
 
72
    }
 
73
}
 
74
 
 
75
Geom::Piecewise<Geom::D2<Geom::SBasis> > 
 
76
LPEdoEffectStackTest::doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pwd2_in)
 
77
{
 
78
    Geom::Piecewise<Geom::D2<Geom::SBasis> > output = pwd2_in;
 
79
 
 
80
    return output;
 
81
}
 
82
 
 
83
 
 
84
} // namespace LivePathEffect
 
85
} /* namespace Inkscape */
 
86
 
 
87
/*
 
88
  Local Variables:
 
89
  mode:c++
 
90
  c-file-style:"stroustrup"
 
91
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
 
92
  indent-tabs-mode:nil
 
93
  fill-column:99
 
94
  End:
 
95
*/
 
96
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :