summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-10-01 10:46:09 +0000
committerThierry Vignaud <tv@mandriva.org>2008-10-01 10:46:09 +0000
commitabb75cd3bb9c417dae813461a2179ac0ff30e1e5 (patch)
treef5c40c715491c3f3aa5da59bdd9c44e7ccd189d0
parenteeb01f41110938a73bf3906f7f188aac009bb77c (diff)
downloaddrakx-abb75cd3bb9c417dae813461a2179ac0ff30e1e5.tar
drakx-abb75cd3bb9c417dae813461a2179ac0ff30e1e5.tar.gz
drakx-abb75cd3bb9c417dae813461a2179ac0ff30e1e5.tar.bz2
drakx-abb75cd3bb9c417dae813461a2179ac0ff30e1e5.tar.xz
drakx-abb75cd3bb9c417dae813461a2179ac0ff30e1e5.zip
(_gtk__Image_using_pixbuf) optimize expose event management by only redrawing
regions that need it instead of the whole image
-rw-r--r--perl-install/mygtk2.pm8
1 files changed, 6 insertions, 2 deletions
diff --git a/perl-install/mygtk2.pm b/perl-install/mygtk2.pm
index 1c6824629..12ff2251e 100644
--- a/perl-install/mygtk2.pm
+++ b/perl-install/mygtk2.pm
@@ -334,13 +334,17 @@ sub _gtk__Image {
$w->set_size_request($width, $height);
$w->{pixbuf} = $pixbuf;
$w->signal_connect(expose_event => sub {
+ my (undef, $event) = @_;
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);
+ foreach my $rect($event->region->get_rectangles) {
+ my @values = $rect->values;
+ $pixbuf->render_to_drawable($w->window, $w->style->fg_gc('normal'),
+ @values[0..1], $w->{x}+$values[0], $w->{y}+$values[1], @values[2..3], 'max', 0, 0);
+ }
});
} : sub {
my ($w, $file, $o_size) = @_;