Show
Ignore:
Timestamp:
02/01/09 22:06:39 (3 years ago)
Author:
mirko
Message:

Added a check target in the makefile to allow emacs flymake-mode.

Started the app class. It now loads the pdf and renders all pages in
low resolution while displaying a progress indicator.

There is little more to do to reach an usable stage. The bigger step
is to link the app class to the animator interface (and to implement
a couple of animators).

The pdfcube::page class now simply renders pages to GdkPixbuf?
removing the dependency from Clutter in the page class.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/clutter-experiments/page.hh

    r50 r52  
    77#include <glib.h> 
    88#include <poppler.h> 
    9 #include <clutter/clutter.h> 
     9//#include <clutter/clutter.h> 
    1010#include <gdk-pixbuf/gdk-pixbuf.h> 
    1111 
     
    9191              } 
    9292 
    93             GdkPixbuf* buffer = NULL; 
    94             buffer = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); 
     93            // GdkPixbuf* low_res_m = NULL; 
     94            if(!low_res_m) 
     95              low_res_m = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); 
    9596            poppler_page_render_to_pixbuf(poppler_page_m,  
    9697                                          0, 
     
    100101                                          ((double)h)/size().second,  
    101102                                          0,  
    102                                           buffer); 
    103             GError* error; 
    104             if(!low_res_m) low_res_m = clutter_texture_new(); 
    105             clutter_texture_set_from_rgb_data  
    106                (CLUTTER_TEXTURE(low_res_m), 
    107                 gdk_pixbuf_get_pixels(buffer), 
    108                 gdk_pixbuf_get_has_alpha(buffer), 
    109                 gdk_pixbuf_get_width(buffer), 
    110                 gdk_pixbuf_get_height(buffer), 
    111                 gdk_pixbuf_get_rowstride(buffer), 
    112                 4, (ClutterTextureFlags)0, 
    113                 &error); 
    114             g_object_unref(buffer); 
     103                                          low_res_m); 
    115104            break; 
    116105          } 
     
    133122                w = h*aspect; 
    134123              } 
    135             GdkPixbuf* buffer = NULL; 
    136             buffer = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); 
     124            if(!hi_res_m) 
     125              hi_res_m = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); 
    137126            poppler_page_render_to_pixbuf(poppler_page_m,  
    138127                                          0, 
     
    142131                                          ((double)h)/size().second,  
    143132                                          0,  
    144                                           buffer); 
    145             GError* error; 
     133                                          hi_res_m); 
     134            GError* error = 0; 
     135             
     136            /* 
    146137            if(!hi_res_m) hi_res_m = clutter_texture_new(); 
    147138            clutter_texture_set_from_rgb_data  
     
    155146                &error); 
    156147            g_object_unref(buffer); 
     148            */ 
    157149            break; 
    158150          } 
     
    198190     * @brief Returns the desired actor (on NULL if not present). 
    199191     */ 
    200     ClutterActor*  
    201     actor(rendering_mode mode) 
     192    GdkPixbuf*  
     193    pixbuf(rendering_mode mode) 
    202194    { 
    203195      switch(mode) 
     
    210202      return NULL; 
    211203    } 
    212  
     204     
    213205  protected: 
    214206 
     
    227219 
    228220    PopplerPage* poppler_page_m; 
    229     ClutterActor* low_res_m; 
    230     ClutterActor* hi_res_m; 
     221    GdkPixbuf* low_res_m; 
     222    GdkPixbuf* hi_res_m; 
    231223  }; 
    232224