[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/pacmacs b00db2f7fa 240/472: Use hashmap for tile cache ins
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/pacmacs b00db2f7fa 240/472: Use hashmap for tile cache instead of vector (#131) |
Date: |
Thu, 6 Jan 2022 21:59:28 -0500 (EST) |
branch: elpa/pacmacs
commit b00db2f7fa852bc64bedca43e11535577d2fd6ce
Author: rexim <reximkut@gmail.com>
Commit: rexim <reximkut@gmail.com>
Use hashmap for tile cache instead of vector (#131)
---
pacmacs-image.el | 58 +++++++++++++++++++++++++++++---------------------------
1 file changed, 30 insertions(+), 28 deletions(-)
diff --git a/pacmacs-image.el b/pacmacs-image.el
index faf4443b32..0d5e28953c 100644
--- a/pacmacs-image.el
+++ b/pacmacs-image.el
@@ -35,7 +35,8 @@
(require 'dash)
(defconst pacmacs--flip-xbm-bits (eq system-type 'windows-nt))
-(defvar pacmacs--wall-blocks (make-vector 256 nil))
+(defvar pacmacs--wall-blocks
+ (make-hash-table))
(defun pacmacs-load-image (filename)
(create-image filename 'xpm nil :heuristic-mask t))
@@ -91,43 +92,44 @@
(list bottom right top left
left-upper right-upper
left-bottom right-bottom))))
- (-if-let (cached-tile (aref pacmacs--wall-blocks cache-index))
+ (-if-let (cached-tile (gethash cache-index pacmacs--wall-blocks))
cached-tile
- (aset pacmacs--wall-blocks cache-index
- (let ((wall-block (make-vector
- width nil))
- (weight 3))
+ (puthash cache-index
+ (let ((wall-block (make-vector
+ width nil))
+ (weight 3))
- (dotimes (i width)
- (aset wall-block i (make-bool-vector height nil)))
+ (dotimes (i width)
+ (aset wall-block i (make-bool-vector height nil)))
- (when left-upper
- (pacmacs--put-bits-dot wall-block 0 0 weight))
+ (when left-upper
+ (pacmacs--put-bits-dot wall-block 0 0 weight))
- (when right-upper
- (pacmacs--put-bits-dot wall-block 0 (- width weight) weight))
+ (when right-upper
+ (pacmacs--put-bits-dot wall-block 0 (- width weight)
weight))
- (when left-bottom
- (pacmacs--put-bits-dot wall-block (- height weight) 0 weight))
+ (when left-bottom
+ (pacmacs--put-bits-dot wall-block (- height weight) 0
weight))
- (when right-bottom
- (pacmacs--put-bits-dot wall-block (- height weight) (- width
weight) weight))
+ (when right-bottom
+ (pacmacs--put-bits-dot wall-block (- height weight) (-
width weight) weight))
- (when left
- (pacmacs--put-vertical-bar wall-block 0 height weight))
+ (when left
+ (pacmacs--put-vertical-bar wall-block 0 height weight))
- (when right
- (pacmacs--put-vertical-bar wall-block (- width weight) height
weight))
+ (when right
+ (pacmacs--put-vertical-bar wall-block (- width weight)
height weight))
- (when top
- (pacmacs--put-horizontal-bar wall-block 0 width weight))
-
- (when bottom
- (pacmacs--put-horizontal-bar wall-block (- height weight)
width weight))
+ (when top
+ (pacmacs--put-horizontal-bar wall-block 0 width weight))
+
+ (when bottom
+ (pacmacs--put-horizontal-bar wall-block (- height weight)
width weight))
- (create-image wall-block 'xbm t :width width :height height
- :foreground color
- :background nil))))))
+ (create-image wall-block 'xbm t :width width :height height
+ :foreground color
+ :background nil))
+ pacmacs--wall-blocks))))
(defun pacmacs-create-transparent-block (width height)
(create-image
- [nongnu] elpa/pacmacs c865fda214 120/472: Merge branch 'board-refactoring-74'. Close #74, (continued)
- [nongnu] elpa/pacmacs c865fda214 120/472: Merge branch 'board-refactoring-74'. Close #74, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7e8970628c 122/472: Add sprites for Pacman Death animation. Close #44, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 99a90b9c87 125/472: Fix the tunneling effect. Close #88, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d49cb4afe3 128/472: Fix misspelling of the word `life` in single form, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 22dd5e5cf9 133/472: Rename pacmacs--detect-ghost-collision function (#97), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs d2cf3bd4ba 144/472: Fix hitting ghost visibility bug. Close #78, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5db26b2e3d 154/472: Make the Game Over sign even more smaller, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 5b32c6f310 155/472: Package resources with Cask (#95), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs db03c57347 158/472: Add autoload cookie for pacmacs-start function, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 7285f61d45 164/472: Require pacmacs-board in the pacmacs-render module, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs b00db2f7fa 240/472: Use hashmap for tile cache instead of vector (#131),
ELPA Syncer <=
- [nongnu] elpa/pacmacs 838833da41 414/472: Go to the beginning if score is not featured, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 75f7ddd459 418/472: Add UT for position-of-new-score func (#134), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs fb4885d0fc 420/472: Add UT for make-submit-nickname-action func (#134), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs f53a6d57b7 451/472: Fix the compilation error (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 9d839d08c6 460/472: Bottom padding for object board (#203), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs c6436982fe 462/472: Merge pull request #207 from codingteam/feature/awesome-score-sign-203, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 67660062fd 042/472: Add LICENSE files (#28), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 05e30ca856 076/472: Implement support for frame duration. Close #23, ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 05c88e5eef 100/472: UTs for pacmacs--object-at-p (#75), ELPA Syncer, 2022/01/06
- [nongnu] elpa/pacmacs 01388a06a0 104/472: UTs for pacmacs--track-object (#75), ELPA Syncer, 2022/01/06