diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2011-02-20 15:30:23 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2011-02-20 15:30:23 +0000 |
commit | 0bad971aecf505440a84086d0b4f2da731803912 (patch) | |
tree | 48ae095bd72f5df442155df92ab7b6695c210ec2 /beos | |
parent | a06b4b4302acdb1406fa9a5f88f5439675598cd4 (diff) | |
download | netsurf-0bad971aecf505440a84086d0b4f2da731803912.tar.gz netsurf-0bad971aecf505440a84086d0b4f2da731803912.tar.bz2 |
Impose maximum constraint on BeOS intrim thumbnail size.
svn path=/trunk/netsurf/; revision=11721
Diffstat (limited to 'beos')
-rw-r--r-- | beos/beos_thumbnail.cpp | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/beos/beos_thumbnail.cpp b/beos/beos_thumbnail.cpp index 7f9395a34..fc966156f 100644 --- a/beos/beos_thumbnail.cpp +++ b/beos/beos_thumbnail.cpp @@ -66,6 +66,9 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, BView *thumbView; float width; float height; + float plot_scale; + int big_width; + int big_height; int depth; struct rect clip; @@ -76,17 +79,12 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, width = thumbnail->Bounds().Width(); height = thumbnail->Bounds().Height(); depth = 32; - //depth = (gdk_screen_get_system_visual(gdk_screen_get_default()))->depth; + + big_width = min(content_get_width(content), 1024); + big_height = ((big_width * height) + (width / 2)) / width; - LOG(("Trying to create a thumbnail bitmap %d x %d for a content of %d x %d @ %d", - width, height, - content_get_width(content), content_get_width(content), depth)); - - BRect contentRect(0, 0, - content_get_width(content) - 1, - content_get_width(content) - 1); - big = new BBitmap(contentRect, - B_BITMAP_ACCEPTS_VIEWS, B_RGB32); + BRect contentRect(0, 0, big_width - 1, big_height - 1); + big = new BBitmap(contentRect, B_BITMAP_ACCEPTS_VIEWS, B_RGB32); if (big->InitCheck() < B_OK) { delete big; @@ -120,23 +118,20 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, nsbeos_current_gc_set(view); plot = nsbeos_plotters; - nsbeos_plot_set_scale(1.0); + plot_scale = thumbnail_get_redraw_scale(content, big_width) + nsbeos_plot_set_scale(plot_scale); - plot.rectangle(0, 0, - content_get_width(content), - content_get_width(content), + plot.rectangle(0, 0, big_width, big_height, plot_style_fill_white); clip.x0 = 0; clip.y0 = 0; - clip.x1 = content_get_width(content); - clip.y1 = content_get_width(content); + clip.x1 = big_width; + clip.y1 = big_height; /* render the content */ - content_redraw(content, 0, 0, - content_get_width(content), content_get_width(content), - &clip, - 1.0, 0xFFFFFF); + content_redraw(content, 0, 0, big_width, big_height, + &clip, plot_scale, 0xFFFFFF); view->Sync(); view->UnlockLooper(); |