250
250
EvJobRender *job_render = EV_JOB_RENDER (job);
252
252
/* If the job is outside of our interest, we silently discard it */
253
if ((job_render->rc->page < (pixbuf_cache->start_page - pixbuf_cache->preload_cache_size)) ||
254
(job_render->rc->page > (pixbuf_cache->end_page + pixbuf_cache->preload_cache_size))) {
253
if ((job_render->page < (pixbuf_cache->start_page - pixbuf_cache->preload_cache_size)) ||
254
(job_render->page > (pixbuf_cache->end_page + pixbuf_cache->preload_cache_size))) {
255
255
g_object_unref (job);
259
job_info = find_job_cache (pixbuf_cache, job_render->rc->page);
259
job_info = find_job_cache (pixbuf_cache, job_render->page);
261
261
copy_job_page_and_selection_to_job_info (job_render, job_info, pixbuf_cache);
262
262
g_signal_emit (pixbuf_cache, signals[JOB_FINISHED], 0, job_info->region);
270
270
EvJobRender *job_render = EV_JOB_RENDER (job);
272
272
/* If the job is outside of our interest, we silently discard it */
273
if ((job_render->rc->page < (pixbuf_cache->start_page - pixbuf_cache->preload_cache_size)) ||
274
(job_render->rc->page > (pixbuf_cache->end_page + pixbuf_cache->preload_cache_size))) {
273
if ((job_render->page < (pixbuf_cache->start_page - pixbuf_cache->preload_cache_size)) ||
274
(job_render->page > (pixbuf_cache->end_page + pixbuf_cache->preload_cache_size))) {
275
275
g_object_unref (job);
279
job_info = find_job_cache (pixbuf_cache, job_render->rc->page);
279
job_info = find_job_cache (pixbuf_cache, job_render->page);
280
280
copy_job_to_job_info (job_render, job_info, pixbuf_cache);
421
421
move_one_job (pixbuf_cache->job_list + i,
422
422
pixbuf_cache, page,
423
423
new_job_list, new_prev_job, new_next_job,
424
start_page, end_page, EV_JOB_PRIORITY_HIGH);
424
start_page, end_page, EV_JOB_PRIORITY_URGENT);
454
454
CacheJobInfo *job_info,
455
455
EvPixbufCache *pixbuf_cache)
457
if (job_info->rc == NULL) {
458
job_info->rc = ev_render_context_new (job_render->ev_page,
459
job_render->rotation,
462
ev_render_context_set_page (job_info->rc, job_render->ev_page);
463
ev_render_context_set_rotation (job_info->rc, job_render->rotation);
464
ev_render_context_set_scale (job_info->rc, job_render->scale);
457
467
if (job_info->surface) {
458
468
cairo_surface_destroy (job_info->surface);
460
470
job_info->surface = cairo_surface_reference (job_render->surface);
463
g_object_unref (G_OBJECT (job_info->rc));
465
job_info->rc = g_object_ref (job_render->rc);
467
472
job_info->points_set = FALSE;
468
if (job_render->include_selection) {
473
if (job_render->flags & EV_RENDER_INCLUDE_SELECTION) {
469
474
if (job_info->selection) {
470
475
cairo_surface_destroy (job_info->selection);
471
476
job_info->selection = NULL;
496
501
CacheJobInfo *job_info,
497
502
EvPixbufCache *pixbuf_cache)
499
if (job_render->include_links) {
504
if (!job_info->page_ready) {
505
g_signal_emit (pixbuf_cache, signals[JOB_FINISHED], 0, job_info->region);
506
copy_job_page_and_selection_to_job_info (job_render,
511
if (job_render->flags & EV_RENDER_INCLUDE_LINKS) {
500
512
if (job_info->link_mapping)
501
513
ev_link_mapping_free (job_info->link_mapping);
502
514
job_info->link_mapping = job_render->link_mapping;
505
if (job_render->include_images) {
517
if (job_render->flags & EV_RENDER_INCLUDE_IMAGES) {
506
518
if (job_info->image_mapping)
507
519
ev_image_mapping_free (job_info->image_mapping);
508
520
job_info->image_mapping = job_render->image_mapping;
511
if (job_render->include_forms) {
523
if (job_render->flags & EV_RENDER_INCLUDE_FORMS) {
512
524
if (job_info->form_field_mapping)
513
525
ev_form_field_mapping_free (job_info->form_field_mapping);
514
526
job_info->form_field_mapping = job_render->form_field_mapping;
517
if (job_render->include_text) {
529
if (job_render->flags & EV_RENDER_INCLUDE_TEXT) {
518
530
if (job_info->text_mapping)
519
531
gdk_region_destroy (job_info->text_mapping);
520
532
job_info->text_mapping = job_render->text_mapping;
609
621
EvJobPriority priority)
611
gboolean include_links = FALSE;
612
gboolean include_text = FALSE;
613
gboolean include_selection = FALSE;
614
gboolean include_images = FALSE;
615
gboolean include_forms = FALSE;
616
GdkColor *text, *base;
623
EvRenderFlags flags = 0;
618
625
job_info->page_ready = FALSE;
620
if (job_info->rc == NULL) {
621
job_info->rc = ev_render_context_new (rotation, page, scale);
623
ev_render_context_set_rotation (job_info->rc, rotation);
624
ev_render_context_set_page (job_info->rc, page);
625
ev_render_context_set_scale (job_info->rc, scale);
628
627
if (job_info->region)
629
628
gdk_region_destroy (job_info->region);
630
629
job_info->region = region ? gdk_region_copy (region) : NULL;
632
631
/* Figure out what else we need for this job */
633
632
if (job_info->link_mapping == NULL)
634
include_links = TRUE;
633
flags |= EV_RENDER_INCLUDE_LINKS;
635
634
if (job_info->image_mapping == NULL)
636
include_images = TRUE;
635
flags |= EV_RENDER_INCLUDE_IMAGES;
637
636
if (job_info->form_field_mapping == NULL)
638
include_forms = TRUE;
637
flags |= EV_RENDER_INCLUDE_FORMS;
639
638
if (job_info->text_mapping == NULL)
641
if (new_selection_surface_needed (pixbuf_cache, job_info, page, scale)) {
642
include_selection = TRUE;
645
gtk_widget_ensure_style (pixbuf_cache->view);
647
get_selection_colors (pixbuf_cache->view, &text, &base);
639
flags |= EV_RENDER_INCLUDE_TEXT;
649
641
job_info->job = ev_job_render_new (pixbuf_cache->document,
642
page, rotation, scale,
652
&(job_info->target_points),
653
job_info->selection_style,
660
ev_job_queue_add_job (job_info->job, priority);
646
if (new_selection_surface_needed (pixbuf_cache, job_info, page, scale)) {
647
GdkColor *text, *base;
649
gtk_widget_ensure_style (pixbuf_cache->view);
650
get_selection_colors (pixbuf_cache->view, &text, &base);
651
ev_job_render_set_selection_info (EV_JOB_RENDER (job_info->job),
652
&(job_info->target_points),
653
job_info->selection_style,
661
657
g_signal_connect (G_OBJECT (job_info->job), "page-ready",
662
658
G_CALLBACK (job_page_ready_cb),
664
660
g_signal_connect (G_OBJECT (job_info->job), "finished",
665
661
G_CALLBACK (job_finished_cb),
663
ev_job_scheduler_push_job (job_info->job, priority);
995
992
/* If we have a running job, we just return what we have under the
996
993
* assumption that it'll be updated later and we can scale it as need
998
if (job_info->job && EV_JOB_RENDER (job_info->job)->include_selection)
995
if (job_info->job && (EV_JOB_RENDER (job_info->job)->flags & EV_RENDER_INCLUDE_SELECTION))
999
996
return job_info->selection;
1001
998
/* Now, lets see if we need to resize the image. If we do, we clear the