Bug 92040 - [RFC PATCH] Complete support for transition effect durations (they can be fractional)
Summary: [RFC PATCH] Complete support for transition effect durations (they can be fra...
Status: RESOLVED FIXED
Alias: None
Product: poppler
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: Other All
: medium enhancement
Assignee: poppler-bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-18 12:47 UTC by Arseniy Lartsev
Modified: 2015-12-02 16:01 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
The patch in question (3.84 KB, text/plain)
2015-09-18 12:47 UTC, Arseniy Lartsev
Details
The patch (12.96 KB, patch)
2015-09-19 17:24 UTC, Arseniy Lartsev
Details | Splinter Review
Non-integer transition durations for poppler-glib (841 bytes, patch)
2015-12-02 13:58 UTC, Arseniy Lartsev
Details | Splinter Review

Description Arseniy Lartsev 2015-09-18 12:47:52 UTC
Created attachment 118344 [details]
The patch in question

According to PDF format reference (http://partners.adobe.com/public/developer/en/pdf/PDFReference.pdf) and the behaviour of other software such as Adobe reader, the type of "D" (duration) property of the transition effect is "number" rather than "integer", which means it can also be real. Right now, poppler always interprets non-integer durations as 1 second, so short (< 1s) transitions become impossible, for example.

I'd like to suggest a patch which fixes that, while preserving binary compatibility as much as possible (changes to the glib wrapper aren't included here).

Is this a right way to go, or should I just forget about binary compatibility (source code compatibility will be preserved anyway)?
Comment 1 Albert Astals Cid 2015-09-19 14:54:18 UTC
We do not care for binary compatibility on the poppler/ level, only in the frontends.

Please also mark in int variants in the qt frontends as deprecated.

And float duration; should be a double?
Comment 2 Arseniy Lartsev 2015-09-19 17:24:09 UTC
Created attachment 118362 [details] [review]
The patch

(In reply to Albert Astals Cid from comment #1)
> Please also mark in int variants in the qt frontends as deprecated.
Done.

> And float duration; should be a double?
I only wrote float due to having binary compatibility in mind (same size as int, so the structure size doesn't change). Now that it doesn't matter, I've changed to double.

What do you make of the modifications to the glib frontend, where the binary compatibility can only be preserved by replicating the whole class?
Comment 3 Albert Astals Cid 2015-09-20 16:35:40 UTC
I've pushed the core and Qt parts, someone with knowledge of the glib side needs to think if your patch is good or not.
Comment 4 Arseniy Lartsev 2015-09-20 18:00:30 UTC
(In reply to Albert Astals Cid from comment #3)
> I've pushed the core and Qt parts, someone with knowledge of the glib side
> needs to think if your patch is good or not.

Thank you! Sorry for missing that Q_DECL_DEPRECATED. A patch for okular is coming :)
Comment 5 Carlos Garcia Campos 2015-12-02 10:18:29 UTC
Comment on attachment 118362 [details] [review]
The patch

Review of attachment 118362 [details] [review]:
-----------------------------------------------------------------

::: glib/poppler-page.h
@@ +341,5 @@
> +  gdouble duration;
> +  gint angle;
> +  gdouble scale;
> +  gboolean rectangular;
> +};

Thanks for the patch. What does Ex stand for? I don't think we need a new boxed type for this. I think that as long as we don't change the order of the struct members, we can append a new one without breaking api/abi. So, I would just add gdouble duration_float to the existing struct.
Comment 6 Arseniy Lartsev 2015-12-02 13:58:06 UTC
Created attachment 120275 [details] [review]
Non-integer transition durations for poppler-glib

(In reply to Carlos Garcia Campos from comment #5)

> Thanks for the patch. What does Ex stand for? I don't think we need a new
> boxed type for this. I think that as long as we don't change the order of
> the struct members, we can append a new one without breaking api/abi. So, I
> would just add gdouble duration_float to the existing struct.

Right, people are not supposed to create instances of the structure by direct malloc, are they. This is what happens when a KDE user starts hacking on GObject stuff :) Here's a new patch (I called in duration_real to be consistent with the already existing counterpart in the Qt wrapper, and also because "float" might be confusing whet the type is double).
Comment 7 Carlos Garcia Campos 2015-12-02 15:42:28 UTC
(In reply to Arseniy Lartsev from comment #6)
> Created attachment 120275 [details] [review] [review]
> Non-integer transition durations for poppler-glib
> 
> (In reply to Carlos Garcia Campos from comment #5)
> 
> > Thanks for the patch. What does Ex stand for? I don't think we need a new
> > boxed type for this. I think that as long as we don't change the order of
> > the struct members, we can append a new one without breaking api/abi. So, I
> > would just add gdouble duration_float to the existing struct.
> 
> Right, people are not supposed to create instances of the structure by
> direct malloc, are they.

Right, those are always allocated by poppler. It's unfortunate that those struct are public, but still.

> This is what happens when a KDE user starts hacking
> on GObject stuff :) 

:-)

> Here's a new patch (I called in duration_real to be
> consistent with the already existing counterpart in the Qt wrapper, and also
> because "float" might be confusing whet the type is double).

OK, sounds good to me. Thanks.
Comment 8 Carlos Garcia Campos 2015-12-02 16:01:04 UTC
Pushed, thanks!


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.