Lisp HUG Maillist Archive

Anomalous drawing whilst scrolling :without-bar (XP, Vista)

Hi again, fellow LispWorkers,

The test code below demonstrates a problem I am having with my application,
relating to :without-bar scrolling (I am only
working on WinXP currently). Notice that the top pane, when scrolled, seems to
'bleed' the just-exposed region. With
clipped drawing the problem does go away, but even though my actual application
draws only to the just-exposed region
the problem still occurs. I am just wondering what type of problem this might
be, as I've been fighting with it for a few
weeks, to no avail. Is it simply an issue relating to the amount of data being
drawn? I have known (and would expect)
unoptimized drawing to produce slow scrolling, but not an effect like this. Any
thoughts? 

I have tested this on two XP boxes, and a Vista laptop, with the same results.
My app draws waveforms, and the code
below is a very, *VERY* crude approximation to my actual drawing code, which
does quite a bit of pre-drawing calculation. I get
the problem when combining scrolling my waveform data pane simultaneously with a
ruler, which measures time, placed above it
within a larger grid-layout. The waveform exhibits the identical effect
demonstrated here, but interestingly - and oddly - if
the ruler is placed below the waveform the waveform scrolls perfectly, but the
ruler is then affected.

(defpackage :test
  (:add-use-defaults t)
  (:use :capi))
  
(in-package :test)

(progn
  (defparameter *max* (make-array 2048
                                  :initial-contents
                                    (loop repeat 2048
                                          collect (+ (random 150) 150))))
  (defparameter *min* (make-array 2048
                                  :initial-contents
                                    (loop repeat 2048
                                          collect (random 150))))
  nil)

