Fix compatibility with nimskull
This commit is contained in:
parent
3b65ca5605
commit
89ac8dfbe6
|
@ -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 =
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue