diff options
| author | Lars Ingebrigtsen | 2022-08-22 13:53:33 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2022-08-22 13:53:33 +0200 |
| commit | f421efdb5f03d5f7efc3f6893c280b27e54a33cb (patch) | |
| tree | 37df4479944d61772f59081a9980fb294cb5a879 | |
| parent | d9214248913e205f81ffe221a351f85c92f486bd (diff) | |
| download | emacs-f421efdb5f03d5f7efc3f6893c280b27e54a33cb.tar.gz emacs-f421efdb5f03d5f7efc3f6893c280b27e54a33cb.zip | |
Make the size of elements the same in pgtk and X in tetris
* lisp/play/gamegrid.el (gamegrid-glyph-height-mm): Decrease
height a bit (since it wasn't really that height).
(gamegrid-calculate-glyph-size): Change calculation to work on
both X and pgtk (bug#49937).
(gamegrid-make-glyph): Inhibit image scaling.
| -rw-r--r-- | lisp/play/gamegrid.el | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el index 7a850b07ee4..3ad42114d01 100644 --- a/lisp/play/gamegrid.el +++ b/lisp/play/gamegrid.el | |||
| @@ -72,7 +72,7 @@ directory will be used.") | |||
| 72 | (defvar gamegrid-mono-x-face nil) | 72 | (defvar gamegrid-mono-x-face nil) |
| 73 | (defvar gamegrid-mono-tty-face nil) | 73 | (defvar gamegrid-mono-tty-face nil) |
| 74 | 74 | ||
| 75 | (defvar gamegrid-glyph-height-mm 7.0 | 75 | (defvar gamegrid-glyph-height-mm 5.0 |
| 76 | "Desired glyph height in mm.") | 76 | "Desired glyph height in mm.") |
| 77 | 77 | ||
| 78 | ;; ;;;;;;;;;;;;; glyph generation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | 78 | ;; ;;;;;;;;;;;;; glyph generation ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
| @@ -80,12 +80,20 @@ directory will be used.") | |||
| 80 | (defun gamegrid-calculate-glyph-size () | 80 | (defun gamegrid-calculate-glyph-size () |
| 81 | "Calculate appropriate glyph size in pixels based on display resolution. | 81 | "Calculate appropriate glyph size in pixels based on display resolution. |
| 82 | Return a multiple of 8 no less than 16." | 82 | Return a multiple of 8 no less than 16." |
| 83 | (if (and (display-pixel-height) (display-mm-height)) | 83 | (let ((atts (car (display-monitor-attributes-list))) |
| 84 | (let* ((y-pitch (/ (display-pixel-height) (float (display-mm-height)))) | 84 | y-pitch) |
| 85 | (pixels (* y-pitch gamegrid-glyph-height-mm)) | 85 | (setq y-pitch (cond |
| 86 | (rounded (* (floor (/ (+ pixels 4) 8)) 8))) | 86 | (atts |
| 87 | (max 16 rounded)) | 87 | (/ (nth 4 (assq 'geometry atts)) |
| 88 | 16)) | 88 | (nth 2 (assq 'mm-size atts)) |
| 89 | (or (cdr (assq 'scale-factor atts)) 1.0))) | ||
| 90 | ((and (display-pixel-height) (display-mm-height)) | ||
| 91 | (/ (display-pixel-height) (float (display-mm-height)))))) | ||
| 92 | (if y-pitch | ||
| 93 | (let* ((pixels (* y-pitch gamegrid-glyph-height-mm)) | ||
| 94 | (rounded (* (floor (/ (+ pixels 4) 8)) 8))) | ||
| 95 | (max 16 rounded)) | ||
| 96 | 16))) | ||
| 89 | 97 | ||
| 90 | ;; Example of glyph in XPM format: | 98 | ;; Example of glyph in XPM format: |
| 91 | ;; | 99 | ;; |
| @@ -336,7 +344,8 @@ format." | |||
| 336 | 344 | ||
| 337 | (defun gamegrid-make-glyph (data-spec-list color-spec-list) | 345 | (defun gamegrid-make-glyph (data-spec-list color-spec-list) |
| 338 | (let ((data (gamegrid-match-spec-list data-spec-list)) | 346 | (let ((data (gamegrid-match-spec-list data-spec-list)) |
| 339 | (color (gamegrid-match-spec-list color-spec-list))) | 347 | (color (gamegrid-match-spec-list color-spec-list)) |
| 348 | (image-scaling-factor 1.0)) | ||
| 340 | (cond ((characterp data) | 349 | (cond ((characterp data) |
| 341 | (vector data)) | 350 | (vector data)) |
| 342 | ((eq data 'colorize) | 351 | ((eq data 'colorize) |