From 2842b340e22b886c6068ce0c0fd6c560926efea5 Mon Sep 17 00:00:00 2001 From: "Tom Ball (MSR)" Date: Thu, 5 Dec 2024 13:26:57 -0800 Subject: [PATCH] start on caching --- libs/screen/image.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libs/screen/image.cpp b/libs/screen/image.cpp index 70aab12b0..279cdcf1f 100644 --- a/libs/screen/image.cpp +++ b/libs/screen/image.cpp @@ -870,8 +870,11 @@ bool overlapsWith(Image_ img, Image_ other, int x, int y) { // words byte 4...N: data 1 bit per pixels, high order bit printed first, lines aligned to byte Image_ convertAndWrap(Buffer buf) { - if (isValidImage(buf)) - return NEW_GC(RefImage, buf); + if (isValidImage(buf)) { + auto r = NEW_GC(RefImage, buf); + r.makeWritable(); + return r; + } // What follows in this function is mostly dead code, except if people construct image buffers // by hand. Probably safe to remove in a year (middle of 2020) or so. When removing, also remove