Thanks for the review!

> I'd argue your first problem is here.  Simple rule: when using a 
> Cairo::Context, encase everything you do in save/ restore.  If you don't, you 
> have to manually keep track of the context state, which is difficult/ 
> practically impossible in many cases.

You're perfectly right!

> And again, why not save() here, so that you can return to the Context within 
> a loop as many times as required?  You'll keep the current clip area within 
> that save(), and probably could set the Pango::Layout outside this loop so 
> you can reuse it instead of redefining it every time you enter the loop.

Right again! ;)

> If you aren't going to use the path again, why are you preserving it?  That's 
> a waste of memory because you're keeping track of something you no longer 
> need.

> I'm not sure clipping speeds up things that much in this scenario.  You've 
> still got to draw the entire scene; if it's a static picture, then you may as 
> well draw it all at once, and clipping will require greater resources than 
> just drawing.  I can see a point in clipping ot prevent offscreen elements 
> from being computed, but not for onscreen... but could easily be wrong on 
> that.

Actually I preserve the stroke path for the next clipping. And I do
the clip because I don't want my text to be drawn out of the box, it's
not an optimization in this case.

Thanks again for your reply!
I'll correct my code right away!

-- 
Romain "Creak" Failliot
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to