gnomemm r1913 - in cluttermm/trunk: . clutter/src tools/m4



Author: daniel
Date: Tue Dec 23 17:21:58 2008
New Revision: 1913
URL: http://svn.gnome.org/viewvc/gnomemm?rev=1913&view=rev

Log:
* clutter/src/texture.{ccg,hg} (Texture::set_from_file): Replace
Glib::ustring parameter type by std::string.  Filenames have no
defined character encoding!
* clutter/src/texture.{ccg,hg} (Texture::create_from_file): Add it.
The justification for not wrapping clutter_texture_new_from_file()
might apply to the constructor, but I don't see how it applies to
the create method.
(Texture::*): Replace uses of guchar for binary data with guint8.
It's got nothing to do with character strings.
* tools/m4/convert_cluttermm.m4: Add _EQUAL() conversions between
guint8 and guchar.

Modified:
   cluttermm/trunk/ChangeLog
   cluttermm/trunk/clutter/src/texture.ccg
   cluttermm/trunk/clutter/src/texture.hg
   cluttermm/trunk/tools/m4/convert_cluttermm.m4

Modified: cluttermm/trunk/clutter/src/texture.ccg
==============================================================================
--- cluttermm/trunk/clutter/src/texture.ccg	(original)
+++ cluttermm/trunk/clutter/src/texture.ccg	Tue Dec 23 17:21:58 2008
@@ -1,4 +1,5 @@
-/* Copyright (C) 2007 The cluttermm Development Team
+/*
+ * Copyright (c) 2007 The cluttermm Development Team
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -20,5 +21,11 @@
 namespace Clutter
 {
 
-} //namespace Clutter
+Glib::RefPtr<Texture> Texture::create_from_file(const std::string& filename)
+{
+  const Glib::RefPtr<Texture> result (new Texture());
+  result->set_from_file(filename);
+  return result;
+}
 
+} // namespace Clutter

Modified: cluttermm/trunk/clutter/src/texture.hg
==============================================================================
--- cluttermm/trunk/clutter/src/texture.hg	(original)
+++ cluttermm/trunk/clutter/src/texture.hg	Tue Dec 23 17:21:58 2008
@@ -33,8 +33,7 @@
  */
 _WRAP_GERROR(TextureError, ClutterTextureError, CLUTTER_TEXTURE_ERROR)
 
-class Texture :
-  public Actor
+class Texture : public Actor
 {
   _CLASS_GOBJECT(Texture, ClutterTexture, CLUTTER_TEXTURE, Actor, ClutterActor)
 
@@ -43,7 +42,7 @@
   // We do not wrap this constructor because it might throw an error. This
   // gets difficult to get right especially for disabled exceptions in glibmm,
   // and it is easy enough to create a texture and call set_from_file() on
-  // it manually:
+  // it manually.  But we do wrap the create method at least. --danielk
   _IGNORE(clutter_texture_new_from_file)
 
   // TODO: Wrap clutter_texture_new_from_actor. This needs changes in clutter
@@ -54,14 +53,14 @@
 #m4 _CONVERSION(`ClutterActor*',`Glib::RefPtr<Texture>',`Glib::wrap((ClutterTexture*)$3)')
 
   _WRAP_CREATE()
-  //_WRAP_CREATE(const Glib::ustring& filename);
+  static Glib::RefPtr<Texture> create_from_file(const std::string& filename);
   //_WRAP_CREATE(const Glib::RefPtr<Actor>& actor);
 
-  _WRAP_METHOD(bool set_from_file(const Glib::ustring& filename), clutter_texture_set_from_file, errthrow)
-  _WRAP_METHOD(bool set_from_rgb_data(const guchar* data, bool has_alpha, int width, int height, int rowstride, int bpp, TextureFlags flags), clutter_texture_set_from_rgb_data, errthrow)
-  _WRAP_METHOD(bool set_from_yuv_data(const guchar* data, int width, int height, TextureFlags flags), clutter_texture_set_from_yuv_data, errthrow)
-  _WRAP_METHOD(bool set_area_from_rgb_data(const guchar* data, bool has_alpha, int x, int y, int width, int height, int rowstride, int bpp, TextureFlags flags), clutter_texture_set_area_from_rgb_data, errthrow)
-  _WRAP_METHOD(void get_base_size(gint& width, gint& height) const, clutter_texture_get_base_size)
+  _WRAP_METHOD(bool set_from_file(const std::string& filename), clutter_texture_set_from_file, errthrow)
+  _WRAP_METHOD(bool set_from_rgb_data(const guint8* data, bool has_alpha, int width, int height, int rowstride, int bpp, TextureFlags flags), clutter_texture_set_from_rgb_data, errthrow)
+  _WRAP_METHOD(bool set_from_yuv_data(const guint8* data, int width, int height, TextureFlags flags), clutter_texture_set_from_yuv_data, errthrow)
+  _WRAP_METHOD(bool set_area_from_rgb_data(const guint8* data, bool has_alpha, int x, int y, int width, int height, int rowstride, int bpp, TextureFlags flags), clutter_texture_set_area_from_rgb_data, errthrow)
+  _WRAP_METHOD(void get_base_size(int& width, int& height) const, clutter_texture_get_base_size)
 
   _WRAP_METHOD(TextureQuality get_filter_quality() const, clutter_texture_get_filter_quality)
   _WRAP_METHOD(void set_filter_quality(TextureQuality filter_quality), clutter_texture_set_filter_quality)
@@ -72,12 +71,13 @@
   _WRAP_METHOD(CoglHandle get_cogl_texture() const, clutter_texture_get_cogl_texture)
   _WRAP_METHOD(void set_cogl_texture(CoglHandle handle), clutter_texture_set_cogl_texture)
 
-  _WRAP_SIGNAL(void size_change(gint width, gint height), "size_change")
+  _WRAP_SIGNAL(void size_change(int width, int height), "size_change")
   _WRAP_SIGNAL(void pixbuf_change(), "pixbuf_change")
 
+#m4 // TODO: What's with the C type?
   _WRAP_PROPERTY("cogl-texture", CoglHandle)
   _WRAP_PROPERTY("disable-slicing", bool)
-  _WRAP_PROPERTY("filename", Glib::ustring)
+  _WRAP_PROPERTY("filename", std::string)
   _WRAP_PROPERTY("filter-quality", TextureQuality)
   _WRAP_PROPERTY("pixel-format", int)
   _WRAP_PROPERTY("repeat-x", bool)
@@ -87,5 +87,3 @@
 };
 
 } // namespace Clutter
-
-//vim: ts=2,sw=2

Modified: cluttermm/trunk/tools/m4/convert_cluttermm.m4
==============================================================================
--- cluttermm/trunk/tools/m4/convert_cluttermm.m4	(original)
+++ cluttermm/trunk/tools/m4/convert_cluttermm.m4	Tue Dec 23 17:21:58 2008
@@ -42,6 +42,10 @@
 _CONVERSION(`const Padding&',`const ClutterPadding*',`&($3)')
 _CONVERSION(`ClutterPadding*',`Padding&',`*($3)')
 
+_EQUAL(`guint8',`guchar')
+_EQUAL(`guint8*',`guchar*')
+_EQUAL(`const guint8*',`const guchar*')
+
 _CONVERSION(`guint8&',`guint8*',`&($3)')
 _CONVERSION(`guint8*',`guint8&',`*($3)')
 _CONVERSION(`ClutterFixed&',`ClutterFixed*',`&($3)')



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]