Skip to content

Instantly share code, notes, and snippets.

@ptschandl
Created August 3, 2021 09:48
Show Gist options
  • Save ptschandl/cd72cf279ba83b2b3178d9b32f034c15 to your computer and use it in GitHub Desktop.
Save ptschandl/cd72cf279ba83b2b3178d9b32f034c15 to your computer and use it in GitHub Desktop.
Manual pixman patching on Ubuntu
# Preparation:
# 1. ensure a deb-src source is uncommented
# sudo nano /etc/apt/sources.list
if grep -q ^deb-src /etc/apt/sources.list*; then
echo "deb-src found. proceeding..."
else
echo "Ensure a deb-src is available in your sources.list"
exit 1
fi
# 2. ensure dch is available for patching stuff
if ! command -v dch &> /dev/null
then
echo "COMMAND dch not be found, trying to install devscripts..."
sudo apt install devscripts
else
echo "dch found. proceeding..."
fi
echo "Creating pixman dir within /opt/ ..."
cd /opt/
mkdir pixman
sudo chown $(whoami):$(whoami) pixman
cd pixman
echo "Getting sources..."
sudo apt-get source libpixman-1-0
cd ..
sudo chown -R $(whoami):$(whoami) pixman
cd pixman/pixman-0.38.4
echo "Trying to patch..."
cd pixman
patch --verbose --ignore-whitespace -b <<EOF
--- pixman-bits-image.c.old 2021-08-03 10:51:55.099218082 +0200
+++ pixman-bits-image.c 2021-08-03 10:55:40.979818850 +0200
@@ -432,29 +432,38 @@
case PIXMAN_FILTER_CONVOLUTION:
if (wide)
+ {
bits_image_fetch_pixel_convolution (image, x, y,
get_pixel, out,
accum_float,
reduce_float);
+ }
else
+ {
bits_image_fetch_pixel_convolution (image, x, y,
get_pixel, out,
accum_32, reduce_32);
+ }
break;
case PIXMAN_FILTER_SEPARABLE_CONVOLUTION:
if (wide)
+ {
bits_image_fetch_pixel_separable_convolution (image, x, y,
get_pixel, out,
accum_float,
reduce_float);
+ }
else
+ {
bits_image_fetch_pixel_separable_convolution (image, x, y,
get_pixel, out,
accum_32, reduce_32);
+ }
break;
default:
+ assert (0);
break;
}
}
EOF
patch -b <<EOF
--- pixman-inlines.h.old 2021-08-03 10:55:54.011621896 +0200
+++ pixman-inlines.h 2021-08-03 10:56:34.175014448 +0200
@@ -231,7 +231,7 @@
argb_t r;
distxy = distx * disty;
- distxiy = distx - (1.f - distxy);
+ distxiy = distx * (1.f - distxy);
distixy = (1.f - distx) * disty;
distixiy = (1.f - distx) * (1.f - disty);
EOF
# Alternatively:
# nano pixman/pixman-inlines.h
# ... and ...
# nano pixman/pixman-bits-image.c
# to change files as in this commit:
# https://gitlab.freedesktop.org/pixman/pixman/commit/8256c235d9b3854d039242356905eca854a890ba
cd ..
dch -n "user-patch of commit 8256c235"
echo "Trying to build & install patched pixman..."
sudo apt -y build-dep pixman
debuild
cd ..
sudo dpkg -i libpixman-1-0_0.38.4-0ubuntu1.1_amd64_deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment