[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in image drawing
From: |
Benhur Stein |
Subject: |
bug in image drawing |
Date: |
Wed, 12 Mar 2003 18:52:49 -0300 |
User-agent: |
Internet Messaging Program (IMP) 3.0 |
Hi.
There is a bug in the drawing of images, related to flippedness and
transparency. It is an old one. It can be seen in GWorkspace,
Tools>Inspectors>Tools, where some icons appear in the right
position (those images have transparency) and some others appear
below the place (flipped rectangle) where it should
be (images without transparency).
Another way of seeing the bug is by disabling compositing with
defaults write NSGlobalDomain GraphicCompositing NO
With this, images in flipped views are displaced (triangles in browsers,
for example).
The bug is in XGGState.m, where an image can be drawn with
-copyBits:fromRect:toPoint:
or
-_compositeGState:fromRect:toPoint:op:fraction:
depending mainly on transparency.
When calculating the destination rectangle in X coords, copyBits uses:
flushRect.size = aRect.size;
flushRect.origin = aPoint;
dst = XGViewRectToX(self, flushRect);
and _composite uses:
flushRect.size = fromRect.size;
flushRect.origin = toPoint;
flushRect.origin = [ctm pointInMatrixSpace: flushRect.origin];
drect = XGWindowRectToX(self, flushRect);
In the first case, a rectangle is made in source coordinates before
being converted to X. This moves aPoint to one or another side of the rectangle
depending on flippedness, and seems to be wrong.
In the second case, the point is first converted to window coordinates,
a rectangle is made there (with the rect size in source coordinates!) and
then converted to X. This can have problems with scale or rotation, but
at least window coordinates are never (or always) flipped. I do not
know if this is a problem.
Anyway, if copyBits is wrong, the places where it is used should be
reviewed (in scrolling and window cache in gui, at least).
If _composite is wrong, many uses of isFlipped throughout
gui should be reviewed.
I'm not sure what is the correct behaviour of copyBits nor composite when
dealing with flipped views. It seems to me that the point considered is
always the bottom left of the destination rectangle independently of
flippedness (if the destination is flipped, that is not the origin of the
rectangle).
Best regards,
Benhur
- bug in image drawing,
Benhur Stein <=