Re: Drawing Area issues ( continued, with example )



Ah, thankyou :) Yes, indeed, if I avoid constructing further contexts,
it works. I can replace this with just calling set_source_rgba() on
the 1 context in *most* cases, though I'd have to have *two* passes
for the graphs, as I draw a 'highlight' line ( lighter colour ) as
well as the 'regular' line that encloses the bars ( and which I call
->fill inside of later ). Still, that's not much more work.

Does anyone know ... would this bug be in the bindings, or in gtk+ or cairo?

Dan

On Wed, Oct 11, 2017 at 1:43 PM, Jeremy Volkening <jdv base2bio com> wrote:
On Tue, Oct 10, 2017 at 09:38:03PM +1100, Daniel Kasak wrote:

I've cut down my app to a "relatively small" example which doesn't
need a database connection or loads of other stuff. It's still 400+
lines ( with lots of whitespace ). I know it's asking a lot, but if
someone can figure out what I'm doing wrong, I'd be very grateful ...


Your issues stem from the creation of multiple contexts referencing the
DrawingArea surface within the 'draw' callback, i.e.

my $surface = $cairo_context->get_target;
# and later..
my $this_stat_context = Cairo::Context->create( $surface );

If you re-write your code without doing this -- just use the context passed
into the 'draw' signal callback along with save() and restore() -- I think
you will find your issues disappear. I haven't completely re-written your
code, but I tested on one small bit and it had the desired effect.

Why this happens is a little bit hazy to me. If you print the values
passed into the 'draw' callback, you can see that all of the pointers to the
cairo context are the same for the different DAs. Somehow this gets sorted
out if you just use the context as given, but my guess is that when you are
calling get_target() it returns the surface for the first DrawingArea only,
and then your issues arise.

Regards,
Jeremy

--
Civilization is the limitless multiplication of unnecessary necessities.
                -- Mark Twain
_______________________________________________
gtk-perl-list mailing list
gtk-perl-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-perl-list


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