[niepce] Remove once again traces of Gegl from image.hpp.



commit d9947899353798d6a233bf9ec2df7cbadadd9bff
Author: Hubert Figuière <hub figuiere net>
Date:   Sat Jun 29 21:31:37 2013 -0400

    Remove once again traces of Gegl from image.hpp.

 src/ncr/image.cpp |   75 ++++++++++++++++++++++++++++++----------------------
 src/ncr/image.hpp |   10 -------
 2 files changed, 43 insertions(+), 42 deletions(-)
---
diff --git a/src/ncr/image.cpp b/src/ncr/image.cpp
index 1669619..09d15ec 100644
--- a/src/ncr/image.cpp
+++ b/src/ncr/image.cpp
@@ -33,8 +33,9 @@ extern "C" {
 namespace ncr {
 
 struct Image::Private {
-    Private()
-        : m_status(Image::STATUS_UNSET)
+    Private(Image& self)
+        : m_self(self)
+        , m_status(Image::STATUS_UNSET)
         , m_width(0)
         , m_height(0)
         , m_orientation(0), m_vertical(false)
@@ -55,6 +56,16 @@ struct Image::Private {
             }
         }
 
+    /** Call this to initialise the reload process */
+    void prepare_reload();
+
+    /** continue the reload
+     * @param node the node for the loaded image
+     * @param orientation the exif orientation.
+     */
+    void reload_node(GeglNode* node, int orientation);
+
+    Image& m_self;
     Image::status_t m_status;
     int m_width, m_height; /**< the native dimension, with orientation */
     int m_orientation;     /**< EXIF orientation in degrees */
@@ -78,7 +89,7 @@ struct Image::Private {
 };
 
 Image::Image()
-    : priv(new Private)
+    : priv(new Private(*this))
 {
 }
 
@@ -200,33 +211,33 @@ GeglNode* Image::Private::_scale_node()
 }
 
 
-void Image::prepare_reload()
+void Image::Private::prepare_reload()
 {
-    priv->m_status = STATUS_LOADING;
-    priv->m_pixbuf_cache.reset();
+    m_status = STATUS_LOADING;
+    m_pixbuf_cache.reset();
 
-    if(priv->m_graph) {
-        g_object_unref(priv->m_graph);
+    if(m_graph) {
+        g_object_unref(m_graph);
     }
-    priv->m_graph = gegl_node_new();
-//    priv->m_graph->set("format", babl_format("RGB u16"));
+    m_graph = gegl_node_new();
+//    m_graph->set("format", babl_format("RGB u16"));
 }
 
 void Image::reload(const Glib::RefPtr<Gdk::Pixbuf> & p)
 {
-    prepare_reload();
+    priv->prepare_reload();
     priv->m_pixbuf_cache = p;
     GeglNode* load_file = gegl_node_new_child(priv->m_graph,
                                               "operation", "gegl:pixbuf",
                                               "pixbuf", p->gobj(), nullptr);
 
-    reload_node(load_file, 0);
+    priv->reload_node(load_file, 0);
 }
 
 void Image::reload(const std::string & p, bool is_raw,
     int orientation)
 {
-    prepare_reload();
+    priv->prepare_reload();
 
     GeglNode* load_file;
 
@@ -240,26 +251,26 @@ void Image::reload(const std::string & p, bool is_raw,
     else {
         load_file = priv->_load_dcraw(p);
     }
-    reload_node(load_file, orientation);
+    priv->reload_node(load_file, orientation);
 }
 
-void Image::reload_node(GeglNode* node, int orientation)
+void Image::Private::reload_node(GeglNode* node, int orientation)
 {
-    DBG_ASSERT(priv->m_status == STATUS_LOADING, "prepare_reload() might not have been called");
+    DBG_ASSERT(m_status == STATUS_LOADING, "prepare_reload() might not have been called");
 
-    priv->m_rotate_n = priv->_rotate_node(orientation);
-    priv->m_scale = priv->_scale_node();
-    priv->m_sink = gegl_node_create_child (priv->m_graph, "gegl:display");
+    m_rotate_n = _rotate_node(orientation);
+    m_scale = _scale_node();
+    m_sink = gegl_node_create_child (m_graph, "gegl:display");
 
-//        gegl_node_new_child(priv->m_graph,
+//        gegl_node_new_child(m_graph,
 //                            "operation", "gegl:buffer-sink",
 //                            "format", babl_format("RGB u8"),
-//                            "buffer", &(priv->m_sink_buffer), nullptr);
+//                            "buffer", &(m_sink_buffer), nullptr);
 
-    gegl_node_link_many(node, priv->m_rotate_n,
-                        priv->m_scale, priv->m_sink, nullptr);
+    gegl_node_link_many(node, m_rotate_n,
+                        m_scale, m_sink, nullptr);
 
-//    gegl_node_process(priv->m_sink);
+//    gegl_node_process(m_sink);
     // DEBUG
 #if 0
     GeglNode* debugsink;
@@ -268,7 +279,7 @@ void Image::reload_node(GeglNode* node, int orientation)
                                          "path", "/tmp/gegl.png", nullptr,
                                          gegl_node ("gegl:buffer-source",
                                                     "buffer",
-                                                    priv->m_sink_buffer,
+                                                    m_sink_buffer,
                                                     nullptr)
                         )
             );
@@ -283,18 +294,18 @@ void Image::reload_node(GeglNode* node, int orientation)
     height = rect.height;
     DBG_OUT("width %d height %d", width, height);
     if(!width || !height) {
-        priv->m_status = STATUS_ERROR;
+        m_status = STATUS_ERROR;
     }
-    if(priv->m_vertical) {
-        priv->m_width = height;
-        priv->m_height = width;
+    if(m_vertical) {
+        m_width = height;
+        m_height = width;
     }
     else {
-        priv->m_width = width;
-        priv->m_height = height;
+        m_width = width;
+        m_height = height;
     }
 
-    signal_update();
+    m_self.signal_update();
 }
 
 void Image::set_output_scale(double scale)
diff --git a/src/ncr/image.hpp b/src/ncr/image.hpp
index 5242fd3..92ee8d3 100644
--- a/src/ncr/image.hpp
+++ b/src/ncr/image.hpp
@@ -27,8 +27,6 @@
 
 #include <gdkmm/pixbuf.h>
 
-typedef struct _GeglNode  GeglNode;
-
 namespace ncr {
 
 class Image
@@ -89,14 +87,6 @@ public:
     sigc::signal<void> signal_update;
 private:
 
-    /** Call this to initialise the reload process */
-    void prepare_reload();
-    /** continue the reload
-     * @param node the node for the loaded image
-     * @param orientation the exif orientation.
-     */
-    void reload_node(GeglNode* node, int orientation);
-
     /** rotate by x degrees (orientation)
      *  ensure the end results is within 0..359.
      */


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