[cairo] create_surface_for_cg_context behavior in Cairo 1.9 vs. 1.12

Andrea Canciani ranma42 at gmail.com
Sat Jun 2 03:54:54 PDT 2012


On Fri, Jun 1, 2012 at 4:15 PM, cu <cairouser at yahoo.com> wrote:
> Found a difference of behavior between Cairo Quartz in 1.9.8 and 1.12.x
> versions of Cairo (which resulted in a bug in our application). Some
> guidance would be appreciated.
>
> We create surface  with "surface_for_cg_context" where cg context is
> that of a view on iPhone screen. For "retina" displays, with cairo 1.9.8
> surface is created sized in "points" with 2.0 scale transform (which is
> our desired behavior - to match the view of non-retina devices). With
> cairo 1.12 surface is created without the transform (i.e. sized in
> "retina" pixels). In our case that results in scaled down image covering
> top left quarter of the view.
>
> What is the reason for this discrepancy? What should be the correct
> behavior and how do we handle it?

Quite a lot of changes happened between 1.12 and 1.9.8.
Could you provide a small testcase to help keeping track of this
behavior (and to bisect the change).

The API reference says:
"The CGContext is assumed to be in the standard Cairo coordinate space
(that is, with the origin at the upper left and the Y axis increasing
downward). If the CGContext is in the Quartz coordinate space (with
the origin at the bottom left), then it should be flipped before this
function is called."
so I would expect cairo-quartz to respect the original transform
(although I guess bad things might happen if there are fallbacks
and/or the surface is used as a source).

>
> Thank you!


More information about the cairo mailing list