diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-04-19 16:19:43 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-04-23 16:36:35 +0200 |
commit | 98d91203c5d2f6f7249f38941466857b6a566f5d (patch) | |
tree | cdc2b54152f0be3d668ed49b903a35886fcc1c99 /client/x11/red_pixmap_cairo.cpp | |
parent | 619c37af17406f77c7cb76f3b72bbfc268383d91 (diff) | |
download | spice-98d91203c5d2f6f7249f38941466857b6a566f5d.tar.gz spice-98d91203c5d2f6f7249f38941466857b6a566f5d.tar.xz spice-98d91203c5d2f6f7249f38941466857b6a566f5d.zip |
Make client canvas and pixmaps handle more formats and simplify
We now support 16bit format pixmaps as well as the old ones. Including
both 555 and 565 modes.
We drop the palette argument for pixmap construction as it was only
used for black/white anyway.
Canvas creation is simplified so that there is no separate set_mode
state. Canvases are already created in the right mode and never change.
Diffstat (limited to 'client/x11/red_pixmap_cairo.cpp')
-rw-r--r-- | client/x11/red_pixmap_cairo.cpp | 26 |
1 files changed, 7 insertions, 19 deletions
diff --git a/client/x11/red_pixmap_cairo.cpp b/client/x11/red_pixmap_cairo.cpp index e73b8b41..1974ebc4 100644 --- a/client/x11/red_pixmap_cairo.cpp +++ b/client/x11/red_pixmap_cairo.cpp @@ -26,10 +26,12 @@ RedPixmapCairo::RedPixmapCairo(int width, int height, RedPixmap::Format format, - bool top_bottom, rgb32_t* pallet, RedWindow *win) - : RedPixmap(width, height, format, top_bottom, pallet) + bool top_bottom, RedWindow *win) + : RedPixmap(width, height, format, top_bottom) { - ASSERT(format == RedPixmap::ARGB32 || format == RedPixmap::RGB32 || format == RedPixmap::A1); + ASSERT(format == RedPixmap::ARGB32 || format == RedPixmap::RGB32 || + format == RedPixmap::RGB16_555 || format == RedPixmap::RGB16_565 || + format == RedPixmap::A1); ASSERT(sizeof(RedDrawable_p) <= PIXELES_SOURCE_OPAQUE_SIZE); pixman_image_t *pixman_image; XImage *image = NULL; @@ -49,22 +51,8 @@ RedPixmapCairo::RedPixmapCairo(int width, int height, RedPixmap::Format format, using_shm = vinfo && XPlatform::is_x_shm_avail(); if (using_shm) { - int depth; - - switch (format) { - case RedPixmap::ARGB32: - case RedPixmap::RGB32: - depth = XPlatform::get_vinfo()[0]->depth; - pixman_format = format == RedPixmap::ARGB32 ? PIXMAN_a8r8g8b8 : - PIXMAN_x8r8g8b8; - break; - case RedPixmap::A1: - depth = 1; - pixman_format = PIXMAN_a1; - break; - default: - THROW("unsupported format %d", format); - } + int depth = RedPixmap::format_to_bpp(format); + pixman_format = RedPixmap::format_to_pixman(format); shminfo = new XShmSegmentInfo; shminfo->shmid = -1; |