[cairo] GSoC: Scan converting rasteriser update

Behdad Esfahbod behdad at behdad.org
Mon Oct 6 08:40:45 PDT 2008


Carl Worth wrote:
> On Wed, 2008-10-01 at 15:19 -0400, Jeff Muizelaar wrote:
>> Overall comments:
>> - I don't really like the make_span_renderer interface. It might be better if
>>   instead of relying on the fallback surface, we had helpers that would be called from
>>   the image surface's fill and stroke methods.
> 
> Agreed.
> 
> This approach is a general one that could be applied liberally to
> cairo's code base to clean it up considerably. That is, it would be nice
> to have explicit code in each backend for each interface, calling into
> specific helper functions, rather than just returning UNSUPPORTED and
> relying on the fallback code to do something, (which might not be
> optimal across all backends). And even if the fallback code doesn't
> perform poorly, it makes the code much harder to read.

Actually I don't agree.  Having to make a call instead of just returning
UNSUPPORTED is going to make the code for backends considerably uglier.  Right
now one does ot even need to implement many of the methods.  Without
UNSUPPORTED one has to copy paste a lot of cruft, that need to be changed in
10 places everytime the fallback implementation details change.

I think the idiom is very readable and useful when you grasp it:  a function
returning cairo_int_status_t can return UNSUPPORTED and not worry about what
happens, while one returning cairo_status_t can't.  That simple, and a lot can
be checked using static analysis.


behdad


> We've had that idea for a long time, but haven't gotten around to
> cleaning up any existing interfaces to make the switch. But I definitely
> agree that I'd like to see new interfaces added with this new style.
> 
>> I'll probably have more comments but let's start with these.
> 
> Thanks for the code review, Jeff!
> 
> -Carl
> 
> PS. I do love git branches and the ability to do things like "git fetch
> joonas" to track all the latest code branches that Joonas has done. But
> at the same time, I really love having code come across my email inbox.
> Code in my inbox basically forces me to take a look at it, while code in
> a git tree, (even with a nice "please review this branch" mail in my
> inbox), waits for me to go looking for it.
> 
> So anyone, (Adrian, Joonas, Chris), that's been waiting for me to review
> some branch of cairo work, please feel free to send it to the list. I'm
> fine with a patch series as one long message, (but binary attachments
> put me back in the position of having to do extra steps to go read the
> code).
> 
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
> 



More information about the cairo mailing list