diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-02-16 14:35:48 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-02-16 14:35:48 +0000 |
commit | 8912285839a76db57204e7d14d131a4d13b4d53c (patch) | |
tree | 865d8dbb17199a965b88caacea20ed186ba0ee53 | |
parent | 082b128106ded259693dae6a8a0f8de8c4731fb4 (diff) | |
download | netsurf-8912285839a76db57204e7d14d131a4d13b4d53c.tar.gz netsurf-8912285839a76db57204e7d14d131a4d13b4d53c.tar.bz2 |
Comment rationale for render buffer dimensions.
svn path=/trunk/netsurf/; revision=11699
-rw-r--r-- | gtk/thumbnail.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gtk/thumbnail.c b/gtk/thumbnail.c index fe522f262..19bea0548 100644 --- a/gtk/thumbnail.c +++ b/gtk/thumbnail.c @@ -63,14 +63,20 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, assert(content); assert(bitmap); - /* Get details of final thumbnail image */ + /* Get details of required final thumbnail image */ pixbuf = gtk_bitmap_get_primary(bitmap); width = gdk_pixbuf_get_width(pixbuf); height = gdk_pixbuf_get_height(pixbuf); depth = (gdk_screen_get_system_visual(gdk_screen_get_default()))->depth; /* Calculate size of buffer to render the content into */ + /* We get the width from the content width, unless it exceeds 1024, + * in which case we use 1024. This means we never create excessively + * large render buffers for huge contents, which would eat memory and + * cripple performance. */ cwidth = min(content_get_width(content), 1024); + /* The height is set in proportion with the width, according to the + * aspect ratio of the required thumbnail. */ cheight = ((cwidth * height) + (width / 2)) / width; /* Create buffer to render into */ @@ -144,3 +150,4 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, return true; } + |