[poppler] Optional Content improvements and glib support (second try)

Albert Astals Cid aacid at kde.org
Mon Nov 3 12:01:31 PST 2008


A Dilluns 03 Novembre 2008, Carlos Garcia Campos va escriure:
> El dom, 02-11-2008 a las 20:18 +0100, Albert Astals Cid escribió:
> > A Diumenge 26 Octubre 2008, Carlos Garcia Campos va escriure:
> > > I've finally decided to add optional content support to the glib
> > > bindings. Some of the issues I reported the first time I looked at OC
> > > code are still there so here is a set of patches:
> > >
> > > 0001-Delete-the-optContent-object-if-it-s-invalid.patch
> > >
> > > This just adds a typical isOk() method to OCGs class so that the object
> > > can be removed from memory when it's not valid
> >
> > As far as i understand this is a memory optimization that does not need
> > to go to stable, right?
>
> yes
>
> > > 0002-Minor-code-cleanup-and-consistency-issues.patch
> > >
> > > This patch was already approved by Brad indeed
> > >  - Ref() -> getRef()
> > >  - State() -> getState()
> > >  - Name() -> getName()
> > > quite trivial. It contains also the changes needed for the qt4
> > > frontend, but I don't have Qt installed so it's untested.
> > >
> > > 0004-Do-not-show-hidden-optional-content.patch
> > >
> > > Right now, optional content only works for XObjects. This patch add
> > > support for any drawing operation, using a stack for the markedContent.
> >
> > Just wondering if we could optimize things a bit more, i mean, for
> > example in Gfx::doAxialShFill if we are not going to draw could we just
> > return at the very beginning of the function?
>
> The thing is that the spec says that any other operation except drawing
> should still happens. Well, let me quote:
>
> "Graphics state operations, such as setting the color, transformation
> matrix, and clipping, are still applied. In addition, graphics state side
> effects that arise from drawing operators are applied; in particular, the
> current text position is updat- ed even for text wrapped in optional
> content. In other words, graphics state pa- rameters that persist past the
> end of a marked-content section must be the same whether the optional
> content is visible or not. For example, hiding a sec- tion of optional
> content does not change the color of objects that do not belong to the same
> optional content group."

Ok, pefect then :-)

>
> > More important: In broken documents with more opEndMarkedContent than
> > opBeginMarkedContent the code will crash and in broken documents with
> > less opEndMarkedContent than opBeginMarkedContent the code will leak
> > memory. Could you fix that?
>
> do you have any broken documents to reproduce the problems?

Not really, but i think the solution is pretty easy, just check the stack is 
not empty before opEndMarkedContent and on the destructor of Gfx if the stack 
is not empty clean it up.

Albert

>
> > Nitpicks: GBool contentIsHidden (void); is too C-ish in C++ you don't use
> > (void) for functions without parameters, please move to GBool
> > contentIsHidden(); (we don't put a space between function name and (
> > either)
>
> Ok
>
> > > 0005-Check-annotation-optional-content-properties-before.patch
> > >
> > > This one adds support also for annotations
> > >
> > > 0006-Fix-memory-leaks-in-OptionalContent.patch
> > >
> > > Two memory leaks I reported and I had forgotten.
> >
> > This one should be put on stable too, right?
>
> yes
>
> > Albert
> >
> > > 0003--glib-Show-action-titles-when-printing-the-index-in.patch
> > > 0007--glib-Add-Optional-Content-support.patch
> > > 0008--glib-demo-Add-Optional-Content-demo.patch
> > >
> > > These are glib only.




More information about the poppler mailing list