f-spot r4593 - in trunk: . libeog src
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4593 - in trunk: . libeog src
- Date: Tue, 18 Nov 2008 15:27:05 +0000 (UTC)
Author: sdelcroix
Date: Tue Nov 18 15:27:05 2008
New Revision: 4593
URL: http://svn.gnome.org/viewvc/f-spot?rev=4593&view=rev
Log:
2008-11-18 Stephane Delcroix <sdelcroix novell com>
* src/ZoomUtils.cs: reimplement it purely managed
* libeog/zoom.c:
* libeog/zoom.h:
* libeog/Makefile.am: dropping the zoom.* files
Removed:
trunk/libeog/zoom.c
trunk/libeog/zoom.h
Modified:
trunk/ChangeLog
trunk/libeog/Makefile.am
trunk/src/ZoomUtils.cs
Modified: trunk/libeog/Makefile.am
==============================================================================
--- trunk/libeog/Makefile.am (original)
+++ trunk/libeog/Makefile.am Tue Nov 18 15:27:05 2008
@@ -30,9 +30,7 @@
cursors.c \
cursors.h \
ui-image.c \
- ui-image.h \
- zoom.c \
- zoom.h
+ ui-image.h
libfspoteog_la_SOURCES = $(libfspoteog_files)
Modified: trunk/src/ZoomUtils.cs
==============================================================================
--- trunk/src/ZoomUtils.cs (original)
+++ trunk/src/ZoomUtils.cs Tue Nov 18 15:27:05 2008
@@ -1,28 +1,17 @@
using System;
-using System.Runtime.InteropServices;
public class ZoomUtils {
-
- [DllImport ("libfspoteog")]
- static extern void zoom_fit_size (uint dest_width, uint dest_height,
- uint src_width, uint src_height,
- bool upscale_smaller,
- out uint width, out uint height);
-
- public static void FitToSize (uint dest_width, uint dest_height, uint src_width, uint src_height,
- bool upscale_smaller, out uint width, out uint height)
+ public static double FitToScale (uint dest_width, uint dest_height, uint src_width, uint src_height, bool upscale_smaller)
{
- zoom_fit_size (dest_width, dest_height, src_width, src_height, upscale_smaller, out width, out height);
- }
+ if (src_width == 0 || src_height == 0)
+ return 1.0;
+ if (dest_width == 0 || dest_height == 0)
+ return 0.0;
- [DllImport ("libfspoteog")]
- static extern double zoom_fit_scale (uint dest_width, uint dest_height,
- uint src_width, uint src_height,
- bool upscale_smaller);
+ if (src_width <= dest_width && src_height <= dest_height && !upscale_smaller)
+ return 1.0;
- public static double FitToScale (uint dest_width, uint dest_height, uint src_width, uint src_height, bool upscale_smaller)
- {
- return zoom_fit_scale (dest_width, dest_height, src_width, src_height, upscale_smaller);
+ return Math.Min ((double)dest_width / src_width, (double)dest_height / src_height);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]