summaryrefslogtreecommitdiff
path: root/display
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-04-23 15:27:19 +0200
committerAlexander Larsson <alexl@redhat.com>2010-04-23 15:41:42 +0200
commit041d23e8829dcc83514f4235374e70d80412c044 (patch)
tree295d630f97aef57925c4ca5518a702b93e0c574b /display
parentcd8815fe377387b7930c19246df67bbca77a8f84 (diff)
Always send 32bpp as rgba if any alpha byte is non-zero
Diffstat (limited to 'display')
-rw-r--r--display/res.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/display/res.c b/display/res.c
index 2ea9565..c5a381e 100644
--- a/display/res.c
+++ b/display/res.c
@@ -1946,6 +1946,25 @@ static _inline UINT32 get_image_serial()
return ret;
}
+static int rgb32_data_has_alpha(int width, int height, int stride,
+ UINT8 *data)
+{
+ UINT32 *line, *end;
+
+ while (height-- > 0) {
+ line = (UINT32 *)data;
+ end = line + width;
+ data += stride;
+ while (line != end) {
+ if ((*line & 0xff000000) != 0) {
+ return 1;
+ }
+ line++;
+ }
+ }
+ return 0;
+}
+
BOOL QXLGetBitmap(PDev *pdev, QXLDrawable *drawable, QXLPHYSICAL *image_phys, SURFOBJ *surf,
SpiceRect *area, XLATEOBJ *color_trans, UINT32 *hash_key, BOOL use_cache,
INT32 *surface_dest)
@@ -1994,6 +2013,14 @@ BOOL QXLGetBitmap(PDev *pdev, QXLDrawable *drawable, QXLPHYSICAL *image_phys, SU
return FALSE;
}
+ if (surf->iBitmapFormat == BMF_32BPP) {
+ if (rgb32_data_has_alpha(width, height, surf->lDelta,
+ (UINT8 *)surf->pvScan0 + area->left * 4)) {
+ return QXLGetAlphaBitmap(pdev, drawable, image_phys,
+ surf, area, surface_dest);
+ }
+ }
+
DEBUG_PRINT((pdev, 11, "%s: iUniq=%x DONTCACHE=%x w=%d h=%d cx=%d cy=%d "
"hsurf=%x ctiUniq=%x XO_TABLE=%u format=%u\n", __FUNCTION__,
surf->iUniq, surf->fjBitmap & BMF_DONTCACHE, width, height,