summaryrefslogtreecommitdiffstats
path: root/client/display_channel.cpp
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-04-19 16:19:43 +0200
committerAlexander Larsson <alexl@redhat.com>2010-04-23 16:36:35 +0200
commit98d91203c5d2f6f7249f38941466857b6a566f5d (patch)
treecdc2b54152f0be3d668ed49b903a35886fcc1c99 /client/display_channel.cpp
parent619c37af17406f77c7cb76f3b72bbfc268383d91 (diff)
downloadspice-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/display_channel.cpp')
-rw-r--r--client/display_channel.cpp29
1 files changed, 14 insertions, 15 deletions
diff --git a/client/display_channel.cpp b/client/display_channel.cpp
index 719e7dfd..acbf5da7 100644
--- a/client/display_channel.cpp
+++ b/client/display_channel.cpp
@@ -1079,12 +1079,13 @@ void DisplayChannel::on_disconnect()
(*sync_event)->wait();
}
-bool DisplayChannel::create_cairo_canvas(int surface_id, int width, int height, int depth)
+bool DisplayChannel::create_cairo_canvas(int surface_id, int width, int height, uint32_t format)
{
try {
- CCanvas *canvas = new CCanvas(_pixmap_cache, _palette_cache, _glz_window,
+ CCanvas *canvas = new CCanvas(surface_id == 0, width, height, format,
+ screen()->get_window(),
+ _pixmap_cache, _palette_cache, _glz_window,
surfaces_mngr.get_surfaces());
- canvas->set_mode(width, height, depth, screen()->get_window());
surfaces_mngr.add_canvas(surface_id, canvas);
surfaces_mngr.add_surface(surface_id, canvas->get_internal_canvas());
if (surface_id == 0) {
@@ -1097,21 +1098,19 @@ bool DisplayChannel::create_cairo_canvas(int surface_id, int width, int height,
}
#ifdef USE_OGL
-bool DisplayChannel::create_ogl_canvas(int surface_id, int width, int height, int depth,
+bool DisplayChannel::create_ogl_canvas(int surface_id, int width, int height, uint32_t format,
bool recreate, RenderType rendertype)
{
try {
RedWindow *win;
- GCanvas *canvas = new GCanvas(_pixmap_cache,
+ win = screen()->get_window();
+ GCanvas *canvas = new GCanvas(width, height, format, win, rendertype,
+ _pixmap_cache,
_palette_cache,
_glz_window,
surfaces_mngr.get_surfaces());
- win = screen()->get_window();
-
- canvas->set_mode(width, height, depth, win, rendertype);
-
screen()->untouch_context();
surfaces_mngr.add_canvas(surface_id, canvas);
@@ -1129,12 +1128,12 @@ bool DisplayChannel::create_ogl_canvas(int surface_id, int width, int height, in
#endif
#ifdef WIN32
-bool DisplayChannel::create_gdi_canvas(int surface_id, int width, int height, int depth)
+bool DisplayChannel::create_gdi_canvas(int surface_id, int width, int height, uint32_t format)
{
try {
- GDICanvas *canvas = new GDICanvas(_pixmap_cache, _palette_cache, _glz_window,
+ GDICanvas *canvas = new GDICanvas(width, height, format,
+ _pixmap_cache, _palette_cache, _glz_window,
surfaces_mngr.get_surfaces());
- canvas->set_mode(width, height, depth);
surfaces_mngr.add_canvas(surface_id, canvas);
surfaces_mngr.add_surface(surface_id, canvas->get_internal_canvas());
if (surface_id == 0) {
@@ -1155,7 +1154,7 @@ void DisplayChannel::destroy_canvas(int surface_id)
if (!surfaces_mngr.is_present_canvas(surface_id)) {
return;
}
-
+
canvas = surfaces_mngr.get_canvas(surface_id);
#ifdef USE_OGL
@@ -1171,7 +1170,7 @@ void DisplayChannel::destroy_canvas(int surface_id)
}
void DisplayChannel::create_canvas(int surface_id, const std::vector<int>& canvas_types, int width,
- int height, int depth)
+ int height, uint32_t format)
{
#ifdef USE_OGL
bool recreate = true;
@@ -1417,7 +1416,7 @@ void DisplayChannel::handle_stream_destroy_all(RedPeer::InMessage* message)
destroy_strams();
}
-void DisplayChannel::create_primary_surface(int width, int height, int depth)
+void DisplayChannel::create_primary_surface(int width, int height, uint32_t format)
{
Canvas *canvas;
_mark = false;