From: <md...@us...> - 2009-05-28 11:54:41
|
Revision: 7150 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7150&view=rev Author: mdboom Date: 2009-05-28 11:54:35 +0000 (Thu, 28 May 2009) Log Message: ----------- Fix some compiler warnings Modified Paths: -------------- trunk/matplotlib/agg24/include/agg_conv_curve.h trunk/matplotlib/src/_png.cpp Modified: trunk/matplotlib/agg24/include/agg_conv_curve.h =================================================================== --- trunk/matplotlib/agg24/include/agg_conv_curve.h 2009-05-28 11:54:18 UTC (rev 7149) +++ trunk/matplotlib/agg24/include/agg_conv_curve.h 2009-05-28 11:54:35 UTC (rev 7150) @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -28,31 +28,31 @@ //---------------------------------------------------------------conv_curve - // Curve converter class. Any path storage can have Bezier curves defined - // by their control points. There're two types of curves supported: curve3 + // Curve converter class. Any path storage can have Bezier curves defined + // by their control points. There're two types of curves supported: curve3 // and curve4. Curve3 is a conic Bezier curve with 2 endpoints and 1 control // point. Curve4 has 2 control points (4 points in total) and can be used - // to interpolate more complicated curves. Curve4, unlike curve3 can be used - // to approximate arcs, both circular and elliptical. Curves are approximated - // with straight lines and one of the approaches is just to store the whole - // sequence of vertices that approximate our curve. It takes additional - // memory, and at the same time the consecutive vertices can be calculated - // on demand. + // to interpolate more complicated curves. Curve4, unlike curve3 can be used + // to approximate arcs, both circular and elliptical. Curves are approximated + // with straight lines and one of the approaches is just to store the whole + // sequence of vertices that approximate our curve. It takes additional + // memory, and at the same time the consecutive vertices can be calculated + // on demand. // // Initially, path storages are not suppose to keep all the vertices of the // curves (although, nothing prevents us from doing so). Instead, path_storage // keeps only vertices, needed to calculate a curve on demand. Those vertices - // are marked with special commands. So, if the path_storage contains curves - // (which are not real curves yet), and we render this storage directly, - // all we will see is only 2 or 3 straight line segments (for curve3 and - // curve4 respectively). If we need to see real curves drawn we need to - // include this class into the conversion pipeline. + // are marked with special commands. So, if the path_storage contains curves + // (which are not real curves yet), and we render this storage directly, + // all we will see is only 2 or 3 straight line segments (for curve3 and + // curve4 respectively). If we need to see real curves drawn we need to + // include this class into the conversion pipeline. // - // Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4 - // and converts these vertices into a move_to/line_to sequence. + // Class conv_curve recognizes commands path_cmd_curve3 and path_cmd_curve4 + // and converts these vertices into a move_to/line_to sequence. //----------------------------------------------------------------------- - template<class VertexSource, - class Curve3=curve3, + template<class VertexSource, + class Curve3=curve3, class Curve4=curve4> class conv_curve { public: @@ -64,51 +64,51 @@ m_source(&source), m_last_x(0.0), m_last_y(0.0) {} void attach(VertexSource& source) { m_source = &source; } - void approximation_method(curve_approximation_method_e v) - { + void approximation_method(curve_approximation_method_e v) + { m_curve3.approximation_method(v); m_curve4.approximation_method(v); } - curve_approximation_method_e approximation_method() const - { + curve_approximation_method_e approximation_method() const + { return m_curve4.approximation_method(); } - void approximation_scale(double s) - { - m_curve3.approximation_scale(s); - m_curve4.approximation_scale(s); + void approximation_scale(double s) + { + m_curve3.approximation_scale(s); + m_curve4.approximation_scale(s); } - double approximation_scale() const - { - return m_curve4.approximation_scale(); + double approximation_scale() const + { + return m_curve4.approximation_scale(); } - void angle_tolerance(double v) - { - m_curve3.angle_tolerance(v); - m_curve4.angle_tolerance(v); + void angle_tolerance(double v) + { + m_curve3.angle_tolerance(v); + m_curve4.angle_tolerance(v); } - double angle_tolerance() const - { - return m_curve4.angle_tolerance(); + double angle_tolerance() const + { + return m_curve4.angle_tolerance(); } - void cusp_limit(double v) - { - m_curve3.cusp_limit(v); - m_curve4.cusp_limit(v); + void cusp_limit(double v) + { + m_curve3.cusp_limit(v); + m_curve4.cusp_limit(v); } - double cusp_limit() const - { - return m_curve4.cusp_limit(); + double cusp_limit() const + { + return m_curve4.cusp_limit(); } - void rewind(unsigned path_id); + void rewind(unsigned path_id); unsigned vertex(double* x, double* y); private: @@ -154,10 +154,10 @@ return path_cmd_line_to; } - double ct2_x; - double ct2_y; - double end_x; - double end_y; + double ct2_x = 0.0; + double ct2_y = 0.0; + double end_x = 0.0; + double end_y = 0.0; unsigned cmd = m_source->vertex(x, y); switch(cmd) @@ -165,8 +165,8 @@ case path_cmd_curve3: m_source->vertex(&end_x, &end_y); - m_curve3.init(m_last_x, m_last_y, - *x, *y, + m_curve3.init(m_last_x, m_last_y, + *x, *y, end_x, end_y); m_curve3.vertex(x, y); // First call returns path_cmd_move_to @@ -178,9 +178,9 @@ m_source->vertex(&ct2_x, &ct2_y); m_source->vertex(&end_x, &end_y); - m_curve4.init(m_last_x, m_last_y, - *x, *y, - ct2_x, ct2_y, + m_curve4.init(m_last_x, m_last_y, + *x, *y, + ct2_x, ct2_y, end_x, end_y); m_curve4.vertex(x, y); // First call returns path_cmd_move_to Modified: trunk/matplotlib/src/_png.cpp =================================================================== --- trunk/matplotlib/src/_png.cpp 2009-05-28 11:54:18 UTC (rev 7149) +++ trunk/matplotlib/src/_png.cpp 2009-05-28 11:54:35 UTC (rev 7150) @@ -272,11 +272,11 @@ size_t offset = y*A->strides[0] + x*A->strides[1]; if (bit_depth == 16) { png_uint_16* ptr = &reinterpret_cast<png_uint_16*> (row)[x * dimensions[2]]; - for (png_uint_32 p = 0; p < dimensions[2]; p++) + for (png_uint_32 p = 0; p < (png_uint_32)dimensions[2]; p++) *(float*)(A->data + offset + p*A->strides[2]) = (float)(ptr[p]) / max_value; } else { png_byte* ptr = &(row[x * dimensions[2]]); - for (png_uint_32 p = 0; p < dimensions[2]; p++) + for (png_uint_32 p = 0; p < (png_uint_32)dimensions[2]; p++) { *(float*)(A->data + offset + p*A->strides[2]) = (float)(ptr[p]) / max_value; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |