Re: extending Gdk::Region



Am Mittwoch, den 06.05.2009, 13:42 -0400 schrieb Christopher Harvey:
> I want to extend Gdk::Region. I noticed it didn't have a virtual
> destructor. I REALLY need to be able to extend it, otherwise I'll end up
> with random functions floating around all over the place.

A virtual destructor probably won't be of much help, as Gdk::Region
implements value semantics so you can't really add any data to it and
use it polymorphically.

If you only want encapsulation but don't like the idea of inheriting
from a class that doesn't have a virtual destructor, you could instead
make Gdk::Region a member of your custom class.

> Basically I want to create a region class that can build itself from
> complex input, then be used as a normal region.

I don't know what you are working on; however, from your other mail it
sounds as though you are trying to reduce the amount of drawing done in
your expose handler.  If so, it's probably a good to check whether
complicated regions will actually improve matters on average.  With
Cairo clipping, it can easily happen that figuring out the clipping
region actually increases the overall processing time.  It depends on
what and how much you are drawing, I guess.

> Can we make this class extendable? It seems like a nice feature for a
> widget library especially.

Adding a virtual destructor probably wouldn't be a big deal here (but
not until the next ABI break!).  However, I'm not sure it will be of any
use, given the value semantics.

--Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]