Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
use int-at instead of long-at to access pixels
  • Loading branch information
Ian Piumarta committed Sep 11, 2012
1 parent f9df550 commit 26bc555
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gl-texbuf.k
Expand Up @@ -87,12 +87,12 @@

(define-method fill <texbuf> (p)
(for (i 0 (/ (data-length self.bits) sizeof-long))
(set-long-at self.bits i p)))
(set-int-at self.bits i p)))

(define-method fill-rect <texbuf> (x1 y1 x2 y2 p)
(for (x x1 x2)
(for (y y1 y2)
(set-long-at self.bits (+ (* y self.stride) x) p))))
(set-int-at self.bits (+ (* y self.stride) x) p))))

(define-method draw-line <texbuf> (ix1 iy1 ix2 iy2 pixel)
(let* (((x1 y1 x2 y2) (clip-line ix1 iy1 ix2 iy2))
Expand All @@ -103,13 +103,13 @@
(y (long->double y1)) (dy (/ (long->double (- y2 y1)) (long->double ax))))
(while (>= ax 0)
(decr ax)
(set-long-at self.bits (+ (* self.stride (double->long y)) x) pixel)
(set-int-at self.bits (+ (* self.stride (double->long y)) x) pixel)
(incr x dx)
(incr y dy)))
(let ((y y1) (dy (sgn ny))
(x (long->double x1)) (dx (/ (long->double (- x2 x1)) (long->double ay))))
(while (>= ay 0)
(decr ay)
(set-long-at self.bits (+ (* self.stride y) (double->long x)) pixel)
(set-int-at self.bits (+ (* self.stride y) (double->long x)) pixel)
(incr y dy)
(incr x dx))))))

0 comments on commit 26bc555

Please sign in to comment.