Skip to content

Commit b6e0261

Browse files
authored
Fix IndexDefect in blitUnsafe and partial fill (#117)
1 parent b2e5695 commit b6e0261

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/fidget/opengl/formatflippy.nim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ proc fill2*(image: Image, rgba: ColorRGBA) =
150150
# image.data[i + 1] = rgba.g
151151
# image.data[i + 2] = rgba.b
152152
# image.data[i + 3] = rgba.a
153-
i += 4
153+
i += 1
154154

155155
proc blitUnsafe*(destImage: Image, srcImage: Image, src, dest: Rect) =
156156
## Blits rectangle from one image to the other image.
@@ -165,8 +165,8 @@ proc blitUnsafe*(destImage: Image, srcImage: Image, src, dest: Rect) =
165165
srcIdx = int(src.x) + (int(src.y) + y) * srcImage.width
166166
destIdx = int(dest.x) + (int(dest.y) + y) * destImage.width
167167
copyMem(
168-
destImage.data[destIdx*c].addr,
169-
srcImage.data[srcIdx*c].addr,
168+
destImage.data[destIdx].addr,
169+
srcImage.data[srcIdx].addr,
170170
int(dest.w) * c
171171
)
172172

0 commit comments

Comments
 (0)