Skip to content

Commit

Permalink
add v2 rendering flag
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Sep 22, 2023
1 parent cc563ca commit 3fe2c54
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
14 changes: 9 additions & 5 deletions src/display-3.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -405,19 +405,23 @@
(return-from outer))))
(lem-if:clear-to-end-of-window (lem-core:implementation) window y))))

(defun redraw-buffer-internal (buffer window force)
(defun redraw-buffer-v2 (buffer window force)
(assert (eq buffer (lem-core:window-buffer window)))
(when (or force
(lem-core::screen-modified-p (lem-core:window-screen window)))
(setf (drawing-cache window) '()))
(redraw-lines window)
(lem-core::update-screen-cache (lem-core:window-screen window) buffer))

(defmethod lem-core::redraw-buffer (implementation (buffer text-buffer-v2) window force)
(redraw-buffer-internal buffer window force))
(defvar *v2* nil)

(defmethod lem-core::redraw-buffer (implementation (buffer lem-core:text-buffer) window force)
(if *v2*
(redraw-buffer-v2 buffer window force)
(lem-core::redraw-buffer-v1 buffer window force)))

(lem-core:define-command change-buffer-to-v2 () ()
(change-class (lem-core:current-buffer) 'text-buffer-v2))
(setf *v2* t))

(lem-core:define-command change-buffer-to-v1 () ()
(change-class (lem-core:current-buffer) 'lem-base:text-buffer))
(setf *v2* nil))
5 changes: 1 addition & 4 deletions src/display.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@
(window-point window))
-1))

(defun redraw-buffer-internal (buffer window force)
(defun redraw-buffer-v1 (buffer window force)
(assert (eq buffer (window-buffer window)))
(let ((screen (window-screen window)))
(draw-window-to-screen window)
Expand All @@ -554,6 +554,3 @@
(when (or force (required-whole-update-screen-p screen))
(lem-if:force-update-view (implementation) (screen-view screen)))
(update-screen-cache screen buffer)))

(defmethod redraw-buffer (implementation (buffer text-buffer) window force)
(redraw-buffer-internal buffer window force))

0 comments on commit 3fe2c54

Please sign in to comment.