From d8f848728e29c9e42c69f8d124221ab77a651639 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 15 Jul 2011 08:26:51 +0000 Subject: [PATCH] Make sure we use the correct pixel format for cursors when in non-native mode. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4592 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- vncviewer/Viewport.cxx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx index dcadd0ef..cf575397 100644 --- a/vncviewer/Viewport.cxx +++ b/vncviewer/Viewport.cxx @@ -223,7 +223,12 @@ void Viewport::setCursor(int width, int height, const Point& hotspot, U8 *i, *o, *m; int m_width; - const PixelFormat &pf = frameBuffer->getPF(); + const PixelFormat *pf; + + if (pixelTrans) + pf = &pixelTrans->getInPF(); + else + pf = &frameBuffer->getPF(); i = (U8*)data; o = buffer; @@ -231,7 +236,7 @@ void Viewport::setCursor(int width, int height, const Point& hotspot, m_width = (width+7)/8; for (int y = 0;y < height;y++) { for (int x = 0;x < width;x++) { - pf.rgbFromBuffer(o, i, 1, &colourMap); + pf->rgbFromBuffer(o, i, 1, &colourMap); if (m[(m_width*y)+(x/8)] & 0x80>>(x%8)) o[3] = 255; @@ -239,7 +244,7 @@ void Viewport::setCursor(int width, int height, const Point& hotspot, o[3] = 0; o += 4; - i += pf.bpp/8; + i += pf->bpp/8; } } -- 2.39.5