Battery applet and KIcon

Marco Martin notmart at gmail.com
Mon Feb 15 20:00:09 CET 2010


On Monday 15 February 2010, Zack Rusin wrote:
> On Sunday 14 February 2010 18:24:51 Marco Martin wrote:
> > > QRectF makeUniform(const QRect &orig,
> > > 
> > > 		const QRect &dst)
> > 
> > oring and dist shouldn't them be QRectF in the signature?
> 
> only if we care about it being anywhere close to correct. definitely should
> :)
> 
> > ok, let's see if i got what this does :)
> > if an element has the geometry(10.5, 10.5, 30,30), we want to render it
> > at (0,0,30,30)  we'll render at (0.5, 0.5, 29.5, 29.5) making aligned
> > the edge
> > 
> >  in the oringin that would otherwise have been rendered between two
> >  pixels
> > 
> > but don't quite understand why the size gets changed?
> 
> it shouldn't. i should've used moveCenter or such. the size should stay the
> same, we just want to align it. basically just do the best we can within
> the size that we were given.
> all in all the size could and possibly should be changed by the offset
> itself, but that could be fixed later.
> 
> so as you mentioned, it's easiest to see within identity transform:
> orig = QRectF(0.5, 0.5, 32, 32)
> dst = QRectF(10, 10, 32, 32)
> hence transform = identity, offset = 0.5 and so
> true dst = QRectF(10.5, 10.5, 32, 32);
> 
> with scaling things get hairy, there are two possibilities here they are:
> true dst = QRectF(
> 	offset * div_w + dst.x(),
> 	offset * div_h + dst.y(),
> 	dst.width(), dst.height());
> and
> true dst = QRectF(
> 	offset + offset * div_w + dst.x(),
> 	offset + offset * div_h + dst.y(),
> 	dst.width(), dst.height());
> 
> (btw, in res.adjust in the last email instead of "offset / div" it should
> say offset * div).

this patch -should- do it...
the difference in rendering is very minimal (as it should be) but seems the 
battery is sliiightly more detailed (in the right one is visible a little 
reflection effect that in the left one is blurred away)

Cheers,
Marco Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: svg_aligntoGrid.diff
Type: text/x-patch
Size: 4074 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100215/e40c4fc2/attachment-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: batterypatch.png
Type: image/png
Size: 2526 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/plasma-devel/attachments/20100215/e40c4fc2/attachment-0001.png 


More information about the Plasma-devel mailing list