… | |
… | |
209 | rxvt_img::unshare () |
209 | rxvt_img::unshare () |
210 | { |
210 | { |
211 | if (ref->cnt == 1 && ref->ours) |
211 | if (ref->cnt == 1 && ref->ours) |
212 | return; |
212 | return; |
213 | |
213 | |
214 | //TODO: maybe should reify instead |
|
|
215 | Pixmap pm2 = XCreatePixmap (s->display->dpy, s->display->root, ref->w, ref->h, format->depth); |
214 | Pixmap pm2 = XCreatePixmap (s->display->dpy, s->display->root, ref->w, ref->h, format->depth); |
216 | GC gc = XCreateGC (s->display->dpy, pm, 0, 0); |
215 | GC gc = XCreateGC (s->display->dpy, pm, 0, 0); |
217 | XCopyArea (s->display->dpy, pm, pm2, gc, 0, 0, ref->w, ref->h, 0, 0); |
216 | XCopyArea (s->display->dpy, pm, pm2, gc, 0, 0, ref->w, ref->h, 0, 0); |
218 | XFreeGC (s->display->dpy, gc); |
217 | XFreeGC (s->display->dpy, gc); |
219 | |
218 | |
… | |
… | |
354 | |
353 | |
355 | void |
354 | void |
356 | rxvt_img::contrast (uint16_t r, uint16_t g, uint16_t b, uint16_t a) |
355 | rxvt_img::contrast (uint16_t r, uint16_t g, uint16_t b, uint16_t a) |
357 | { |
356 | { |
358 | if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) |
357 | if (!(s->display->flags & DISPLAY_HAS_RENDER_MUL)) |
|
|
358 | { |
|
|
359 | rxvt_warn ("rxvt_img::contrast operation not supported on this display, RENDER extension too old.\n"); |
359 | return; |
360 | return; |
|
|
361 | } |
360 | |
362 | |
361 | Display *dpy = s->display->dpy; |
363 | Display *dpy = s->display->dpy; |
362 | Picture src = create_xrender_mask (dpy, pm, True); |
364 | Picture src = create_xrender_mask (dpy, pm, True); |
363 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
365 | Picture dst = XRenderCreatePicture (dpy, pm, format, 0, 0); |
364 | |
366 | |
… | |
… | |
470 | |
472 | |
471 | for (int i = 0; i < 3; ++i) |
473 | for (int i = 0; i < 3; ++i) |
472 | for (int j = 0; j < 3; ++j) |
474 | for (int j = 0; j < 3; ++j) |
473 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
475 | xfrm.matrix [i][j] = XDoubleToFixed (matrix [i * 3 + j]); |
474 | |
476 | |
475 | #if 0 |
|
|
476 | xfrm.matrix [0][2] -= XDoubleToFixed (x);//TODO |
477 | xfrm.matrix [0][2] -= XDoubleToFixed (x);//TODO |
477 | xfrm.matrix [1][2] -= XDoubleToFixed (y); |
478 | xfrm.matrix [1][2] -= XDoubleToFixed (y); |
478 | #endif |
|
|
479 | |
479 | |
480 | XRenderSetPictureFilter (dpy, src, "good", 0, 0); |
480 | XRenderSetPictureFilter (dpy, src, "good", 0, 0); |
481 | XRenderSetPictureTransform (dpy, src, &xfrm); |
481 | XRenderSetPictureTransform (dpy, src, &xfrm); |
482 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
482 | XRenderComposite (dpy, PictOpSrc, src, None, dst, 0, 0, 0, 0, 0, 0, new_width, new_height); |
483 | |
483 | |