diff --git a/src/svg-image-source.cc b/src/svg-image-source.cc index 0c2251d..cdd6256 100644 --- a/src/svg-image-source.cc +++ b/src/svg-image-source.cc @@ -19,6 +19,8 @@ #include #include +#include + #include "framebuffer.h" namespace timg { @@ -84,6 +86,11 @@ bool SVGImageSource::LoadAndScale(const DisplayOptions &opts, int, int) { cairo_surface_destroy(surface); g_object_unref(svg); + // Cairo stores A (high-byte), R, G, B (low-byte). We need ABGR. + for (rgba_t &pixel : *image_) { + std::swap(pixel.r, pixel.b); + } + // TODO: for non-1:1 aspect ratio of the output (e.g. pixelation=quarter), // the resulting aspect ratio is squished, as we have to do the // distortion ourself.