Skip to content

Commit 015eab6

Browse files
committed
sdl2/image: remove the bad +36, and use char* cast to get the string, not a pointer to the python object.
1 parent bd68141 commit 015eab6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kivy/core/image/_img_sdl2.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ def save(filename, w, h, fmt, pixels, flipped):
2828
cdef bytes c_filename = filename.encode('utf-8')
2929
cdef int pitch
3030
pitch = w * 4
31+
cdef char *c_pixels = pixels
3132

3233
if flipped:
3334
Logger.warn(
3435
'ImageSDL2: saving flipped textures not supported; image will be flipped')
35-
cdef SDL_Surface *image = SDL_CreateRGBSurfaceFrom(<void *>pixels + 36, w, h, 32, pitch, 0x00000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)
36+
cdef SDL_Surface *image = SDL_CreateRGBSurfaceFrom(c_pixels, w, h, 32, pitch, 0x00000000ff, 0x0000ff00, 0x00ff0000, 0xff000000)
3637

3738
IMG_SavePNG(image, c_filename)
3839
SDL_FreeSurface(image)

0 commit comments

Comments
 (0)