summaryrefslogtreecommitdiff
path: root/content/handlers/image
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-03-27 09:56:17 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2022-03-27 09:58:21 +0100
commit694a3b4c989d9628a3dd5b7e1f3723d15f432891 (patch)
tree3db6c3130a328dcd386f4033de915936310bc895 /content/handlers/image
parentb0e7de8bff424757a577625d96cd759e774a56e9 (diff)
downloadnetsurf-694a3b4c989d9628a3dd5b7e1f3723d15f432891.tar.gz
netsurf-694a3b4c989d9628a3dd5b7e1f3723d15f432891.tar.bz2
Image: RSVG: Just use bitmap to client for conversion.
Diffstat (limited to 'content/handlers/image')
-rw-r--r--content/handlers/image/rsvg.c40
1 files changed, 1 insertions, 39 deletions
diff --git a/content/handlers/image/rsvg.c b/content/handlers/image/rsvg.c
index 90e4c1288..24fc1a4e0 100644
--- a/content/handlers/image/rsvg.c
+++ b/content/handlers/image/rsvg.c
@@ -129,41 +129,6 @@ static bool rsvg_process_data(struct content *c, const char *data,
return true;
}
-/** Convert Cairo's ARGB output to NetSurf's favoured ABGR format. It converts
- * the data in-place.
- *
- * \param pixels Pixel data, in the form of ARGB. This will
- * be overwritten with new data in the form of ABGR.
- * \param width Width of the bitmap
- * \param height Height of the bitmap
- * \param rowstride Number of bytes to skip after each row (this
- * implementation requires this to be a multiple of 4.)
- */
-static inline void rsvg_argb_to_abgr(uint8_t *pixels,
- int width, int height, size_t rowstride)
-{
- uint8_t *p = pixels;
- int boff = 0, roff = 2;
-
- if (endian_host_is_le() == false) {
- boff = 1;
- roff = 3;
- }
-
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- /* Swap R and B */
- const uint8_t r = p[4*x+roff];
-
- p[4*x+roff] = p[4*x+boff];
-
- p[4*x+boff] = r;
- }
-
- p += rowstride;
- }
-}
-
static bool rsvg_convert(struct content *c)
{
rsvg_content *d = (rsvg_content *) c;
@@ -214,12 +179,9 @@ static bool rsvg_convert(struct content *c)
}
rsvg_handle_render_cairo(d->rsvgh, d->ct);
- rsvg_argb_to_abgr(guit->bitmap->get_buffer(d->bitmap),
- c->width, c->height,
- guit->bitmap->get_rowstride(d->bitmap));
bitmap_format_to_client(d->bitmap, &(bitmap_fmt_t) {
- .layout = BITMAP_LAYOUT_R8G8B8A8,
+ .layout = BITMAP_LAYOUT_ARGB8888,
});
guit->bitmap->modified(d->bitmap);
content_set_ready(c);