mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
image: remove bad usage of globalconf.L
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
2a73f6dd9d
commit
8d36fefd15
4 changed files with 15 additions and 12 deletions
2
ewmh.c
2
ewmh.c
|
@ -661,7 +661,7 @@ ewmh_window_icon_from_reply(xcb_get_property_reply_t *r)
|
|||
if (!data[0] || !data[1] || len > r->length - 2)
|
||||
return 0;
|
||||
|
||||
return image_new_from_argb32(data[0], data[1], data + 2);
|
||||
return image_new_from_argb32(globalconf.L, data[0], data[1], data + 2);
|
||||
}
|
||||
|
||||
/** Get NET_WM_ICON.
|
||||
|
|
|
@ -1763,7 +1763,7 @@ luaA_client_get_content(lua_State *L, client_t *c)
|
|||
data[y * ximage->width + x] |= 0xff000000; /* set alpha to 0xff */
|
||||
}
|
||||
|
||||
retval = image_new_from_argb32(ximage->width, ximage->height, data);
|
||||
retval = image_new_from_argb32(L, ximage->width, ximage->height, data);
|
||||
}
|
||||
xcb_image_destroy(ximage);
|
||||
}
|
||||
|
|
|
@ -222,13 +222,14 @@ image_to_1bit_pixmap(image_t *image, xcb_drawable_t d)
|
|||
}
|
||||
|
||||
/** Create a new image from ARGB32 data.
|
||||
* \param L The Lua VM state.
|
||||
* \param width The image width.
|
||||
* \param height The image height.
|
||||
* \param data The image data.
|
||||
* \return 1 if an image has been pushed on stack, 0 otherwise.
|
||||
*/
|
||||
int
|
||||
image_new_from_argb32(int width, int height, uint32_t *data)
|
||||
image_new_from_argb32(lua_State *L, int width, int height, uint32_t *data)
|
||||
{
|
||||
Imlib_Image imimage;
|
||||
|
||||
|
@ -236,7 +237,7 @@ image_new_from_argb32(int width, int height, uint32_t *data)
|
|||
{
|
||||
imlib_context_set_image(imimage);
|
||||
imlib_image_set_has_alpha(true);
|
||||
image_t *image = image_new(globalconf.L);
|
||||
image_t *image = image_new(L);
|
||||
image->image = imimage;
|
||||
return 1;
|
||||
}
|
||||
|
@ -245,12 +246,13 @@ image_new_from_argb32(int width, int height, uint32_t *data)
|
|||
}
|
||||
|
||||
/** Create a new, completely black image.
|
||||
* \param L The Lua VM state.
|
||||
* \param width The image width.
|
||||
* \param height The image height.
|
||||
* \return 1 if an image has been pushed on stack, 0 otherwise.
|
||||
*/
|
||||
static int
|
||||
image_new_blank(int width, int height)
|
||||
image_new_blank(lua_State *L, int width, int height)
|
||||
{
|
||||
Imlib_Image imimage;
|
||||
|
||||
|
@ -261,7 +263,7 @@ image_new_blank(int width, int height)
|
|||
/* After creation, an image has undefined content. Fix that up. */
|
||||
imlib_context_set_color(0, 0, 0, 0xff);
|
||||
imlib_image_fill_rectangle(0, 0, width, height);
|
||||
image_t *image = image_new(globalconf.L);
|
||||
image_t *image = image_new(L);
|
||||
image->image = imimage;
|
||||
return 1;
|
||||
}
|
||||
|
@ -270,11 +272,12 @@ image_new_blank(int width, int height)
|
|||
}
|
||||
|
||||
/** Load an image from filename.
|
||||
* \param L The Lua VM state.
|
||||
* \param filename The image file to load.
|
||||
* \return 1 if image is loaded and on stack, 0 otherwise.
|
||||
*/
|
||||
static int
|
||||
image_new_from_file(const char *filename)
|
||||
image_new_from_file(lua_State *L, const char *filename)
|
||||
{
|
||||
Imlib_Image imimage;
|
||||
image_t *image;
|
||||
|
@ -288,7 +291,7 @@ image_new_from_file(const char *filename)
|
|||
return 0;
|
||||
}
|
||||
|
||||
image = image_new(globalconf.L);
|
||||
image = image_new(L);
|
||||
image->image = imimage;
|
||||
|
||||
return 1;
|
||||
|
@ -307,7 +310,7 @@ luaA_image_new(lua_State *L)
|
|||
const char *filename;
|
||||
|
||||
if((filename = lua_tostring(L, 2)))
|
||||
return image_new_from_file(filename);
|
||||
return image_new_from_file(L, filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -335,7 +338,7 @@ luaA_image_argb32_new(lua_State *L)
|
|||
|
||||
if(lua_isnil(L, 3))
|
||||
{
|
||||
return image_new_blank(width, height);
|
||||
return image_new_blank(L, width, height);
|
||||
}
|
||||
|
||||
const char *data = luaL_checklstring(L, 3, &len);
|
||||
|
@ -343,7 +346,7 @@ luaA_image_argb32_new(lua_State *L)
|
|||
if(width * height * 4 != len)
|
||||
luaL_error(L, "string size does not match image size");
|
||||
|
||||
return image_new_from_argb32(width, height, (uint32_t *) data);
|
||||
return image_new_from_argb32(L, width, height, (uint32_t *) data);
|
||||
}
|
||||
|
||||
/** Performs 90 degree rotations on the current image. Passing 0 orientation
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
typedef struct image image_t;
|
||||
|
||||
void image_class_setup(lua_State *);
|
||||
int image_new_from_argb32(int, int, uint32_t *);
|
||||
int image_new_from_argb32(lua_State *L, int, int, uint32_t *);
|
||||
uint8_t * image_getdata(image_t *);
|
||||
int image_getwidth(image_t *);
|
||||
int image_getheight(image_t *);
|
||||
|
|
Loading…
Reference in a new issue