naughty: fix image data copy

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2011-10-04 15:23:11 +02:00
parent 50bc79e516
commit ddf8f096bf
1 changed files with 5 additions and 3 deletions

View File

@ -521,13 +521,15 @@ if capi.dbus then
-- 1 -> width, 2 -> height, 3 -> rowstride, 4 -> has alpha -- 1 -> width, 2 -> height, 3 -> rowstride, 4 -> has alpha
-- 5 -> bits per sample, 6 -> channels, 7 -> data -- 5 -> bits per sample, 6 -> channels, 7 -> data
local imgdata local imgdata = ""
-- If has alpha (ARGB32) -- If has alpha (ARGB32)
if hints.icon_data[6] == 4 then if hints.icon_data[6] == 4 then
imgdata = hints.icon_data[7] for i = 1, #hints.icon_data[7], 4 do
imgdata = imgdata .. hints.icon_data[7]:sub(i, i + 2):reverse()
imgdata = imgdata .. hints.icon_data[7]:sub(i + 3, i + 3)
end
-- If has not alpha (RGB24) -- If has not alpha (RGB24)
elseif hints.icon_data[6] == 3 then elseif hints.icon_data[6] == 3 then
imgdata = ""
for i = 1, #hints.icon_data[7], 3 do for i = 1, #hints.icon_data[7], 3 do
imgdata = imgdata .. hints.icon_data[7]:sub(i , i + 2):reverse() imgdata = imgdata .. hints.icon_data[7]:sub(i , i + 2):reverse()
imgdata = imgdata .. string.format("%c", 255) -- alpha is 255 imgdata = imgdata .. string.format("%c", 255) -- alpha is 255