After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 80927 - Special-case compositing/copying with no scaling
Special-case compositing/copying with no scaling
Status: RESOLVED FIXED
Product: gdk-pixbuf
Classification: Platform
Component: general
git master
Other other
: Normal normal
: ---
Assigned To: gdk-pixbuf-maint
gdk-pixbuf-maint
: 496306 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2002-05-06 11:22 UTC by Matthias Clasen
Modified: 2014-10-22 17:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Avoid scaling if possible, C code only. (3.31 KB, patch)
2005-11-10 19:13 UTC, Hans Petter Jansson
committed Details | Review

Description Matthias Clasen 2002-05-06 11:22:55 UTC
gdk_pixbuf_composite_* and gdk_pixbuf_scale always run through
the scaling code 
path, even when the scale factor in both directions is 1...
for this common case, 
presumbably big wins could be found by adding a
non-scaling code path.
Comment 1 Owen Taylor 2002-05-07 19:18:57 UTC
Would be nice to have for 2.2, though not essential. I have
a bunch of code for this around that could possibly be
used.
Comment 2 Matthias Clasen 2002-07-03 08:20:16 UTC
How about sticking your code in here, so that we can try to get it
in for 2.2 ?
Comment 3 Owen Taylor 2002-09-20 22:55:43 UTC
The code in question can be found at:

 http://people.redhat.com/otaylor/misc/composite-funcs-0.1.tar.gz
Comment 4 Owen Taylor 2002-12-09 22:43:40 UTC
I don't think this ends up being a big bottleneck in most
places, partly becuase there is special-cased 
composite-without-scale code in GDK for alpha-compositing
pixbufs.
Comment 5 Graham Cole 2004-12-21 01:54:44 UTC
It may not be so much of a bottleneck, but it would prevent one particular case
where the behaviour of gdk_pixbuf_scale seems a little off...

I speak of calling the function with GDK_INTERP_HYPER and scale values of 1.0.
The image returned becomes noticeably blurred, even though no scaling has
actually taken place! Maybe this is the responsibility of the app developer to
avoid, but no warnings are apparent in the docs that the "best" method of
scaling sometimes isn't all that ;-)
Comment 6 Hans Petter Jansson 2005-11-10 19:11:59 UTC
I have a lame patch for this that I wrote against gdk-pixbuf 0.16.0 in 2002. It
probably needs a little work (using epsilon in the scale factor check, for
instance). Anyway, I'm attaching it in case it's of any use.
Comment 7 Hans Petter Jansson 2005-11-10 19:13:31 UTC
Created attachment 54605 [details] [review]
Avoid scaling if possible, C code only.
Comment 8 Hans Petter Jansson 2005-11-10 19:16:43 UTC
I ran a test back then too, compositing a 128x128 pixbuf on top of another
pixbuf of the same size without scaling, repeatedly.

Before patch: 17 seconds on CPU
After patch:  13 seconds on CPU

Which indicates there's at least some gain.
Comment 9 Kjartan Maraas 2006-12-27 12:12:49 UTC
Looks like a worthwhile addition to me. Did anyone ever look at this patch?
Comment 10 Bastien Nocera 2014-10-22 12:23:45 UTC
I've pushed this patch, along with the naive == 1.0 checks for the scaling factor.
We can eventually take care of that in a subsequent patch, which would hopefully
take less than 9 years to handle.
Comment 11 Bastien Nocera 2014-10-22 17:10:00 UTC
*** Bug 496306 has been marked as a duplicate of this bug. ***