(define-interface test  ()
  ()
  (:panes
    (pane-1 output-pane
	    :scroll-width 2048
	    :horizontal-scroll :without-bar
	    :visible-max-height 300
	    :display-callback 'draw-data)
    (pane-2 output-pane
	    :scroll-width 2048
	    :horizontal-scroll t
	    :scroll-callback 'on-scroll
	    :visible-max-height 300
	    :display-callback 'draw-data)) ; Clipping here removes the problem.
  (:layouts
    (main-layout column-layout
	         '(pane-1 pane-2)
	         :default t))
  (:default-initargs
    :best-width 800
    :best-height 630))
	
(defun draw-data (pane x y width height)
  (declare (optimize (speed 3) (safety 0) (fixnum-safety 0))
           (ignore x y width height))
    (loop for i fixnum from 0 below 2048
          for min fixnum across *min*
          for max fixnum across *max*
	  append (list i min i max) into coords
	  finally (gp:draw-lines pane coords)))

; This does clipped drawing.
(defun %draw-data (pane x y width height)
  (declare (optimize (speed 3) (safety 0) (fixnum-safety 0))
           (ignore y height))
    (loop for i fixnum from x below (+ x (1- width))
          for min fixnum = (aref *min* i)
          for max fixnum = (aref *max* i)
	  append (list i min i max) into coords
	  finally (gp:draw-lines pane coords)))
		  
(defun on-scroll (pane dimension operation value
		  &key &allow-other-keys)
  (declare (ignore dimension operation value))
  (with-slots (pane-1) (top-level-interface pane)
    (set-horizontal-scroll-parameters pane-1
      :slug-position (get-horizontal-scroll-parameters pane :slug-position))))
	  
(defun test ()
  (contain (make-instance 'test)))
  
(compile 'draw-data)
(compile 'on-scroll)
(compile 'test)


Re: Anomalous drawing whilst scrolling :without-bar (XP, Vista)

Hi there Chris,

I wonder if there is a bit more to the story.  Running your example on a
machine running WinXP Home, I can clearly see the sort of
"bleeding/stretching" effect you allude to.

However on another machine running WinXP Pro the effect, if evident at
all, is barely discernable.

Alas, I know not what to suggest is different about these two machines
and/or the version of WinXP to explain the varying outcomes.  Unless you
can think of something I might look into further.

Brian C.


RE: Anomalous drawing whilst scrolling :without-bar (XP, Vista)

It seems as if the display-callback of the offending pane is somehow not firing. For example, the top pane in the following uses a different display-callback:

(define-interface test  ()
  ()
  (:panes
    (pane-1 output-pane
      :scroll-width 2048
      :horizontal-scroll :without-bar
      :visible-max-height 300
      :display-callback 'draw-data1)
    (pane-2 output-pane
      :scroll-width 2048
      :horizontal-scroll t
      :scroll-callback 'on-scroll
      :visible-max-height 300
      :display-callback 'draw-data))
  (:layouts
    (main-layout column-layout
      '(pane-1 pane-2)
      :default t))
  (:default-initargs
    :best-width 800
    :best-height 630))

(defun draw-data1 (pane x y width height)
  (declare (optimize (speed 3) (safety 0) (fixnum-safety 0))
           (ignore x y width height))
    (loop for i fixnum from 0 below 2048
            for min fixnum across *min*
            for max fixnum across *max*
            append (list i min i max) into coords
            finally (gp:draw-lines pane coords)))

Profiling while performing a scroll action then yields the following:

profile-stacks called 1468 times
interpreted function called 1 time

Cumulative profile summary
Symbol                                    called   profile  (%)      top   (%)
DRAW-DATA                                  42       40 (  3)         2  (  0)
DRAW-DATA1                                  2        2  (  0)         0  (  0)
ON-SCROLL                                   43        0  (  0)         0  (  0)

I have now had the opportunity to test for this issue on both a Linux box and a Mac, and haven't encountered it. So it's obviously Windows-specific. But I have no clue as to what could be causing it. If anyone does (Dave? Martin?) I'm all ears!

Cheers,
Chris

> To: lisp-hug@lispworks.com
> From: relativeflux@hotmail.co.uk
> Subject: Anomalous drawing whilst scrolling :without-bar (XP, Vista)
> Date: Tue, 27 Apr 2010 19:15:02 +0000
>
>
> Hi again, fellow LispWorkers,
>
> The test code below demonstrates a problem I am having with my application,
> relating to :without-bar scrolling (I am only
> working on WinXP currently). Notice that the top pane, when scrolled, seems to
> 'bleed' the just-exposed region. With
> clipped drawing the problem does go away, but even though my actual application
> draws only to the just-exposed region
> the problem still occurs. I am just wondering what type of problem this might
> be, as I've been fighting with it for a few
> weeks, to no avail. Is it simply an issue relating to the amount of data being
> drawn? I have known (and would expect)
> unoptimized drawing to produce slow scrolling, but not an effect like this. Any
> thoughts?
>
> I have tested this on two XP boxes, and a Vista laptop, with the same results.
> My app draws waveforms, and the code
> below is a very, *VERY* crude approximation to my actual drawing code, which
> does quite a bit of pre-drawing calculation. I get
> the problem when combining scrolling my waveform data pane simultaneously with a
> ruler, which measures time, placed above it
> within a larger grid-layout. The waveform exhibits the identical effect
> demonstrated here, but interestingly - and oddly - if
> the ruler is placed below the waveform the waveform scrolls perfectly, but the
> ruler is then affected.
>
> (defpackage :test
> (:add-use-defaults t)
> (:use :capi))
>
> (in-package :test)
>
> (progn
> (defparameter *max* (make-array 2048
> :initial-contents
> (loop repeat 2048
> collect (+ (random 150) 150))))
> (defparameter *min* (make-array 2048
> :initial-contents
> (loop repeat 2048
> collect (random 150))))
> nil)
>
> (define-interface test ()
> ()
> (:panes
> (pane-1 output-pane
> :scroll-width 2048
> :horizontal-scroll :without-bar
> :visible-max-height 300
> :display-callback 'draw-data)
> (pane-2 output-pane
> :scroll-width 2048
> :horizontal-scroll t
> :scroll-callback 'on-scroll
> :visible-max-height 300
> :display-callback 'draw-data)) ; Clipping here removes the problem.
> (:layouts
> (main-layout column-layout
> '(pane-1 pane-2)
> :default t))
> (:default-initargs
> :best-width 800
> :best-height 630))
>
> (defun draw-data (pane x y width height)
> (declare (optimize (speed 3) (safety 0) (fixnum-safety 0))
> (ignore x y width height))
> (loop for i fixnum from 0 below 2048
> for min fixnum across *min*
> for max fixnum across *max*
> append (list i min i max) into coords
> finally (gp:draw-lines pane coords)))
>
> ; This does clipped drawing.
> (defun %draw-data (pane x y width height)
> (declare (optimize (speed 3) (safety 0) (fixnum-safety 0))
> (ignore y height))
> (loop for i fixnum from x below (+ x (1- width))
> for min fixnum = (aref *min* i)
> for max fixnum = (aref *max* i)
> append (list i min i max) into coords
> finally (gp:draw-lines pane coords)))
>
> (defun on-scroll (pane dimension operation value
> &key &allow-other-keys)
> (declare (ignore dimension operation value))
> (with-slots (pane-1) (top-level-interface pane)
> (set-horizontal-scroll-parameters pane-1
> :slug-position (get-horizontal-scroll-parameters pane :slug-position))))
>
> (defun test ()
> (contain (make-instance 'test)))
>
> (compile 'draw-data)
> (compile 'on-scroll)
> (compile 'test)
>


Get a free e-mail account with Hotmail. Sign-up now.
Updated at: 2020-12-10 08:39 UTC