[f-spot: 12/41] now renders for all scales
- From: Stephane Delcroix <sdelcroix src gnome org>
- To: svn-commits-list gnome org
- Subject: [f-spot: 12/41] now renders for all scales
- Date: Mon, 15 Jun 2009 08:40:52 -0400 (EDT)
commit 503be180127c9ce66d875cc32567f4da6258a31d
Author: Stephane Delcroix <stephane delcroix org>
Date: Mon Jun 8 21:28:26 2009 +0200
now renders for all scales
src/Widgets/ImageView.cs | 61 ++++++++++++++++++++++++++++++++++++----------
1 files changed, 48 insertions(+), 13 deletions(-)
---
diff --git a/src/Widgets/ImageView.cs b/src/Widgets/ImageView.cs
index a98f077..dbd0459 100644
--- a/src/Widgets/ImageView.cs
+++ b/src/Widgets/ImageView.cs
@@ -243,32 +243,67 @@ namespace FSpot.Widgets
if (y_offset >= 0) //Bottom
PaintBackground (new Rectangle (0, y_offset + scaled_height, Allocation.Width, Allocation.Height - y_offset - scaled_height), area);
-
+ if (Pixbuf == null)
+ return;
+
area.Intersect (new Rectangle (x_offset, y_offset, scaled_width, scaled_height));
//Short circuit for 1:1 zoom
-// if (zoom == 1.0 &&
-// Pixbuf != null) {
- if (Pixbuf != null) {
+ if (zoom == 1.0) {
BinWindow.DrawPixbuf (Style.BlackGC,
Pixbuf,
- 0,
- 0,
- 0,
- 0,
+ area.X,
+ area.Y,
+ area.X,
+ area.Y,
area.Width, area.Height,
RgbDither.Max,
- 0,
- 0);
+ area.X - x_offset,
+ area.Y - y_offset);
+ return;
}
- this.ShowAll();
+ using (Pixbuf temp_pixbuf = new Pixbuf (Colorspace.Rgb, false, 8, area.Width, area.Height)) {
+ if (Pixbuf.HasAlpha)
+ temp_pixbuf.Fill (0x00000000);
+
+ //FIXME: compute check pattern
+ uint check_black = 0x00000000;
+ uint check_dark = 0x00555555;
+ int check_medium = 8;
+
+ Pixbuf.CompositeColor (temp_pixbuf,
+ 0,
+ 0,
+ area.Width,
+ area.Height,
+ -(area.X - x_offset),
+ -(area.Y - y_offset),
+ zoom,
+ zoom,
+ zoom == 1.0 ? InterpType.Nearest : interpolation, 255,
+ area.X - x_offset,
+ area.Y - y_offset,
+ check_medium,
+ check_black,
+ check_dark);
+
+ BinWindow.DrawPixbuf (Style.BlackGC,
+ temp_pixbuf,
+ 0,
+ 0,
+ area.X,
+ area.Y,
+ area.Width,
+ area.Height,
+ RgbDither.Max,
+ area.X - x_offset,
+ area.Y - y_offset);
+ }
}
protected override bool OnExposeEvent (EventExpose evnt)
{
- Console.WriteLine ("ImageView OnExposeEvent");
-
if (evnt == null)
return true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]