[poppler] 2 commits - poppler/Annot.cc poppler/Annot.h
Carlos Garcia Campos
carlosgc at kemper.freedesktop.org
Sat Dec 5 01:18:25 PST 2009
poppler/Annot.cc | 31 +++++++++++++++----------------
poppler/Annot.h | 1 +
2 files changed, 16 insertions(+), 16 deletions(-)
New commits:
commit 32103f45d0193b31e95269ea9123b8011d93e994
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sat Dec 5 10:14:18 2009 +0100
[annots] Add isVisible() to check whether annot is visible before drawing it
It takes into account annot flags and optional content.
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 20c8209..fb65ea6 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1262,22 +1262,29 @@ void Annot::drawCircleBottomRight(double cx, double cy, double r) {
appearBuf->append("S\n");
}
-void Annot::draw(Gfx *gfx, GBool printing) {
- Object obj;
-
+GBool Annot::isVisible(GBool printing) {
// check the flags
if ((flags & flagHidden) ||
(printing && !(flags & flagPrint)) ||
(!printing && (flags & flagNoView))) {
- return;
+ return gFalse;
}
// check the OC
if (optContentConfig && oc.isRef()) {
if (! optContentConfig->optContentIsVisible(&oc))
- return;
+ return gFalse;
}
+ return gTrue;
+}
+
+void Annot::draw(Gfx *gfx, GBool printing) {
+ Object obj;
+
+ if (!isVisible (printing))
+ return;
+
// draw the appearance stream
appearance.fetch(xref, &obj);
gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
@@ -1691,12 +1698,8 @@ void AnnotLink::initialize(XRef *xrefA, Catalog *catalog, Dict *dict) {
void AnnotLink::draw(Gfx *gfx, GBool printing) {
Object obj;
- // check the flags
- if ((flags & flagHidden) ||
- (printing && !(flags & flagPrint)) ||
- (!printing && (flags & flagNoView))) {
+ if (!isVisible (printing))
return;
- }
// draw the appearance stream
appearance.fetch(xref, &obj);
@@ -3416,12 +3419,8 @@ void AnnotWidget::generateFieldAppearance() {
void AnnotWidget::draw(Gfx *gfx, GBool printing) {
Object obj;
- // check the flags
- if ((flags & flagHidden) ||
- (printing && !(flags & flagPrint)) ||
- (!printing && (flags & flagNoView))) {
+ if (!isVisible (printing))
return;
- }
addDingbatsResource = gFalse;
generateFieldAppearance ();
diff --git a/poppler/Annot.h b/poppler/Annot.h
index b83c1db..cb0bc96 100644
--- a/poppler/Annot.h
+++ b/poppler/Annot.h
@@ -538,6 +538,7 @@ protected:
void drawCircle(double cx, double cy, double r, GBool fill);
void drawCircleTopLeft(double cx, double cy, double r);
void drawCircleBottomRight(double cx, double cy, double r);
+ GBool isVisible(GBool printing);
// Updates the field key of the annotation dictionary
// and sets M to the current time
commit c14dfc7102341f5e1ed67a05c0738d55befab1ec
Author: Carlos Garcia Campos <carlosgc at gnome.org>
Date: Sat Dec 5 10:07:46 2009 +0100
[annots] Do not check if annot is a link in Annot::draw()
AnnotLink already implements draw()
diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index 478ed21..20c8209 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1280,7 +1280,7 @@ void Annot::draw(Gfx *gfx, GBool printing) {
// draw the appearance stream
appearance.fetch(xref, &obj);
- gfx->drawAnnot(&obj, (type == typeLink) ? border : (AnnotBorder *)NULL, color,
+ gfx->drawAnnot(&obj, (AnnotBorder *)NULL, color,
rect->x1, rect->y1, rect->x2, rect->y2);
obj.free();
}
More information about the poppler
mailing list