[evince/wip/highlight: 14/16] pdf: implement render_annotation



commit 942e8919bc6201b5aa9adeee58ad3060c58c86e7
Author: José Aliste <jaliste src gnome org>
Date:   Sat Sep 6 10:46:37 2014 -0400

    pdf: implement render_annotation

 backend/pdf/ev-poppler.cc |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/backend/pdf/ev-poppler.cc b/backend/pdf/ev-poppler.cc
index e34808f..d2a6d43 100644
--- a/backend/pdf/ev-poppler.cc
+++ b/backend/pdf/ev-poppler.cc
@@ -3247,6 +3247,31 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
        pdf_document->annots_modified = TRUE;
 }
 
+static gboolean
+pdf_document_annotations_render_annotation (EvDocumentAnnotations *document_annotations,
+                                           EvAnnotation          *annot,
+                                           cairo_t               *cr)
+{
+       PopplerAnnot *poppler_annot;
+       GArray *quads;
+       EvPage *page;
+       PopplerPage *poppler_page;
+       gint i;
+
+       if (!EV_IS_ANNOTATION_TEXT_MARKUP (annot))
+               return FALSE;
+
+       poppler_annot = POPPLER_ANNOT (g_object_get_data (G_OBJECT (annot), "poppler-annot"));
+       if (!poppler_annot)
+               return FALSE;
+        page = ev_annotation_get_page (annot);
+                poppler_page = POPPLER_PAGE (page->backend_page);
+
+       poppler_page_render_annot (poppler_page, poppler_annot, cr);
+
+       return TRUE;
+}
+
 static void
 pdf_document_annotations_save_annotation (EvDocumentAnnotations *document_annotations,
                                          EvAnnotation          *annot,
@@ -3450,6 +3475,8 @@ pdf_document_document_annotations_iface_init (EvDocumentAnnotationsInterface *if
        iface->document_is_modified = pdf_document_annotations_document_is_modified;
        iface->add_annotation = pdf_document_annotations_add_annotation;
        iface->save_annotation = pdf_document_annotations_save_annotation;
+        iface->render_annotation = pdf_document_annotations_render_annotation;
+
        iface->remove_annotation = pdf_document_annotations_remove_annotation;
        iface->is_xy_in_annotation = pdf_document_annotations_is_xy_in_annotation;
 }


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