mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-19 11:35:12 +00:00
More build fixes, warning fixes.
This commit is contained in:
parent
e2b2e33f33
commit
dfd10667fd
@ -50,6 +50,7 @@ ADD_CUSTOM_COMMAND( OUTPUT ${TOLUA_OUT} ${INCL} COMMAND
|
|||||||
VERBATIM )
|
VERBATIM )
|
||||||
|
|
||||||
SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE)
|
SET_SOURCE_FILES_PROPERTIES(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE)
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(${${VAR}} PROPERTIES COMPILE_FLAGS "-Wno-bad-function-cast -Wno-unused-parameter -Wno-cast-qual")
|
||||||
|
|
||||||
|
|
||||||
SET(${VAR} ${${VAR}} PARENT_SCOPE)
|
SET(${VAR} ${${VAR}} PARENT_SCOPE)
|
||||||
|
@ -24,8 +24,14 @@ include(ToLua)
|
|||||||
add_definitions(-DTOLUA_RELEASE)
|
add_definitions(-DTOLUA_RELEASE)
|
||||||
|
|
||||||
if(BUILD_X11)
|
if(BUILD_X11)
|
||||||
|
|
||||||
if(BUILD_LUA_CAIRO)
|
if(BUILD_LUA_CAIRO)
|
||||||
include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
# Need the directory for -lSM
|
||||||
|
get_filename_component(X11_SM_LIB_PATH ${X11_SM_LIB} DIRECTORY)
|
||||||
|
link_directories(${X11_SM_LIB_PATH})
|
||||||
|
|
||||||
# cairo_set_dash() needs this special hack to work properly
|
# cairo_set_dash() needs this special hack to work properly
|
||||||
# if you have a better solution, please let me know
|
# if you have a better solution, please let me know
|
||||||
wrap_tolua(luacairo_src cairo.pkg libcairo.patch)
|
wrap_tolua(luacairo_src cairo.pkg libcairo.patch)
|
||||||
|
@ -31,19 +31,23 @@
|
|||||||
void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
|
void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
|
||||||
double scale_x, double scale_y, double *return_scale_w,
|
double scale_x, double scale_y, double *return_scale_w,
|
||||||
double *return_scale_h) {
|
double *return_scale_h) {
|
||||||
|
int w, h;
|
||||||
|
double scaled_w, scaled_h;
|
||||||
|
Imlib_Image premul;
|
||||||
|
cairo_surface_t *result;
|
||||||
|
cairo_t *cr;
|
||||||
Imlib_Image *image = imlib_load_image(file);
|
Imlib_Image *image = imlib_load_image(file);
|
||||||
if (!image) {
|
if (!image) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
imlib_context_set_image(image);
|
imlib_context_set_image(image);
|
||||||
int w = imlib_image_get_width(), h = imlib_image_get_height();
|
w = imlib_image_get_width();
|
||||||
|
h = imlib_image_get_height();
|
||||||
|
|
||||||
double scaled_w = *return_scale_w = scale_x * (double)w,
|
scaled_w = *return_scale_w = scale_x * (double)w;
|
||||||
scaled_h = *return_scale_h = scale_y * (double)h;
|
scaled_h = *return_scale_h = scale_y * (double)h;
|
||||||
|
|
||||||
/* create temporary image */
|
/* create temporary image */
|
||||||
Imlib_Image premul = imlib_create_image(scaled_w, scaled_h);
|
premul = imlib_create_image(scaled_w, scaled_h);
|
||||||
/* FIXME: add error handling */
|
/* FIXME: add error handling */
|
||||||
|
|
||||||
/* fill with opaque black */
|
/* fill with opaque black */
|
||||||
@ -59,11 +63,11 @@ void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
|
|||||||
imlib_image_copy_alpha_to_image(image, 0, 0);
|
imlib_image_copy_alpha_to_image(image, 0, 0);
|
||||||
|
|
||||||
/* now pass the result to cairo */
|
/* now pass the result to cairo */
|
||||||
cairo_surface_t *result = cairo_image_surface_create_for_data(
|
result = cairo_image_surface_create_for_data(
|
||||||
(void *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32,
|
(void *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32,
|
||||||
scaled_w, scaled_h, sizeof(DATA32) * scaled_w);
|
scaled_w, scaled_h, sizeof(DATA32) * scaled_w);
|
||||||
|
|
||||||
cairo_t *cr = cairo_create(cs);
|
cr = cairo_create(cs);
|
||||||
cairo_set_source_surface(cr, result, x, y);
|
cairo_set_source_surface(cr, result, x, y);
|
||||||
cairo_paint(cr);
|
cairo_paint(cr);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user