diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2011-07-02 06:11:08 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2011-07-02 06:11:08 +0000 |
| commit | 07c8dea2b0361314ac4bbf0e45dd4c33ce11f206 (patch) | |
| tree | d5452b36543452b5e79e9c7c688c897a6b87dfe8 /src | |
| parent | compatibility for building with clang, this failed for 2 reasons. (diff) | |
| download | inkscape-07c8dea2b0361314ac4bbf0e45dd4c33ce11f206.tar.gz inkscape-07c8dea2b0361314ac4bbf0e45dd4c33ce11f206.zip | |
Applying patch from Campbell Barton to help building on other than gcc.
(bzr r10399)
Diffstat (limited to 'src')
| -rw-r--r-- | src/2geom/solve-bezier-parametric.cpp | 12 | ||||
| -rw-r--r-- | src/box3d.cpp | 7 | ||||
| -rw-r--r-- | src/display/nr-filter-gaussian.cpp | 8 | ||||
| -rw-r--r-- | src/libcola/shortest_paths.cpp | 18 |
4 files changed, 25 insertions, 20 deletions
diff --git a/src/2geom/solve-bezier-parametric.cpp b/src/2geom/solve-bezier-parametric.cpp index 76cf65e17..437f073a3 100644 --- a/src/2geom/solve-bezier-parametric.cpp +++ b/src/2geom/solve-bezier-parametric.cpp @@ -68,13 +68,13 @@ find_parametric_bezier_roots(Geom::Point const *w, /* The control points */ break; } - /* Otherwise, solve recursively after subdividing control polygon */ - Geom::Point Left[degree+1], /* New left and right */ - Right[degree+1]; /* control polygons */ - Bezier(w, degree, 0.5, Left, Right); + // Otherwise, solve recursively after subdividing control polygon + std::vector<Geom::Point> Left(degree + 1); // New left and right + std::vector<Geom::Point> Right(degree + 1); // control polygons + Bezier(w, degree, 0.5, &Left[0], &Right[0]); total_subs ++; - find_parametric_bezier_roots(Left, degree, solutions, depth+1); - find_parametric_bezier_roots(Right, degree, solutions, depth+1); + find_parametric_bezier_roots(&Left[0], degree, solutions, depth + 1); + find_parametric_bezier_roots(&Right[0], degree, solutions, depth + 1); } diff --git a/src/box3d.cpp b/src/box3d.cpp index ac5814e4d..1a9c26b26 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -426,6 +426,9 @@ box3d_get_center_screen (SPBox3D *box) { static double remember_snap_threshold = 30; static guint remember_snap_index = 0; +// constant for sizing the array of points to be considered: +static const int MAX_POINT_COUNT = 4; + static Proj::Pt3 box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &start_pt) { double z_coord = start_pt[Proj::Z]; @@ -455,7 +458,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta Box3D::Line diag2(A, E); // diag2 is only taken into account if id equals -1, i.e., if we are snapping the center int num_snap_lines = (id != -1) ? 3 : 4; - Geom::Point snap_pts[num_snap_lines]; + Geom::Point snap_pts[MAX_POINT_COUNT]; snap_pts[0] = pl1.closest_to (pt); snap_pts[1] = pl2.closest_to (pt); @@ -467,7 +470,7 @@ box3d_snap (SPBox3D *box, int id, Proj::Pt3 const &pt_proj, Proj::Pt3 const &sta gdouble const zoom = inkscape_active_desktop()->current_zoom(); // determine the distances to all potential snapping points - double snap_dists[num_snap_lines]; + double snap_dists[MAX_POINT_COUNT]; for (int i = 0; i < num_snap_lines; ++i) { snap_dists[i] = Geom::L2 (snap_pts[i] - pt) * zoom; } diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 326c37160..14e305f96 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -525,8 +525,8 @@ gaussian_pass_FIR(Geom::Dim2 d, double deviation, cairo_surface_t *src, cairo_su { int scr_len = _effect_area_scr(deviation); // Filter kernel for x direction - FIRValue kernel[scr_len+1]; - _make_kernel(kernel, deviation); + std::vector<FIRValue> kernel(scr_len + 1); + _make_kernel(&kernel[0], deviation); int stride = cairo_image_surface_get_stride(src); int w = cairo_image_surface_get_width(src); @@ -539,13 +539,13 @@ gaussian_pass_FIR(Geom::Dim2 d, double deviation, cairo_surface_t *src, cairo_su filter2D_FIR<unsigned char,1>( cairo_image_surface_get_data(dest), d == Geom::X ? 1 : stride, d == Geom::X ? stride : 1, cairo_image_surface_get_data(src), d == Geom::X ? 1 : stride, d == Geom::X ? stride : 1, - w, h, kernel, scr_len, num_threads); + w, h, &kernel[0], scr_len, num_threads); break; case CAIRO_FORMAT_ARGB32: ///< Premultiplied 8 bit RGBA filter2D_FIR<unsigned char,4>( cairo_image_surface_get_data(dest), d == Geom::X ? 4 : stride, d == Geom::X ? stride : 4, cairo_image_surface_get_data(src), d == Geom::X ? 4 : stride, d == Geom::X ? stride : 4, - w, h, kernel, scr_len, num_threads); + w, h, &kernel[0], scr_len, num_threads); break; default: assert(false); diff --git a/src/libcola/shortest_paths.cpp b/src/libcola/shortest_paths.cpp index 4f4183b07..ebc2c93de 100644 --- a/src/libcola/shortest_paths.cpp +++ b/src/libcola/shortest_paths.cpp @@ -73,6 +73,7 @@ void dijkstra( } } } + void dijkstra( unsigned s, unsigned n, @@ -80,21 +81,22 @@ void dijkstra( vector<Edge>& es, double* eweights) { - assert(s<n); - Node vs[n]; - dijkstra_init(vs,es,eweights); - dijkstra(s,n,vs,d); + assert(s < n); + std::vector<Node> vs(n); + dijkstra_init(&vs[0], es, eweights); + dijkstra(s, n, &vs[0], d); } + void johnsons( unsigned n, double** D, vector<Edge>& es, double* eweights) { - Node vs[n]; - dijkstra_init(vs,es,eweights); - for(unsigned k=0;k<n;k++) { - dijkstra(k,n,vs,D[k]); + std::vector<Node> vs(n); + dijkstra_init(&vs[0], es, eweights); + for (unsigned k = 0; k < n; k++) { + dijkstra(k,n,&vs[0],D[k]); } } } |
