naughty: fix image data copy
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
50bc79e516
commit
ddf8f096bf
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue