[gnome-documents] Revert "documents: store images in cairo surfaces"



commit f5aeab367ce8f2bcf35aa9617a69ad2f3186e8df
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Aug 7 05:24:04 2013 +0200

    Revert "documents: store images in cairo surfaces"
    
    Still depends on unreleased code in GJS.
    
    This reverts commit 59ae90741a1c4b560770a437a89faa00e1004b3c.

 src/documents.js |   19 +++++++------------
 src/view.js      |    8 ++++----
 2 files changed, 11 insertions(+), 16 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index f055f70..258bc18 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -229,7 +229,7 @@ const DocCommon = new Lang.Class({
         this.author = null;
         this.mtime = null;
         this.resourceUrn = null;
-        this.surface = null;
+        this.pixbuf = null;
         this.origPixbuf = null;
         this.defaultAppName = null;
 
@@ -328,10 +328,9 @@ const DocCommon = new Lang.Class({
             icon = Utils.iconFromRdfType(this.rdfType);
 
         let iconInfo =
-            Gtk.IconTheme.get_default().lookup_by_gicon_for_scale(icon, Utils.getIconSize(),
-                                                                  Application.application.getScaleFactor(),
-                                                                  Gtk.IconLookupFlags.FORCE_SIZE |
-                                                                  Gtk.IconLookupFlags.GENERIC_FALLBACK);
+            Gtk.IconTheme.get_default().lookup_by_gicon(icon, Utils.getIconSize(),
+                                                        Gtk.IconLookupFlags.FORCE_SIZE |
+                                                        Gtk.IconLookupFlags.GENERIC_FALLBACK);
 
         let pixbuf = null;
         if (iconInfo != null) {
@@ -442,9 +441,8 @@ const DocCommon = new Lang.Class({
             function(object, res) {
                 try {
                     let stream = object.read_finish(res);
-                    let scale = Application.application.getScaleFactor();
                     GdkPixbuf.Pixbuf.new_from_stream_at_scale_async(stream,
-                        Utils.getIconSize() * scale, Utils.getIconSize() * scale,
+                        Utils.getIconSize(), Utils.getIconSize(),
                         true, null, Lang.bind(this,
                             function(object, res) {
                                 try {
@@ -472,8 +470,7 @@ const DocCommon = new Lang.Class({
     },
 
     _createSymbolicEmblem: function(name) {
-        let pix = Gd.create_symbolic_icon(name, Utils.getIconSize() *
-                                          Application.application.getScaleFactor());
+        let pix = Gd.create_symbolic_icon(name, Utils.getIconSize());
 
         if (!pix)
             pix = new Gio.ThemedIcon({ name: name });
@@ -537,9 +534,7 @@ const DocCommon = new Lang.Class({
             thumbnailedPixbuf = emblemedPixbuf;
         }
 
-        this.surface = Gdk.cairo_surface_create_from_pixbuf(thumbnailedPixbuf,
-            Application.application.getScaleFactor(),
-            Application.application.getGdkWindow());
+        this.pixbuf = thumbnailedPixbuf;
 
         this.emit('info-updated');
     },
diff --git a/src/view.js b/src/view.js
index 3f40125..8eaa6de 100644
--- a/src/view.js
+++ b/src/view.js
@@ -19,9 +19,9 @@
  *
  */
 
-const Cairo = imports.gi.cairo;
 const Gd = imports.gi.Gd;
 const Gdk = imports.gi.Gdk;
+const GdkPixbuf = imports.gi.GdkPixbuf;
 const Gettext = imports.gettext;
 const GLib = imports.gi.GLib;
 const GObject = imports.gi.GObject;
@@ -114,7 +114,7 @@ const ViewModel = new Lang.Class({
               GObject.TYPE_STRING,
               GObject.TYPE_STRING,
               GObject.TYPE_STRING,
-              Cairo.Surface,
+              GdkPixbuf.Pixbuf,
               GObject.TYPE_LONG,
               GObject.TYPE_BOOLEAN,
               GObject.TYPE_UINT ]);
@@ -144,7 +144,7 @@ const ViewModel = new Lang.Class({
         this.model.set(iter,
             [ 0, 1, 2, 3, 4, 5 ],
             [ doc.id, doc.uri, doc.name,
-              doc.author, doc.surface, doc.mtime ]);
+              doc.author, doc.pixbuf, doc.mtime ]);
 
         let treePath = this.model.get_path(iter);
         let treeRowRef = Gtk.TreeRowReference.new(this.model, treePath);
@@ -160,7 +160,7 @@ const ViewModel = new Lang.Class({
                     this.model.set(objectIter,
                         [ 0, 1, 2, 3, 4, 5 ],
                         [ doc.id, doc.uri, doc.name,
-                          doc.author, doc.surface, doc.mtime ]);
+                          doc.author, doc.pixbuf, doc.mtime ]);
             }));
     },
 


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