Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Expanding Growth in Memory and XOR Mode in OS X
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Expanding Growth in Memory and XOR Mode in OS X



Ian, I recollect vaguely a problem in OS X 10.0 (and 10.0.1) where drawing
horizontal and vertical lines in XOR mode would lead to memory big-bang. If
you check the mail archives there is more detail about that.

The workaround is to make sure that your rect is not zero-sided - if either
width or height of it are 0 don't draw it, draw a line instead. An even
better workaround, perhaps, might be to use MRJ drag-drop APIs instead of
cooking up your own. (Even though I'm not positive they go back all the way
to 1.1.8.)

-Vladimir

> From: Ian Cheyne <email@hidden>
> Date: Mon, 30 Apr 2001 21:24:24 +0100
> To: Java-Dev <email@hidden>
> Subject: Expanding Growth in Memory and XOR Mode in OS X
>
> Apologies if this has been posted twice - used my other (wrong) e-mail
> first time.
>
> I have an application which is doing some drag and drop operations. It
> is my own drag and drop algorithms rather than Java 2 because I need
> this to work under Java 1.1.8. My application is using Swing and I am
> dragging a selection marquee within a JPanel.
>
> I am now trying to get it to work under OS X but I am having problems
> with setting XOR Mode on a graphics object. I realise that there are
> issues regarding XOR most of which I can live with however there is one
> that is a bit strange. It results in my application quickly and forever
> increasing in size using up all memory on the machine even preventing
> user interaction. I am running from the command line and Ctrl-C does
> work.
>
> The code is at the foot of this message. The problem lies in the second
> of my methods "drawDragBox" and is a combination of using the Graphics
> "setXORMode" method and the "drawRect" method. No error messages appear
> in the command shell window or console. Commenting out either or both
> of these prevents the bug ocurring. My class is called
> "DragToSelectController" however I have another class called
> "DragObjectsController" which has very similar code except that it uses
> the Graphics "drawImage" method rather than "drawRect". It works okay!
> Can anyone shed light on this problem and/or point me in the direction
> of known problems with XOR Mode.
>
> Any help would be greatly appreciated.
>
> Regards,
>
> Ian Cheyne
> Systems Engineer, UK
>
> P.S. Swing on OS X is very impressive :-)
>
>
>
> public static void mouseDragged(int x, int y)
> {
> if (dragging != true)
> {System.out.println("First Drag");
> drawDragBox();
> dragging = true;}
>
> System.out.println("Dragging");
> drawDragBox();
> currentX = x;
> currentY = y;
> drawDragBox();
> }
>
> public static void drawDragBox()
> {
> System.out.println("Drawing Drag Box");
> Graphics g = dragSurface.getGraphics();
> g.setXORMode(Color.gray);
> //offending line 1
> Rectangle aRectangle = dragBox();
> g.drawRect(aRectangle.x, aRectangle.y, aRectangle.width,
> aRectangle.height); //offending line 2
> }
> _______________________________________________
> java-dev mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/java-dev


References: 
 >Expanding Growth in Memory and XOR Mode in OS X (From: Ian Cheyne <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.