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

List:       koffice-devel
Subject:    Re: Help needed with KSpread zoom
From:       Philipp =?iso-8859-1?q?M=FCller?= <philipp.mueller () gmx ! de>
Date:       2002-06-12 16:24:07
[Download RAW message or body]

Am Mittwoch, 12. Juni 2002 14:28 schrieb John Dailey:
> On Wednesday 12 June 2002 04:34 am, Philipp Müller wrote:
> > Yes this is the sympthom, but after digging deep into the source and
> > trying to avoid the empty "pixels", I couldn't find a rounding issue
> > here. I rather assume, that the scaling with the worldmatrix adds/removes
> > pixels and the paintBackground function doesn't know about them. I didn't
> > find a way to handle them. Even no "hack" :-/
>
> One change that I'll make is to change where the background of the cell is
> cleared.  Instead of clearing each cell individually, we can clear the
> entire block of cells that we are painting at once in KSpreadDocument. 
> That will certainly simplify much of the painting code (all those
> complicated checks to see if the neighboring cell cleared this cell's
> border) but it will have the side effect of masking the problem of being
> zoomed in.  I suppose that will help for the Beta, at least until we solve
> the problem for real.

AFAIK it's not the clearing, it's the missing/overwritten background. So it 
wouldn't help to clear the foreground, if the background is still missing.

So what I would suppose for a quick hack would be:
1. Pass the zoom value to cellPaint
2. If zoom > 1.5 then paint background always with width+1/height+1.
3. If zoom <> 1.0 repaint right/bottom border too.

Result of the hack would be:
1. Minimal intrusive
2. Performance penulty only when zoom <> 1.0
3. Only one problem: Colored background would overlapp next cell when 
zoom >1.5, but this would only be visible when there is no border (otherwise 
the border overpaints the background).
Only 3. would lead to some BR and we can handle this I think.

This would help us already for the Beta and we can work for the correct 
solution until RC1.

> > > It's not that we're performing any operations on the integers that give
> > > a rounding error.
> >
> > Yes we do some operations, which may give rounding errors.
> > 1. width() and height() must always consider where the next cell starts,
> > like I described in my example first.
> > 2, We do at several places
> > for (col = first; col<= last; col++)
> >    mywidth += column->width()
> > paint(mywidth, y, width,y);
> > For these cases mywidth must be double and we need to use dblWidth().
>
> I don't think this is where the problem is, though, because we've always
> been painting in unzoomed coordinates.  The default cell width/height is
> precisely 60x20.  There is no rounding error because the cell width and
> height are integer values, and these problems show up on default cells that
> have not been resized.

I get more and more the impression, that this is a bug in QT. We have the 
code:
  QBrush bb = backGroundBrush( cellRef.x(), cellRef.y() );

  if( bb.style() != Qt::NoBrush )
  {
    painter.fillRect( corner.x(), corner.y(), width, height, bb );
  }

Why is between fillRect (0,0,60,20,bb) and fillRect(60,20,60,20,bb) an empty 
line on screen at the lines (119,0,120,40) and (0,39,120,40), when we have 
painter.scale(2.0,2.0)? I rather thinking of a rounding bug in QT now, as 
this behaviour is really strange. But I didn't test with simple code yet to 
prove this issue.

> Of course, if we start painting in coordinates scaled to the zoom then we
> *will* need the doubles.
>
> > > I'll see what I can dig up on the embedding zoom problem tomorrow.
> > > Hopefully that will be simpler to fix!
> >
> > Fine.
> >
> > Let's try to fix it.
> >
> > Again my hope, that David or Laurent can say something about how
> > KPresenter and KWord is handling zoom, as when we start to reprogramming,
> > I don't like to change everything and then see that it should have been
> > done
> > differently.
>
> I see David's email....that looks helpful.

Yes, very helpful. I will see what I can do until Sunday.
For the Beta2, can you try my above described "hack" and upload it, while I 
will try to move to the real zoom values and upload it after Beta2 is 
tagged/released?

Philipp
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

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