bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #27782] drawInRect:fromRect:operation:fraction: doesn't work correc


From: Quentin Mathé
Subject: [bug #27782] drawInRect:fromRect:operation:fraction: doesn't work correctly in a flipped view
Date: Thu, 29 Oct 2009 21:46:58 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.11) Gecko/2009060308 Ubuntu/9.04 (jaunty) Firefox/3.0.11

Update of bug #27782 (project gnustep):

                  Status:                    None => In Progress            

    _______________________________________________________

Follow-up Comment #4:

Here is the promised patch that corrects the issues discussed previously.
NSImage drawing now behaves exactly as Mac OS X with the Cairo backend.

The patch ensures a correct drawing in flipped coordinates by removing any
flipping adjustment in the backend. This makes drawInRect (and drawAtPoint)
works correctly with the Cairo backend.

However this first change was breaking compositeToPoint and dissolveToPoint
methods so I rewrote them to be simpler and match the Cocoa documentation. To
make this rewrite easier and reduce code duplication, compositeToPoint and
dissolveToPoint methods have been modified to share a single implementation
rather than having several almost identical implementations.

The shared implementation behind these methods is in
-compositeToPoint:fromRect:operation:fraction:. This new implementation first
translates the CTM to the image drawing origin, then cancels both scaling and
rotation. This way we don't need to compute the drawing origin once the
scaling and rotation are cancelled because we have translated the CTM before,
and additionally the backend now doesn't have to compensate the flipping
anymore (this was breaking/contradicting drawInRect). The first argument of
compositeToPoint is a point in the existing coordinate space which isn't not
the same than the custom coordinate space used by compositeToPoint where
scaling and rotation are cancelled. If we don't translate the CTM, we have to
compute where the point is located in the custom coordinate space (which is
not so simple when the scaling is not an integer value or a rotation is in
use).

Although I haven't tested it, the previous implementation was probably not
handling rotation and scaling correctly in flipped coordinates. The new one
should work properly.

Some additional comments...
drawInRect (and drawAtPoint) still draws incorrectly in flipped coordinates
with xlib and art. But this was the case previously too. So I would say it
doesn't matter that much.
I don't know much about xlib and art. I suppose the problem could be that
they require changes similar to cairo... or may be xlib and art have no
support to draw the image upside-down (unlike cairo which handles that
transparently when you set a negative scale on the CTM).
I have no Windows machine available, so I haven't tested the windows backend
and whether it needs adjustments or not.

compositeToPoint and dissolveToPoint methods now all work correctly with the
three backends.

I also updated the test example to test compositeToPoint and dissolveToPoint
methods and uploaded some new screenshots.

I have tested the patch with the xlib, art and cairo backends in both Gorm
and the attached Test app. Everything seems to work exactly as before.
Scrolling works correctly too.

(file #18958, file #18959, file #18960, file #18961)
    _______________________________________________________

Additional Item Attachment:

File name: flipped-drawing-gui+back.patch Size:9 KB
File name: testDrawInRect2-cairo.png      Size:14 KB
File name: TestDrawInRect.tar.gz          Size:23 KB
File name: drawInRect2-cocoa.tiff         Size:40 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?27782>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]