inline void set_pixel(unsigned char* pixels, uint32_t width, uint32_t height, uint32_t bpp, set_pixel_func pixel_func, int32_t x, int32_t y, uint32_t col) {\r
if(x < 0 || y < 0) return;\r
if(x >= (int32_t)width || y >= (int32_t)height) return;\r
- pixels = pixels + (x + height * y) * bpp;\r
+ pixels = pixels + (x + width * y) * bpp;\r
pixel_func(pixels, col);\r
}\r
\r
uint32_t gdx2d_get_pixel(const gdx2d_pixmap* pixmap, int32_t x, int32_t y) {\r
if(!in_pixmap(pixmap, x, y))\r
return 0;\r
- unsigned char* ptr = (unsigned char*)pixmap->pixels + (x + pixmap->height * y) * bytes_per_pixel(pixmap->format);\r
+ unsigned char* ptr = (unsigned char*)pixmap->pixels + (x + pixmap->width * y) * bytes_per_pixel(pixmap->format);\r
return to_RGBA8888(pixmap->format, get_pixel_func_ptr(pixmap->format)(ptr));\r
}\r
\r
set_pixel_func pset = set_pixel_func_ptr(pixmap->format);\r
get_pixel_func pget = get_pixel_func_ptr(pixmap->format);\r
uint32_t col_format = to_format(pixmap->format, col);\r
- void* addr = ptr + (x0 + y0) * bpp;\r
+ void* addr = ptr + (x0 + y0 * pixmap->width) * bpp;\r
\r
if (dy < 0) { dy = -dy; stepy = -1; } else { stepy = 1; }\r
if (dx < 0) { dx = -dx; stepx = -1; } else { stepx = 1; }\r
*/\r
public Pixmap(int width, int height, Format format) {\r
pixmap = new Gdx2DPixmap(width, height, Format.toGdx2DPixmapFormat(format));\r
+ setColor(0, 0, 0, 0);\r
+ fill();\r
+ setColor(1, 1, 1, 1);\r
}\r
\r
/**\r