Changeset 55
- Timestamp:
- 02/03/09 09:22:18 (3 years ago)
- Location:
- branches/clutter-experiments
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
branches/clutter-experiments/main.cc
r54 r55 66 66 ClutterColor stage_color; 67 67 the_stage_m = clutter_stage_get_default(); 68 clutter_actor_set_size(the_stage_m, 1024, 768); 68 69 clutter_color_parse("Black", &stage_color); 69 70 clutter_stage_set_color(CLUTTER_STAGE(the_stage_m), &stage_color); … … 80 81 if(active_document == NULL) 81 82 { 82 g_print(_("PDF file %s cannot be opened, check it exists, permissions" 83 g_print(_("PDF file %s cannot be opened," 84 " check that it exists, permissions" 83 85 " and that is \nnot encrypted.\n"), filename_m); 84 86 return false; … … 99 101 clutter_text_new_full("Mono 36", "0%", &label_color); 100 102 guint screen_w, screen_h; 101 clutter_actor_get_size(CLUTTER_ACTOR(the_stage_m), &screen_w, &screen_h); 102 clutter_actor_set_position(progress_label_m, screen_w>>1, screen_h>>1); 103 clutter_actor_get_size(CLUTTER_ACTOR(the_stage_m), 104 &screen_w, &screen_h); 105 clutter_actor_set_position(progress_label_m, 106 screen_w>>1, screen_h>>1); 103 107 clutter_actor_set_anchor_point_from_gravity(progress_label_m, 104 108 CLUTTER_GRAVITY_CENTER); … … 107 111 clutter_actor_show(the_stage_m); 108 112 g_thread_create(render_thread, this, FALSE, NULL); 109 113 110 114 clutter_threads_enter(); 111 115 clutter_main(); … … 152 156 GdkPixbuf* buffer = me->the_doc_m->page(0).pixbuf(pdfcube::page::HI_RES); 153 157 me->current_page_m = clutter_texture_new(); 158 clutter_texture_set_filter_quality 159 (CLUTTER_TEXTURE(me->current_page_m), 160 CLUTTER_TEXTURE_QUALITY_HIGH); 154 161 clutter_texture_set_from_rgb_data 155 162 (CLUTTER_TEXTURE(me->current_page_m), … … 161 168 4, (ClutterTextureFlags)0, 162 169 &error); 170 163 171 guint screen_w, screen_h; 164 172 clutter_actor_get_size(CLUTTER_ACTOR(me->the_stage_m), 165 173 &screen_w, &screen_h); 166 clutter_actor_set_size(me->current_page_m, screen_w, screen_h); 174 175 176 // Check if our slot ratio is less or more than owr own 177 double aspect = me->the_doc_m->page(0).aspect_ratio(); 178 179 double w = 0.0, h = 0.0; 180 if(screen_h > screen_w/aspect) 181 { 182 w = screen_w; 183 h = w/aspect; 184 } 185 else 186 { 187 h = screen_h; 188 w = h*aspect; 189 } 190 191 clutter_actor_set_size(me->current_page_m, w, h); 167 192 clutter_group_add_many(CLUTTER_GROUP(me->the_stage_m), 168 193 me->current_page_m, NULL); -
branches/clutter-experiments/page.hh
r52 r55 1 1 // TODO: move implementation in .cc file 2 2 // TODO: refine api, it's somewhat ugly right now 3 // TODO: should render in a thread?3 // TODO: should we render in a thread? 4 4 #ifndef __PDFCUBE__PAGE_HH__ 5 5 #define __PDFCUBE__PAGE_HH__ … … 7 7 #include <glib.h> 8 8 #include <poppler.h> 9 //#include <clutter/clutter.h>10 9 #include <gdk-pixbuf/gdk-pixbuf.h> 11 10 … … 18 17 * 19 18 * This class is used to render low and hi res version of a 20 * PopplerPage as a ClutterActor.19 * PopplerPage as GdkPixbufs 21 20 * 22 * Usually on startall the pages will be rendered in a low res21 * Usually, on start, all the pages will be rendered in a low res 23 22 * version, while higher res versions will be rendered on demand by 24 23 * the animations. We need to program the animations in advance so … … 65 64 66 65 /** 67 * @brief Renders the PopplerPage on the desired actor.66 * @brief Renders the PopplerPage on the desired pixbuf. 68 67 */ 69 68 void … … 91 90 } 92 91 93 // GdkPixbuf* low_res_m = NULL;94 92 if(!low_res_m) 95 93 low_res_m = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, w, h); … … 107 105 { 108 106 int w, h; 109 // we assume 4/3 aspect monitor can dobetter107 // we assume 4/3 aspect monitor can be done better 110 108 double box_w = 1600; 111 109 double box_h = 1200; … … 132 130 0, 133 131 hi_res_m); 134 GError* error = 0;135 136 /*137 if(!hi_res_m) hi_res_m = clutter_texture_new();138 clutter_texture_set_from_rgb_data139 (CLUTTER_TEXTURE(hi_res_m),140 gdk_pixbuf_get_pixels(buffer),141 gdk_pixbuf_get_has_alpha(buffer),142 gdk_pixbuf_get_width(buffer),143 gdk_pixbuf_get_height(buffer),144 gdk_pixbuf_get_rowstride(buffer),145 4, (ClutterTextureFlags)0,146 &error);147 g_object_unref(buffer);148 */149 132 break; 150 133 }

