… | |
… | |
331 | |
331 | |
332 | return mask; |
332 | return mask; |
333 | } |
333 | } |
334 | |
334 | |
335 | void |
335 | void |
336 | rxvt_img::brightness (unsigned short r, unsigned short g, unsigned short b, unsigned short a) |
336 | rxvt_img::brightness (uint16_t r, uint16_t g, uint16_t b, uint16_t a) |
337 | { |
337 | { |
338 | Display *dpy = s->display->dpy; |
338 | Display *dpy = s->display->dpy; |
339 | Picture src = create_xrender_mask (dpy, pm, True); |
339 | Picture src = create_xrender_mask (dpy, pm, True); |
340 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
340 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
341 | |
341 | |
… | |
… | |
351 | XRenderFreePicture (dpy, src); |
351 | XRenderFreePicture (dpy, src); |
352 | XRenderFreePicture (dpy, dst); |
352 | XRenderFreePicture (dpy, dst); |
353 | } |
353 | } |
354 | |
354 | |
355 | void |
355 | void |
356 | rxvt_img::contrast (unsigned short r, unsigned short g, unsigned short b, unsigned short a) |
356 | rxvt_img::contrast (uint16_t r, uint16_t g, uint16_t b, uint16_t a) |
357 | { |
357 | { |
358 | if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) |
358 | if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) |
|
|
359 | { |
|
|
360 | rxvt_warn ("rxvt_img::contrast operation not supported on this display, RENDER extension too old.\n"); |
359 | return; |
361 | return; |
|
|
362 | } |
360 | |
363 | |
361 | Display *dpy = s->display->dpy; |
364 | Display *dpy = s->display->dpy; |
362 | Picture src = create_xrender_mask (dpy, pm, True); |
365 | Picture src = create_xrender_mask (dpy, pm, True); |
363 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
366 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
364 | |
367 | |
… | |
… | |
407 | if (x == 0 && y == 0 && w == ref->w && h == ref->h) |
410 | if (x == 0 && y == 0 && w == ref->w && h == ref->h) |
408 | return clone (); |
411 | return clone (); |
409 | |
412 | |
410 | Display *dpy = s->display->dpy; |
413 | Display *dpy = s->display->dpy; |
411 | |
414 | |
|
|
415 | // add an alpha channel if... |
412 | bool alpha = !format->direct.alphaMask |
416 | bool alpha = !format->direct.alphaMask // pixmap has none yet |
413 | && (x || y) |
417 | && (x || y) // we need one because of non-zero offset |
414 | && repeat == RepeatNone; |
418 | && repeat == RepeatNone; // and we have no good pixels to fill with |
415 | |
419 | |
416 | rxvt_img *img = new rxvt_img (s, alpha ? find_alpha_format_for (dpy, format) : format, 0, 0, w, h, repeat); |
420 | rxvt_img *img = new rxvt_img (s, alpha ? find_alpha_format_for (dpy, format) : format, 0, 0, w, h, repeat); |
417 | img->alloc (); |
421 | img->alloc (); |
418 | |
422 | |
419 | Picture src = src_picture (); |
423 | Picture src = src_picture (); |