[gtk-vnc] When using 32bpp, depth 24 fill alpha byte.
- From: Daniel P. Berrange <dberrange src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-vnc] When using 32bpp, depth 24 fill alpha byte.
- Date: Tue, 6 Jul 2010 13:36:57 +0000 (UTC)
commit 3def8ff205c3e36631dfcb2b7bcccd1605e37d6f
Author: Daniel P. Berrange <dan berrange com>
Date: Mon Jul 5 21:45:04 2010 +0100
When using 32bpp, depth 24 fill alpha byte.
When constructing a GdkPixbuf from the framebuffer pixel array,
it will expect the alpha bits to be initialized to a sensible
value. Since we don't care about alpha, make sure 32bpp, depth 24
format sets alpha to 0xff (full opaque).
src/vncbaseframebuffer.c | 6 +++++-
src/vncbaseframebufferblt.h | 6 ++++--
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/vncbaseframebuffer.c b/src/vncbaseframebuffer.c
index 99fc5ef..689b469 100644
--- a/src/vncbaseframebuffer.c
+++ b/src/vncbaseframebuffer.c
@@ -65,6 +65,7 @@ struct _VncBaseFramebufferPrivate {
int rm, gm, bm;
int rrs, grs, brs;
int rls, gls, bls;
+ int alpha_mask;
/* TRUE if localFormat == remoteFormat */
gboolean perfect_match;
@@ -848,7 +849,10 @@ static void vnc_base_framebuffer_reinit_render_funcs(VncBaseFramebuffer *fb)
i = priv->remoteFormat->bits_per_pixel / 8;
j = priv->localFormat->bits_per_pixel / 8;
if (i == 4) i = 3;
- if (j == 4) j = 3;
+ if (j == 4) {
+ j = 3;
+ priv->alpha_mask = 0xff000000;
+ }
if (i > 4) i = 4; /* XXX hardcoding int64 */
if (j > 4) j = 4; /* XXX hardcoding int64 */
if (!priv->remoteFormat->true_color_flag) {
diff --git a/src/vncbaseframebufferblt.h b/src/vncbaseframebufferblt.h
index 1873cd1..0a7a1c8 100644
--- a/src/vncbaseframebufferblt.h
+++ b/src/vncbaseframebufferblt.h
@@ -60,7 +60,8 @@ static void SET_PIXEL(VncBaseFramebufferPrivate *priv,
spidx,
&red, &green, &blue);
sp = ((guint64)red << 32) | ((guint64)green << 16) | (guint64)blue;
- *dp = SWAP_IMG(priv, ((sp >> priv->rrs) & priv->rm) << priv->rls
+ *dp = SWAP_IMG(priv, priv->alpha_mask
+ | ((sp >> priv->rrs) & priv->rm) << priv->rls
| ((sp >> priv->grs) & priv->gm) << priv->gls
| ((sp >> priv->brs) & priv->bm) << priv->bls);
}
@@ -68,7 +69,8 @@ static void SET_PIXEL(VncBaseFramebufferPrivate *priv,
static void SET_PIXEL(VncBaseFramebufferPrivate *priv,
dst_pixel_t *dp, src_pixel_t sp)
{
- *dp = SWAP_IMG(priv, ((sp >> priv->rrs) & priv->rm) << priv->rls
+ *dp = SWAP_IMG(priv, priv->alpha_mask
+ | ((sp >> priv->rrs) & priv->rm) << priv->rls
| ((sp >> priv->grs) & priv->gm) << priv->gls
| ((sp >> priv->brs) & priv->bm) << priv->bls);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]