f-spot r3923 - in trunk: . libfspot src src/Cairo src/Widgets



Author: sdelcroix
Date: Fri May 16 19:08:21 2008
New Revision: 3923
URL: http://svn.gnome.org/viewvc/f-spot?rev=3923&view=rev

Log:
2008-05-16  Stephane Delcroix  <stephane delcroix org>

	* src/Widgets/SoftFocus.cs:
	* src/Cairo:
	* src/Texture.cs:
	* src/Makefile.am:
	* src/MemorySurface.cs:
	* libfspot/f-image-surface.h:
	* libfspot/f-image-surface.c: drop our own Cairo copy


Added:
   trunk/src/MemorySurface.cs
Removed:
   trunk/src/Cairo/
Modified:
   trunk/ChangeLog
   trunk/libfspot/f-image-surface.c
   trunk/libfspot/f-image-surface.h
   trunk/src/Makefile.am
   trunk/src/Texture.cs
   trunk/src/Widgets/SoftFocus.cs

Modified: trunk/libfspot/f-image-surface.c
==============================================================================
--- trunk/libfspot/f-image-surface.c	(original)
+++ trunk/libfspot/f-image-surface.c	Fri May 16 19:08:21 2008
@@ -48,3 +48,16 @@
 {
 	return GPOINTER_TO_INT (cairo_surface_get_user_data (surface, &format_key));
 }
+
+int
+f_image_surface_get_width (cairo_surface_t *surface)
+{
+	return cairo_image_surface_get_width (surface);
+}
+
+int
+f_image_surface_get_height (cairo_surface_t *surface)
+{
+	return cairo_image_surface_get_height (surface);	
+}
+

Modified: trunk/libfspot/f-image-surface.h
==============================================================================
--- trunk/libfspot/f-image-surface.h	(original)
+++ trunk/libfspot/f-image-surface.h	Fri May 16 19:08:21 2008
@@ -1,2 +1,4 @@
 void  *f_image_surface_get_data (cairo_surface_t *surface);
 cairo_surface_t *f_image_surface_create (cairo_format_t format, int width, int height);
+int f_image_surface_get_width (cairo_surface_t *surface);
+int f_image_surface_get_height (cairo_surface_t *surface);

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Fri May 16 19:08:21 2008
@@ -42,50 +42,6 @@
 	$(srcdir)/JobScheduler/Scheduler.cs
 
 F_SPOT_CSDISTFILES =				\
-	$(srcdir)/Cairo/Antialias.cs		\
-	$(srcdir)/Cairo/Cairo.cs		\
-	$(srcdir)/Cairo/Content.cs		\
-	$(srcdir)/Cairo/Context.cs		\
-	$(srcdir)/Cairo/DirectFBSurface.cs	\
-	$(srcdir)/Cairo/Extend.cs		\
-	$(srcdir)/Cairo/FillRule.cs		\
-	$(srcdir)/Cairo/Filter.cs		\
-	$(srcdir)/Cairo/FontExtents.cs		\
-	$(srcdir)/Cairo/FontFace.cs		\
-	$(srcdir)/Cairo/FontOptions.cs		\
-	$(srcdir)/Cairo/FontSlant.cs		\
-	$(srcdir)/Cairo/FontType.cs		\
-	$(srcdir)/Cairo/FontWeight.cs		\
-	$(srcdir)/Cairo/Format.cs		\
-	$(srcdir)/Cairo/GlitzSurface.cs		\
-	$(srcdir)/Cairo/Glyph.cs		\
-	$(srcdir)/Cairo/Gradient.cs		\
-	$(srcdir)/Cairo/HintMetrics.cs		\
-	$(srcdir)/Cairo/HintStyle.cs		\
-	$(srcdir)/Cairo/ImageSurface.cs		\
-	$(srcdir)/Cairo/LinearGradient.cs	\
-	$(srcdir)/Cairo/LineCap.cs		\
-	$(srcdir)/Cairo/LineJoin.cs		\
-	$(srcdir)/Cairo/Matrix.cs		\
-	$(srcdir)/Cairo/Operator.cs		\
-	$(srcdir)/Cairo/Pattern.cs		\
-	$(srcdir)/Cairo/PatternType.cs		\
-	$(srcdir)/Cairo/PdfSurface.cs		\
-	$(srcdir)/Cairo/PSSurface.cs		\
-	$(srcdir)/Cairo/RadialGradient.cs	\
-	$(srcdir)/Cairo/Rectangle.cs		\
-	$(srcdir)/Cairo/SolidPattern.cs		\
-	$(srcdir)/Cairo/Status.cs		\
-	$(srcdir)/Cairo/SubpixelOrder.cs	\
-	$(srcdir)/Cairo/Surface.cs		\
-	$(srcdir)/Cairo/SurfacePattern.cs	\
-	$(srcdir)/Cairo/SurfaceType.cs		\
-	$(srcdir)/Cairo/SvgSurface.cs		\
-	$(srcdir)/Cairo/SvgVersion.cs		\
-	$(srcdir)/Cairo/TextExtents.cs		\
-	$(srcdir)/Cairo/Win32Surface.cs		\
-	$(srcdir)/Cairo/XcbSurface.cs		\
-	$(srcdir)/Cairo/XlibSurface.cs		\
 	$(srcdir)/AsyncPixbufLoader.cs		\
 	$(srcdir)/BeagleNotifier.cs		\
 	$(srcdir)/BlockProcessor.cs		\
@@ -175,6 +131,7 @@
 	$(srcdir)/LastRollDialog.cs		\
 	$(srcdir)/Loupe.cs			\
 	$(srcdir)/MainWindow.cs			\
+	$(srcdir)/MemorySurface.cs		\
 	$(srcdir)/MetaStore.cs			\
 	$(srcdir)/MetadataStore.cs		\
 	$(srcdir)/NullPreferenceBackend.cs	\
@@ -317,6 +274,7 @@
 	-r:Mono.Posix				\
 	-r:Mono.Security			\
 	-r:MCairo=Mono.Cairo			\
+	-r:Mono.Cairo				\
 	-r:ICSharpCode.SharpZipLib		\
 	-r:FSpot.Core.dll			\
 	-r:FSpot.Query.dll			\

Added: trunk/src/MemorySurface.cs
==============================================================================
--- (empty file)
+++ trunk/src/MemorySurface.cs	Fri May 16 19:08:21 2008
@@ -0,0 +1,68 @@
+/* 
+ * MemorySurface.cs
+ *
+ * Copyright 2007 Novell Inc.
+ *
+ * Author
+ *   Larry Ewing <lewing novell com>
+ *
+ * See COPYING for license information.
+ *
+ */
+
+using System;
+using System.Runtime.InteropServices;
+
+namespace FSpot {
+	// FIXME this class is a hack to have get_data functionality
+	// on cairo 1.0.x
+	public sealed class MemorySurface : Cairo.Surface {
+		[DllImport ("libfspot")]
+		static extern IntPtr f_image_surface_create (Cairo.Format format, int width, int height);
+		
+		[DllImport ("libfspot")]
+		static extern IntPtr f_image_surface_get_data (IntPtr surface);
+
+		[DllImport ("libfspot")]
+		static extern Cairo.Format f_image_surface_get_format (IntPtr surface);
+
+		[DllImport ("libfspot")]
+		static extern int f_image_surface_get_width (IntPtr surface);
+
+		[DllImport ("libfspot")]
+		static extern int f_image_surface_get_height (IntPtr surface);
+
+		public MemorySurface (Cairo.Format format, int width, int height)
+			: this (f_image_surface_create (format, width, height))
+		{
+		}
+
+		public MemorySurface (IntPtr handle) : base (handle, true)
+		{
+			if (DataPtr == IntPtr.Zero)
+				throw new ApplicationException ("Missing image data");
+		}
+
+		public IntPtr DataPtr {
+			get {
+				return f_image_surface_get_data (Handle);
+			}
+		}
+
+		public Cairo.Format Format {
+			get {
+				return f_image_surface_get_format (Handle);
+			}
+		}
+		
+		public int Width {
+			get { return f_image_surface_get_width (Handle); }
+		}
+
+		public int Height {
+			get { return f_image_surface_get_height (Handle); }
+		}
+	}
+}
+
+

