f-spot r4595 - in trunk: . src
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4595 - in trunk: . src
- Date: Tue, 18 Nov 2008 15:30:49 +0000 (UTC)
Author: sdelcroix
Date: Tue Nov 18 15:30:48 2008
New Revision: 4595
URL: http://svn.gnome.org/viewvc/f-spot?rev=4595&view=rev
Log:
2008-11-18 Stephane Delcroix <sdelcroix novell com>
* src/ZoomUtils.cs:
* src/PhotoImageView.cs: moved the only method left in ZoomUtils to
PhotoImageView. dropping ZoomUtils.cs
Removed:
trunk/src/ZoomUtils.cs
Modified:
trunk/ChangeLog
trunk/src/Makefile.am
trunk/src/PhotoImageView.cs
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Tue Nov 18 15:30:48 2008
@@ -245,7 +245,6 @@
$(srcdir)/Vector.cs \
$(srcdir)/ThumbnailCommand.cs \
$(srcdir)/QueryWidget.cs \
- $(srcdir)/ZoomUtils.cs \
$(srcdir)/GPhotoCamera.cs \
$(srcdir)/CameraSelectionDialog.cs \
$(srcdir)/CameraFileSelectionDialog.cs \
Modified: trunk/src/PhotoImageView.cs
==============================================================================
--- trunk/src/PhotoImageView.cs (original)
+++ trunk/src/PhotoImageView.cs Tue Nov 18 15:30:48 2008
@@ -395,11 +395,11 @@
int available_width = (scrolled != null) ? scrolled.Allocation.Width : this.Allocation.Width;
int available_height = (scrolled != null) ? scrolled.Allocation.Height : this.Allocation.Height;
- double zoom_to_fit = ZoomUtils.FitToScale ((uint) available_width,
- (uint) available_height,
- (uint) pixbuf.Width,
- (uint) pixbuf.Height,
- upscale);
+ double zoom_to_fit = FitToScale ((uint) available_width,
+ (uint) available_height,
+ (uint) pixbuf.Width,
+ (uint) pixbuf.Height,
+ upscale);
double image_zoom = zoom_to_fit;
@@ -408,7 +408,21 @@
if (scrolled != null)
scrolled.SetPolicy (Gtk.PolicyType.Automatic, Gtk.PolicyType.Automatic);
}
-
+
+ static double FitToScale (uint dest_width, uint dest_height, uint src_width, uint src_height, bool upscale_smaller)
+ {
+ if (src_width == 0 || src_height == 0)
+ return 1.0;
+
+ if (dest_width == 0 || dest_height == 0)
+ return 0.0;
+
+ if (src_width <= dest_width && src_height <= dest_height && !upscale_smaller)
+ return 1.0;
+
+ return Math.Min ((double)dest_width / src_width, (double)dest_height / src_height);
+ }
+
private void HandleLoupeDestroy (object sender, EventArgs args)
{
if (sender == loupe)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]