From c6550ae930cf5716527c555b57b27882fca3a2f6 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Wed, 1 Oct 2008 10:44:27 +0000 Subject: (_gtk__Image_using_pixbuf) revert r246993 from 2008-09-29, thus fixing dithering regression: "(_gtk__Image_using_pixbuf) simplify using pixbuf storage (which brings in optimized refresh on expose event as side effect) (needed for next commit)" --- perl-install/mygtk2.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'perl-install/mygtk2.pm') diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm index 60e4a7b1d..28cdaed9f 100644 --- a/perl-install/mygtk2.pm +++ b/perl-install/mygtk2.pm @@ -330,7 +330,17 @@ sub _gtk__Image { } : $class =~ /using_pixbuf/ ? sub { my ($w, $file) = @_; my $pixbuf = _pixbuf_render_alpha(gtknew('Pixbuf', file => $file, %{$w->{options}}), 255); - $w->set_from_pixbuf($pixbuf); + my ($width, $height) = ($pixbuf->get_width, $pixbuf->get_height); + $w->set_size_request($width, $height); + $w->signal_connect(expose_event => sub { + if (!$w->{x}) { + my $alloc = $w->allocation; + $w->{x} = $alloc->x; + $w->{y} = $alloc->y; + } + $pixbuf->render_to_drawable($w->window, $w->style->fg_gc('normal'), + 0, 0, $w->{x}, $w->{y}, $width, $height, 'max', 0, 0); + }); } : sub { my ($w, $file, $o_size) = @_; my $pixbuf = gtknew('Pixbuf', file => $file, if_($o_size, size => $o_size), %{$w->{options}}); -- cgit v1.2.1