mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-19 11:35:12 +00:00
lua-imlib2: Implement Stride in a standard way
This commit is contained in:
parent
3397155da4
commit
01ca581259
@ -31,7 +31,7 @@
|
|||||||
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;
|
int w, h, stride;
|
||||||
double scaled_w, scaled_h;
|
double scaled_w, scaled_h;
|
||||||
Imlib_Image premul;
|
Imlib_Image premul;
|
||||||
cairo_surface_t *result;
|
cairo_surface_t *result;
|
||||||
@ -83,10 +83,12 @@ void cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,
|
|||||||
/* and use the alpha channel of the source image */
|
/* and use the alpha channel of the source image */
|
||||||
imlib_image_copy_alpha_to_image(image, 0, 0);
|
imlib_image_copy_alpha_to_image(image, 0, 0);
|
||||||
|
|
||||||
|
stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, scaled_w);
|
||||||
|
|
||||||
/* now pass the result to cairo */
|
/* now pass the result to cairo */
|
||||||
result = cairo_image_surface_create_for_data(
|
result = cairo_image_surface_create_for_data(
|
||||||
(unsigned char *)imlib_image_get_data_for_reading_only(),
|
(void *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32,
|
||||||
CAIRO_FORMAT_ARGB32, scaled_w, scaled_h, sizeof(DATA32) * scaled_w);
|
scaled_w, scaled_h, stride);
|
||||||
|
|
||||||
cr = cairo_create(cs);
|
cr = cairo_create(cs);
|
||||||
cairo_set_source_surface(cr, result, x, y);
|
cairo_set_source_surface(cr, result, x, y);
|
||||||
|
Loading…
Reference in New Issue
Block a user