Beispiel #1
0
        void HandleDone(object sender, System.EventArgs args)
        {
            Log.DebugTimerPrint(timer, "Loading image took {0}");
            IImageLoader loader = sender as IImageLoader;

            if (loader != this.loader)
            {
                return;
            }

            Pixbuf prev = this.Pixbuf;

            if (Pixbuf != loader.Pixbuf)
            {
                Pixbuf = loader.Pixbuf;
            }

            if (Pixbuf == null)
            {
                // FIXME: Do we have test cases for this ???

                // FIXME in some cases the image passes completely through the
                // pixbuf loader without properly loading... I'm not sure what to do about this other
                // than try to load the image one last time.
                try {
                    Log.Warning("Falling back to file loader");
                    Pixbuf = PhotoLoader.Load(item.Collection, item.Index);
                } catch (Exception e) {
                    LoadErrorImage(e);
                }
            }

            if (loader.Pixbuf != null)             //FIXME: this test in case the photo was loaded with the direct loader
            {
                PixbufOrientation = Accelerometer.GetViewOrientation(loader.PixbufOrientation);
            }
            else
            {
                PixbufOrientation = ImageOrientation.TopLeft;
            }

            if (Pixbuf == null)
            {
                LoadErrorImage(null);
            }
            else
            {
                ZoomFit();
            }

            progressive_display = true;

            if (prev != this.Pixbuf && prev != null)
            {
                prev.Dispose();
            }
        }
Beispiel #2
0
        void HandlePixbufPrepared(object sender, AreaPreparedEventArgs args)
        {
            IImageLoader loader = sender as IImageLoader;

            if (loader != this.loader)
            {
                return;
            }

            if (!ShowProgress)
            {
                return;
            }

            Gdk.Pixbuf prev = this.Pixbuf;
            this.Pixbuf       = loader.Pixbuf;
            PixbufOrientation = Accelerometer.GetViewOrientation(loader.PixbufOrientation);
            if (prev != null)
            {
                prev.Dispose();
            }

            this.ZoomFit(args.ReducedResolution);
        }