vydd / sketch

A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
MIT License
1.39k stars 67 forks source link

Optimize COPY-BUFFER (also gets rid of warnings) #104

Closed Gleefre closed 8 months ago

Gleefre commented 8 months ago

COPY-BUFFER is only used when drawing a figure. SRC-OFFSET and DST-OFFSET are not used, so it is safe to assume they are fixnums (they are always 0). LENGTH is the length of the static-vector which holds the cached buffer data. By ANSI it is bounded by the ARRAY-DIMENSION-LIMIT which is guaranteed to be a fixnum, so LENGTH is a fixnum too.

Tested that figures still work on this small example:

(defpackage #:sketch-user
  (:use #:cl #:sketch))

(in-package #:sketch-user)

(deffigure foo
  (circle 0 10 20)
  (rect 10 20 30 40))

(defsketch bar ()
  (foo (in :mouse-x 0)
       (in :mouse-y 0)))

(make-instance 'bar)