WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
28345
[GTK] BitmapImage::getGdkPixbuf does not handle alpha channels properly
https://bugs.webkit.org/show_bug.cgi?id=28345
Summary
[GTK] BitmapImage::getGdkPixbuf does not handle alpha channels properly
Martin Robinson
Reported
2009-08-15 19:08:21 PDT
Cairo surfaces store their information in CAIRO_FORMAT_ARGB32, while GdkPixbufs store their information in GDK_COLORSPACE_RGB. The current conversion process between the two types leads to transparency corruption on some images.
Attachments
Fix conversion
(4.95 KB, patch)
2009-08-15 19:17 PDT
,
Martin Robinson
eric
: review-
Details
Formatted Diff
Diff
Patch with variable names according to conventions
(4.98 KB, patch)
2009-08-17 23:02 PDT
,
Martin Robinson
xan.lopez
: review+
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Martin Robinson
Comment 1
2009-08-15 19:17:56 PDT
Created
attachment 34910
[details]
Fix conversion I've attached a patch fixing this issue.
Martin Robinson
Comment 2
2009-08-15 19:33:33 PDT
Sorry to spam this bug, but I wanted to mention that this is reproducible by enabling images as cursors with the patch from #28346 and visiting:
http://www.worldtimzone.com/mozilla/testcase/css3cursors.html
and trying the red cursor at the bottom.
Eric Seidel (no email)
Comment 3
2009-08-17 17:17:04 PDT
Comment on
attachment 34910
[details]
Fix conversion rowstride should probably be rowStride according to webkit style. Are you sure there aren't gtk functions which abstract this? +#if G_BYTE_ORDER == G_LITTLE_ENDIAN + guchar alpha = source[3]; + dest[0] = alpha ? ((source[2] * 255) / alpha) : 0; + dest[1] = alpha ? ((source[1] * 255) / alpha) : 0; + dest[2] = alpha ? ((source[0] * 255) / alpha) : 0; + dest[3] = alpha; +#else Seems silly to make every program check those ifdefs.
Martin Robinson
Comment 4
2009-08-17 17:29:20 PDT
Perhaps more recent versions of GTK+ or GDK have added functionality to accomplish this, but I could not find it. For reference here is an example where Abiword does something very similar:
http://google.com/codesearch/p?hl=en&sa=N&cd=1&ct=rc#gQXpoyUxBIc/abiword-2.5.0/goffice-bits/goffice/utils/go-image.c&q=cairo_to_pixbuf&l=327
Martin Robinson
Comment 5
2009-08-17 23:02:23 PDT
Created
attachment 35016
[details]
Patch with variable names according to conventions This patch aligns variable names according to WebKit conventions.
Xan Lopez
Comment 6
2009-08-23 00:11:44 PDT
Comment on
attachment 35016
[details]
Patch with variable names according to conventions This looks good to me, and on top of fixing a bug it manages to do the data conversion on the client side. There's a NULL where we should use 0, but I'll fix that when landing.
Xan Lopez
Comment 7
2009-08-23 00:18:54 PDT
Committed as
r47689
, closing.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug