about summary refs log tree commit diff stats
path: root/src/img/painter.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-30 00:19:48 +0200
committerbptato <nincsnevem662@gmail.com>2024-06-20 17:50:22 +0200
commit60dc37269cd2dc8cdf23d9f77680f6af9490032f (patch)
tree9a72ba24daffa546f92704e7e06cf84fded2d89d /src/img/painter.nim
parenta146a22b11cea39bc691417d9d9a1292b7177552 (diff)
downloadchawan-60dc37269cd2dc8cdf23d9f77680f6af9490032f.tar.gz
img, loader: separate out png codec into cgi, misc improvements
* multi-processed and sandboxed PNG decoding & encoding (through local
  CGI)
* improved request body passing (including support for output id as
  response body)
* simplified & faster blob()/text() - now every request starts
  suspended, and OngoingData.buf has been replaced with loader's
  buffering capability
* image caching: we no longer pull bitmaps from the container after
  every single getLines call

Next steps: replace our bespoke PNG decoder with something more usable,
add other decoders, and make them stream.
Diffstat (limited to 'src/img/painter.nim')
-rw-r--r--src/img/painter.nim6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/img/painter.nim b/src/img/painter.nim
index a9848d7d..d02f3602 100644
--- a/src/img/painter.nim
+++ b/src/img/painter.nim
@@ -4,7 +4,6 @@ import std/unicode
 import css/cssvalues
 import img/bitmap
 import img/path
-import img/png
 import types/color
 import types/line
 import types/vector
@@ -139,15 +138,12 @@ proc clearRect*(bmp: Bitmap; x0, x1, y0, y1: uint64) =
 proc clear*(bmp: Bitmap) =
   bmp.clearRect(0, bmp.width, 0, bmp.height)
 
-const unifont = readFile"res/unifont_jp-15.0.05.png"
-var unifontBitmap: Bitmap
+var unifontBitmap*: Bitmap = nil
 var glyphCache: seq[tuple[u: uint32, bmp: Bitmap]]
 var glyphCacheI = 0
 proc getCharBmp(u: uint32): Bitmap =
   # We only have the BMP.
   let u = if u <= 0xFFFF: u else: 0xFFFD
-  if unifontBitmap == nil:
-    unifontBitmap = fromPNG(toOpenArrayByte(unifont, 0, unifont.high))
   for (cu, bmp) in glyphCache:
     if cu == u:
       return bmp