From 9bbc3b8d25a26c0a24af56fbdc2ebf4393840564 Mon Sep 17 00:00:00 2001 From: Vindaar Date: Sun, 28 Jun 2020 17:58:12 +0200 Subject: [PATCH] fix usage of `bY` -> `numX`, make raster example use unequal sizes --- src/ginger/backendCairo.nim | 2 +- tests/tRaster.nim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ginger/backendCairo.nim b/src/ginger/backendCairo.nim index d27bf84..a1d991b 100644 --- a/src/ginger/backendCairo.nim +++ b/src/ginger/backendCairo.nim @@ -276,7 +276,7 @@ proc drawRaster*(img: var BImage, left, bottom, width, height: float, for x in 0 ..< wImg: var tX = (x.float / blockSizeX).floor.int var tY = (y.float / blockSizeY).floor.int - data[y * wImg + x] = toDraw[tY * bY + tX] + data[y * wImg + x] = toDraw[tY * numX + tX] pngSurface.markDirty() # apply the new surface to the image surface ctx.set_source(pngSurface, left, bottom) diff --git a/tests/tRaster.nim b/tests/tRaster.nim index e5f3446..322035b 100644 --- a/tests/tRaster.nim +++ b/tests/tRaster.nim @@ -4,7 +4,7 @@ var ys = newSeq[float]() zs = newSeq[float]() for x in 0 ..< 28: - for y in 0 ..< 28: + for y in 0 ..< 14: xs.add x.float ys.add y.float zs.add rand(1.0) @@ -41,7 +41,7 @@ view1.background() let raster = view1.initRaster(c(0.0, 0.0), width = quant(1.0, ukRelative), height = quant(1.0, ukRelative), - numX = 28, numY = 28, + numX = 28, numY = 14, drawCb = drawCb) let grdlines = view1.initGridLines(some(xticks), some(yticks))