Modified: trunk/src/Texture.cs
==============================================================================
--- trunk/src/Texture.cs	(original)
+++ trunk/src/Texture.cs	Fri May 16 19:08:21 2008
@@ -18,42 +18,6 @@
 using FSpot.Widgets;
 
 namespace FSpot {
-	// FIXME this class is a hack to have get_data functionality
-	// on cairo 1.0.x
-	public sealed class MemorySurface : ImageSurface {
-		[DllImport ("libfspot")]
-		static extern IntPtr f_image_surface_create (Cairo.Format format, int width, int height);
-		
-		[DllImport ("libfspot")]
-		static extern IntPtr f_image_surface_get_data (IntPtr surface);
-
-		[DllImport ("libfspot")]
-		static extern Cairo.Format f_image_surface_get_format (IntPtr surface);
-
-		public MemorySurface (Cairo.Format format, int width, int height)
-			: this (f_image_surface_create (format, width, height))
-		{
-		}
-
-		public MemorySurface (IntPtr handle) : base (handle, true)
-		{
-			if (Pixels == IntPtr.Zero)
-				throw new ApplicationException ("Missing image data");
-		}
-
-		public IntPtr Pixels {
-			get {
-				return f_image_surface_get_data (Handle);
-			}
-		}
-
-		public Cairo.Format Format {
-			get {
-				return f_image_surface_get_format (Handle);
-			}
-		}
-	}
-
 	public class TextureException : System.Exception {
 		public TextureException (string msg) : base (msg)
 		{
@@ -125,13 +89,13 @@
 			float scale = (float)Math.Min (1.0, max_size / (double) Math.Max (width, height));
 			System.Console.WriteLine ("max texture size {0} scaling to {1}", max_size, scale);
 			
-			if (surface.Pixels == IntPtr.Zero)
+			if (surface.DataPtr == IntPtr.Zero)
 				throw new TextureException ("Surface has no data");
 
 			if (surface.Format != Format.Rgb24 && surface.Format != Format.Argb32)
 				throw new TextureException ("Unsupported format type");
 
-			IntPtr pixels = surface.Pixels;
+			IntPtr pixels = surface.DataPtr;
 			IntPtr tmp = IntPtr.Zero;
 			if (scale != 1.0) {
 				int swidth = (int)(width * scale);

Modified: trunk/src/Widgets/SoftFocus.cs
==============================================================================
--- trunk/src/Widgets/SoftFocus.cs	(original)
+++ trunk/src/Widgets/SoftFocus.cs	Fri May 16 19:08:21 2008
@@ -8,9 +8,15 @@
  */
 using Cairo;
 using System;
+using System.Runtime.InteropServices;
 
 namespace FSpot.Widgets {
+
 	public class SoftFocus : IEffect {
+
+		[DllImport ("cairo")]
+		internal static extern int cairo_version ();
+
 		ImageInfo info;
 		double radius;
 		double amount;
@@ -102,7 +108,7 @@
 			RadialGradient circle;
 
 			// FIXME ugh cairo 1.0.2 is so broken why are we still shipping it.
-			if (CairoAPI.cairo_version () > (1 * 10000 + 2 * 100 + 0)) {
+			if (cairo_version () > (1 * 10000 + 2 * 100 + 0)) {
 				circle = new RadialGradient (center.X * scale, center.Y * scale, radius * max * .7,
 							     center.X * scale, center.Y * scale, radius * max + max * .2);
 



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