From 9a2e8e1acfc3ff3cac39441d7afeca710fa93632 Mon Sep 17 00:00:00 2001 From: Lior Halphon Date: Sun, 20 Feb 2022 03:18:29 +0200 Subject: [PATCH] Speed things even more by cachine --- Cocoa/GBObjectView.m | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Cocoa/GBObjectView.m b/Cocoa/GBObjectView.m index 0532525..ee09d64 100644 --- a/Cocoa/GBObjectView.m +++ b/Cocoa/GBObjectView.m @@ -13,6 +13,11 @@ @end @implementation GBObjectViewItem +{ + @public + uint32_t _lastImageData[128]; + uint8_t _lastHeight; +} @end @implementation GBObjectView @@ -81,6 +86,12 @@ info[i].flags & 0x20? 'X' : '-', info[i].flags & 0x10? 1 : 0]; } + size_t imageSize = 8 * 4 * height; + if (height == item->_lastHeight && memcmp(item->_lastImageData, info[i].image, imageSize) == 0) { + continue; + } + memcpy(item->_lastImageData, info[i].image, imageSize); + item->_lastHeight = height; item.image.image = [Document imageFromData:[NSData dataWithBytesNoCopy:info[i].image length:64 * 4 * 2 freeWhenDone:false]