summaryrefslogtreecommitdiff
path: root/cogl/winsys/cogl-texture-pixmap-x11.c
diff options
context:
space:
mode:
Diffstat (limited to 'cogl/winsys/cogl-texture-pixmap-x11.c')
-rw-r--r--cogl/winsys/cogl-texture-pixmap-x11.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index 4f642375..f5b31692 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -49,6 +49,7 @@
#include "cogl-xlib.h"
#include "cogl-error-private.h"
#include "cogl-texture-gl-private.h"
+#include "cogl-private.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
@@ -481,6 +482,8 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap)
XImage *image;
int src_x, src_y;
int x, y, width, height;
+ int bpp;
+ int offset;
CoglError *ignore = NULL;
display = cogl_xlib_get_display ();
@@ -589,14 +592,17 @@ _cogl_texture_pixmap_x11_update_image_texture (CoglTexturePixmapX11 *tex_pixmap)
image->bits_per_pixel,
image->byte_order == LSBFirst);
+ bpp = _cogl_pixel_format_get_bytes_per_pixel (image_format);
+ offset = image->bytes_per_line * src_y + bpp * src_x;
+
cogl_texture_set_region (tex_pixmap->tex,
- src_x, src_y,
- x, y, width, height,
- image->width,
- image->height,
+ width,
+ height,
image_format,
image->bytes_per_line,
- (const uint8_t *) image->data,
+ ((const uint8_t *) image->data) + offset,
+ x, y,
+ 0, /* level */
&ignore);
/* If we have a shared memory segment then the XImage would be a
@@ -690,6 +696,7 @@ _cogl_texture_pixmap_x11_set_region (CoglTexture *tex,
int dst_y,
int dst_width,
int dst_height,
+ int level,
CoglBitmap *bmp,
CoglError **error)
{