diff options
author | Aaron Plattner <aplattner@nvidia.com> | 2009-11-27 16:36:44 -0800 |
---|---|---|
committer | Aaron Plattner <aplattner@nvidia.com> | 2009-11-27 16:36:44 -0800 |
commit | cbcda62580e0d5a58be9aeb924ece32e3f7a8a71 (patch) | |
tree | a1735e3882d7007fb0b824dca2ebc7c5d16bb09a | |
parent | 643aae2d650e8b1102130e79e763b479b15fca53 (diff) |
Fix xrender_surf_populate by removing unnecessary code and just passing the data into XPutImage directly.
-rw-r--r-- | surface.c | 19 |
1 files changed, 2 insertions, 17 deletions
@@ -67,23 +67,8 @@ xrender_surf_populate(Display *disp, XRenderSurf *rs, int w, int h, int x, y; gc = XCreateGC(disp, rs->draw, 0, &gcv); - xim = XCreateImage(disp, rs->vis, rs->depth, ZPixmap, 0, NULL, w, h, 32, 0); - xim->data = (char*)malloc(xim->bytes_per_line * xim->height); - for (y = 0; y < h; y++) - { - for (x = 0; x < w; x++) - { - int a, r, g, b, offset; - - offset = y*w*4 + x*4; - a = img_data[offset + 0]; - r = img_data[offset + 1]; - g = img_data[offset + 2]; - b = img_data[offset + 3]; - - XPutPixel(xim, x, y, (a << 24) | (r << 16) | (g << 8) | b); - } - } + xim = XCreateImage(disp, rs->vis, rs->depth, ZPixmap, 0, NULL, w, h, 32, w * 4); + xim->data = img_data; XPutImage(disp, rs->draw, gc, xim, 0, 0, 0, 0, w, h); free(xim->data); xim->data = NULL; |