Follow-up Comment #2, bug #27782 (project gnustep):

Hi Fred,

>From what I recall my patch had some rough edges. e.g. I overlooked the fact
you need to call _rebuildCoordinates each time -isFlipped returns a different
value.

When I tried to figure out a fix for the drawInRect bug, I found that
drawInRect behaves correctly if you comment out all the flipping related code
in the cairo backend. However it breaks compositeToPoint. I have attached the
patch so you can take a look.
I rewrote compositeToPoint to alter the CTM directly. To do so, I disabled
the first part of the code where the cache is created and only modified the
'else' branch where drawRepresentation:inRect: is invoked but it doesn't work
(the image location is shifted upwards outside of the view). Here is what I
tried to do:

    NSAffineTransform *transform = [GSCurrentContext() GSCurrentCTM];   
    NSAffineTransformStruct oldTs = [transform transformStruct];
    NSAffineTransformStruct newTs = [transform transformStruct];

    /* Put identity matrix 2x2 in the CTM to suppress scaling and rotation
but keep translation as is */
    newTs.m11 = 1;
    newTs.m12 = 0;
    newTs.m21 = 0;
    newTs.m22 = 1;

    [transform setTransformStruct: newTs];
    [GSCurrentContext() GSSetCTM: transform];


    rect = NSMakeRect(aPoint.x, aPoint.y, _size.width, _size.height);
    [self drawRepresentation: rep inRect: rect];

    [transform setTransformStruct: oldTs];
    [GSCurrentContext() GSSetCTM: transform];

The Cocoa documentation leads me to think that compositeToPoint and similar
methods should probably do something like that.

It seems there is also some copied/pasted code in NSImage.m that could be
eliminated. e.g. drawAtPoint should just call drawInRect. Ditto for
compositeToPoint methods.

(file #18936)
    _______________________________________________________

Additional Item Attachment:

File name: disable-flipped-cairo.patch    Size:0 KB


    _______________________________________________________

Reply to this item at:

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

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



_______________________________________________
Bug-gnustep mailing list
Bug-gnustep@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to