[plt-scheme] Graphics artifacts

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Nov 19 16:21:39 EST 2008

At Wed, 19 Nov 2008 09:16:18 -0700, Matthew Flatt wrote:
> At Wed, 19 Nov 2008 10:08:33 -0500, Jaime Vargas wrote:
> > When running the code below in OSX 10.4.11 and 10.5.4 using DrScheme
> > 4.1.2.4- svn12nov2008, I see white bands defects. Is this normal for
> > rendering pixel by pixel or a bug?
> 
> It's a bug --- and, so far, an especially puzzling one. I will continue
> to investigate.

It seems to be a QuickDraw problem, specifically related to moving an
image from a window's offscreen image onto the screen.

If you have a window with white bands, try dragging it off the screen
or under the dock, and I think you'll see that it updates correctly.
That's not a PLT Scheme update --- not even at the level of C++ glue to
the OS's drawing libraries. It's entirely in the OS, which means that
the OS didn't copy the offscreen image to the screen correctly in the
first place.

It's possible that PLT Scheme is somehow misusing QuickDraw, or maybe
it's actually a bug in QuickDraw (which is now deprecated). I haven't
found any change in our use of QuickDraw that solves the problem, and
it looks like the long-term solution will be to switch PLT Scheme away
from QuickDraw.

Meanwhile, a workaround is to

 * Turn on "smoothing" in the window using `(send dc set-smoothing
   'aligned)', which has the effect of using Quartz instead of
   QuickDraw for many operations.

 * Draw the point using `(send dc draw-line x y x y)', since
   `draw-point' isn't one of the operations that uses Quartz.

Another solution is to build the image in a bitmap%, and then
`draw-bitmap' it into the canvas.


Matthew



Posted on the users mailing list.