[cairo-commit] cairomm/cairomm context.cc, 1.15, 1.16 scaledfont.cc, 1.2, 1.3

Jonathon Jongsma commit at pdx.freedesktop.org
Fri Aug 18 18:22:54 PDT 2006


Committed by: jjongsma

Update of /cvs/cairo/cairomm/cairomm
In directory kemper:/tmp/cvs-serv1157/cairomm

Modified Files:
	context.cc scaledfont.cc 
Log Message:
2006-08-18  Cedric Gustin  <cedric.gustin at gmail.com>

	* cairomm/context.cc: Define M_PI for MSVC.
	* cairomm/scaledfont.cc: Allocate glyph_array as a dynamic array
	as MSVC does not like non-const arguments as array size.
	* examples/pdf-surface/main.cc, examples/png_file/main.cc,
	examples/ps-surface/main.cc, examples/svg-surface/main.cc,
	examples/text-rotate/text-rotate.cc: Define M_PI for MSVC. 
	* configure.in, Makefile.am: Generate Makefiles in the MSVC
	subdirectories.  
	* .cvsignore: Added Eclipse .project to the list of ignored files.
	* MSVC/*: Added project and resource files for Visual Studio 2005.


Index: context.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/context.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- context.cc	18 Aug 2006 17:03:33 -0000	1.15
+++ context.cc	19 Aug 2006 01:22:52 -0000	1.16
@@ -19,6 +19,12 @@
 #include <cairomm/context.h>
 #include <cairomm/private.h>
 
+/* M_PI is defined in math.h in the case of Microsoft Visual C++ */
+#if defined(_MSC_VER)
+#define _USE_MATH_DEFINES
+#include <math.h>
+#endif 
+
 namespace Cairo
 {
 

Index: scaledfont.cc
===================================================================
RCS file: /cvs/cairo/cairomm/cairomm/scaledfont.cc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- scaledfont.cc	5 Jul 2006 15:17:21 -0000	1.2
+++ scaledfont.cc	19 Aug 2006 01:22:52 -0000	1.3
@@ -55,12 +55,16 @@
   // copy the data from the vector to a standard C array.  I don't believe
   // this will be a frequently used function so I think the performance hit is
   // more than offset by the increased flexibility of the STL interface.
-  Glyph glyph_array[glyphs.size()];
+  
+  // Use new to allocate memory as MSCV complains about non-const array size with
+  // Glyph glyph_array[glyphs.size()]
+  Glyph* glyph_array= new Glyph[glyphs.size()];
   std::copy(glyphs.begin(), glyphs.end(), glyph_array);
 
   cairo_scaled_font_glyph_extents(m_cobject, glyph_array, glyphs.size(),
       static_cast<cairo_text_extents_t*>(&extents));
   check_object_status_and_throw_exception(*this);
+  delete[] glyph_array;
 }
 
 RefPtr<FontFace> ScaledFont::get_font_face() const



More information about the cairo-commit mailing list