From 89ac8dfbe664d241081b09cd9cc93a900a60a6a8 Mon Sep 17 00:00:00 2001 From: Alberto Torres Date: Sat, 17 Aug 2024 17:28:15 +0200 Subject: [PATCH] Fix compatibility with nimskull --- src/pixie/fileformats/jpeg.nim | 17 +++++++++-------- src/pixie/images.nim | 2 -- src/pixie/paths.nim | 2 -- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/pixie/fileformats/jpeg.nim b/src/pixie/fileformats/jpeg.nim index 47e91d1..4a41a98 100644 --- a/src/pixie/fileformats/jpeg.nim +++ b/src/pixie/fileformats/jpeg.nim @@ -1,5 +1,5 @@ import chroma, flatty/binny, ../common, ../images, ../internal, - ../simd, std/decls, std/sequtils, std/strutils + ../simd, std/sequtils, std/strutils # This JPEG decoder is loosely based on stb_image which is public domain. @@ -547,7 +547,7 @@ proc fillBitBuffer(state: var DecoderState) = proc huffmanDecode(state: var DecoderState, tableCurrent, table: int): uint8 = ## Decode a uint8 from the huffman table. - var huffman {.byaddr.} = state.huffmanTables[tableCurrent][table] + var huffman = state.huffmanTables[tableCurrent][table].addr state.fillBitBuffer() @@ -884,14 +884,15 @@ proc idctBlock(component: var Component, offset: int, data: array[64, int16]) = proc decodeBlock(state: var DecoderState, comp, row, column: int) = ## Decodes a block. - var data {.byaddr.} = state.components[comp].blocks[row][column] + var data = state.components[comp].blocks[row][column].addr + if state.progressive: if state.spectralStart == 0: - state.decodeProgressiveBlock(comp, data) + state.decodeProgressiveBlock(comp, data[]) else: - state.decodeProgressiveContinuationBlock(comp, data) + state.decodeProgressiveContinuationBlock(comp, data[]) else: - state.decodeRegularBlock(comp, data) + state.decodeRegularBlock(comp, data[]) proc checkRestart(state: var DecoderState) = ## Check if we might have run into a restart marker, then deal with it. @@ -941,7 +942,7 @@ proc quantizationAndIDCTPass(state: var DecoderState) = failInvalid() for column in 0 ..< h: for row in 0 ..< w: - var data {.byaddr.} = state.components[comp].blocks[row][column] + var data = state.components[comp].blocks[row][column].addr when defined(amd64) and allowSimd: for i in 0 ..< 8: # 8 per pass @@ -957,7 +958,7 @@ proc quantizationAndIDCTPass(state: var DecoderState) = state.components[comp].idctBlock( state.components[comp].widthStride * column * 8 + row * 8, - data + data[] ) proc magnifyXBy2(mask: Mask): Mask = diff --git a/src/pixie/images.nim b/src/pixie/images.nim index c4ec9cf..e9b7287 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -497,7 +497,6 @@ proc blendRect(a, b: Image, pos: Ivec2, blendMode: BlendMode) = xEnd - xStart ) of MaskBlend: - {.linearScanEnd.} if yStart + py > 0: zeroMem(a.data[0].addr, (yStart + py) * a.width * 4) for y in yStart ..< yEnd: @@ -607,7 +606,6 @@ proc drawSmooth(a, b: Image, transform: Mat3, blendMode: BlendMode) = ) of MaskBlend: - {.linearScanEnd.} if blendMode == MaskBlend and xStart > 0: zeroMem(a.data[a.dataIndex(0, y)].addr, xStart * 4) diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index 69a9635..762bc33 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1505,7 +1505,6 @@ proc fillCoverage( ) of MaskBlend: - {.linearScanEnd.} blendLineCoverageMask( image.getUncheckedArray(startX, y), cast[ptr UncheckedArray[uint8]](coverages[0].unsafeAddr), @@ -1560,7 +1559,6 @@ proc fillHits( blendLineNormal(image.getUncheckedArray(start, y), rgbx, len) of MaskBlend: - {.linearScanEnd.} var filledTo = startX for (start, len) in hits.walkInteger(numHits, windingRule, y, image.width): if maskClears: # Clear any gap between this fill and the previous fill