[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: Glimpse in kdereview
From:       "Aaron J. Seigo" <aseigo () kde ! org>
Date:       2008-03-30 21:33:00
Message-ID: 200803301533.00390.aseigo () kde ! org
[Download RAW message or body]


On Sunday 30 March 2008, Kåre Särs wrote:
> On Sunday 30 March 2008 23:59:40 Aaron J. Seigo wrote:
> > suggestion: return a QImage instead of taking one by reference, and set
> > it to QImage() on failure. the return can easily check for img.isNull()
> > .. makes for a slightly more natural feeling API?
>
> I made it a reference to save one copy operation. if you have a big image
> it could be significant.

from the QImage docs:

"QImage objects can be passed around by value since the QImage class uses 
implicit data sharing."

in this case the QImage is created in the method, then passed back by 
reference to the QImage object in the consumer at which point the QImage in 
makeQImage is destroyed (no further modifications) ... so no data is actually 
copied, just pointers moved around in the dtprs. quite fast, no matter what 
size the image actually is =)

-- 
Aaron J. Seigo
humru othro a kohnu se
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA  EE75 D6B7 2EB1 A7F1 DB43

KDE core developer sponsored by Trolltech

["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic