diff options
-rwxr-xr-x | amiga/thumbnail.c | 5 | ||||
-rw-r--r-- | beos/thumbnail.cpp | 7 | ||||
-rw-r--r-- | cocoa/thumbnail.m | 4 | ||||
-rw-r--r-- | content/urldb.c | 12 | ||||
-rw-r--r-- | desktop/browser_history.c | 24 | ||||
-rw-r--r-- | desktop/thumbnail.h | 4 | ||||
-rw-r--r-- | framebuffer/thumbnail.c | 7 | ||||
-rw-r--r-- | gtk/thumbnail.c | 8 | ||||
-rw-r--r-- | monkey/thumbnail.c | 5 | ||||
-rw-r--r-- | riscos/save.c | 2 | ||||
-rw-r--r-- | riscos/thumbnail.c | 7 | ||||
-rw-r--r-- | riscos/window.c | 5 | ||||
-rw-r--r-- | windows/gui.c | 2 | ||||
-rw-r--r-- | windows/main.c | 2 | ||||
-rw-r--r-- | windows/thumbnail.c | 16 |
15 files changed, 44 insertions, 66 deletions
diff --git a/amiga/thumbnail.c b/amiga/thumbnail.c index cb4cf6143..04417bbe8 100755 --- a/amiga/thumbnail.c +++ b/amiga/thumbnail.c @@ -41,8 +41,7 @@ #include "amiga/bitmap.h" #include "amiga/rtg.h" -bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, - nsurl *url) +bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap) { struct BitScaleArgs bsa; int plot_width; @@ -113,8 +112,6 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, BitMapScale(&bsa); } - if (url) urldb_set_thumbnail(url, bitmap); - return true; } diff --git a/beos/thumbnail.cpp b/beos/thumbnail.cpp index 12a7320ce..dacefed41 100644 --- a/beos/thumbnail.cpp +++ b/beos/thumbnail.cpp @@ -56,8 +56,7 @@ extern status_t ScaleBitmap(const BBitmap& inBitmap, BBitmap& outBitmap); * \param bitmap the bitmap to draw to * \param url the URL the thumnail belongs to, or NULL */ -bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, - nsurl *url) +bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap) { BBitmap *thumbnail; BBitmap *small; @@ -150,10 +149,6 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, thumbnail->UnlockBits(); small->UnlockBits(); - /* register the thumbnail with the URL */ - if (url) - urldb_set_thumbnail(url, bitmap); - bitmap_modified(bitmap); // cleanup diff --git a/cocoa/thumbnail.m b/cocoa/thumbnail.m index 7e524b754..bb018bc30 100644 --- a/cocoa/thumbnail.m +++ b/cocoa/thumbnail.m @@ -26,7 +26,7 @@ #import "image/bitmap.h" /* In platform specific thumbnail.c. */ -bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap, nsurl *url) +bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap) { int bwidth = bitmap_get_width( bitmap ); int bheight = bitmap_get_height( bitmap ); @@ -60,8 +60,6 @@ bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap, nsu bitmap_modified( bitmap ); - if (NULL != url) urldb_set_thumbnail( url, bitmap ); - return true; } diff --git a/content/urldb.c b/content/urldb.c index e7cb551d0..f77f597c4 100644 --- a/content/urldb.c +++ b/content/urldb.c @@ -3061,13 +3061,15 @@ void urldb_set_thumbnail(nsurl *url, struct bitmap *bitmap) assert(url); p = urldb_find_url(url); - if (!p) - return; + if (p != NULL) { - if (p->thumb && p->thumb != bitmap) - bitmap_destroy(p->thumb); + LOG(("Setting bitmap on %s", nsurl_access(url))); - p->thumb = bitmap; + if (p->thumb && p->thumb != bitmap) + bitmap_destroy(p->thumb); + + p->thumb = bitmap; + } } diff --git a/desktop/browser_history.c b/desktop/browser_history.c index fb76097ed..dc04a16c1 100644 --- a/desktop/browser_history.c +++ b/desktop/browser_history.c @@ -512,13 +512,21 @@ nserror browser_window_history_add(struct browser_window *bw, if (bitmap == NULL) { LOG(("Creating thumbnail for %s", nsurl_access(nsurl))); bitmap = bitmap_create(WIDTH, HEIGHT, - BITMAP_NEW | BITMAP_CLEAR_MEMORY | - BITMAP_OPAQUE); - if ((bitmap != NULL) && - (thumbnail_create(content, bitmap, nsurl) == false)) { - /* Thumbnailing failed. Ignore it silently */ - bitmap_destroy(bitmap); - bitmap = NULL; + BITMAP_NEW | BITMAP_CLEAR_MEMORY | + BITMAP_OPAQUE); + if (bitmap != NULL) { + if (thumbnail_create(content, bitmap)) { + /* Successful thumbnail so register it + * with the url. + */ + urldb_set_thumbnail(nsurl, bitmap); + } else { + /* Thumbnailing failed. Ignore it + * silently but clean up bitmap. + */ + bitmap_destroy(bitmap); + bitmap = NULL; + } } } entry->bitmap = bitmap; @@ -555,7 +563,7 @@ nserror browser_window_history_update(struct browser_window *bw, free(history->current->page.title); history->current->page.title = title; - thumbnail_create(content, history->current->bitmap, NULL); + thumbnail_create(content, history->current->bitmap); return NSERROR_OK; } diff --git a/desktop/thumbnail.h b/desktop/thumbnail.h index ecf8fa6f2..ef31f7ec3 100644 --- a/desktop/thumbnail.h +++ b/desktop/thumbnail.h @@ -28,7 +28,6 @@ struct hlcache_handle; struct redraw_context; struct bitmap; -struct nsurl; /** * Redraw a content for thumbnailing @@ -51,7 +50,6 @@ bool thumbnail_redraw(struct hlcache_handle *content, int width, int height, /* In platform specific thumbnail.c. */ -bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap, - struct nsurl *url); +bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap); #endif diff --git a/framebuffer/thumbnail.c b/framebuffer/thumbnail.c index 616a59901..24067fd2f 100644 --- a/framebuffer/thumbnail.c +++ b/framebuffer/thumbnail.c @@ -34,8 +34,7 @@ bool thumbnail_create(struct hlcache_handle *content, - struct bitmap *bitmap, - nsurl *url) + struct bitmap *bitmap) { nsfb_t *tbm = (nsfb_t *)bitmap; /* target bitmap */ nsfb_t *bm; /* temporary bitmap */ @@ -94,9 +93,5 @@ thumbnail_create(struct hlcache_handle *content, nsfb_free(bm); - /* register the thumbnail with the URL */ - if (url != NULL) - urldb_set_thumbnail(url, bitmap); - return true; } diff --git a/gtk/thumbnail.c b/gtk/thumbnail.c index 89fc45fdc..2edb579d8 100644 --- a/gtk/thumbnail.c +++ b/gtk/thumbnail.c @@ -32,7 +32,6 @@ #include "utils/utils.h" #include "content/content.h" #include "content/hlcache.h" -#include "content/urldb.h" #include "desktop/plotters.h" #include "desktop/browser.h" #include "desktop/thumbnail.h" @@ -49,8 +48,7 @@ * \param bitmap the bitmap to draw to * \param url the URL the thumnail belongs to, or NULL */ -bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, - nsurl *url) +bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap) { cairo_surface_t *dsurface = bitmap->surface; cairo_surface_t *surface; @@ -120,10 +118,6 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, cairo_surface_destroy(surface); - /* register the thumbnail with the URL */ - if (url) - urldb_set_thumbnail(url, bitmap); - return true; } diff --git a/monkey/thumbnail.c b/monkey/thumbnail.c index 61f5ee611..b49944b12 100644 --- a/monkey/thumbnail.c +++ b/monkey/thumbnail.c @@ -23,9 +23,8 @@ #include "monkey/browser.h" -bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, - nsurl *url) +bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap) { - fprintf(stdout, "GENERIC THUMBNAIL URL %s\n", nsurl_access(url)); + fprintf(stdout, "GENERIC THUMBNAIL\n"); return false; } diff --git a/riscos/save.c b/riscos/save.c index b5d96c460..ee8bfc598 100644 --- a/riscos/save.c +++ b/riscos/save.c @@ -1370,7 +1370,7 @@ bool ro_gui_save_create_thumbnail(hlcache_handle *h, const char *name) LOG(("Thumbnail initialisation failed.")); return false; } - thumbnail_create(h, bitmap, NULL); + thumbnail_create(h, bitmap); area = thumbnail_convert_8bpp(bitmap); bitmap_destroy(bitmap); if (!area) { diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c index e259686f8..603c328b8 100644 --- a/riscos/thumbnail.c +++ b/riscos/thumbnail.c @@ -36,7 +36,6 @@ #include "utils/log.h" #include "content/content.h" #include "content/hlcache.h" -#include "content/urldb.h" #include "desktop/plotters.h" #include "desktop/thumbnail.h" #include "image/bitmap.h" @@ -79,8 +78,7 @@ static void thumbnail_restore_output(struct thumbnail_save_area *save_area); * \param bitmap the bitmap to draw to * \param url the URL the thumbnail belongs to, or NULL */ -bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, - nsurl *url) +bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap) { struct thumbnail_save_area *save_area; osspriteop_area *sprite_area = NULL; @@ -150,9 +148,6 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, return false; } - /* register the thumbnail with the URL */ - if (url) - urldb_set_thumbnail(url, bitmap); bitmap_modified(bitmap); return true; } diff --git a/riscos/window.c b/riscos/window.c index 6a2ae4467..759c0c281 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -3417,9 +3417,10 @@ void ro_gui_window_iconise(struct gui_window *g, LOG(("Thumbnail initialisation failed.")); return; } - thumbnail_create(h, bitmap, NULL); - if (overlay) + thumbnail_create(h, bitmap); + if (overlay) { bitmap_overlay_sprite(bitmap, overlay); + } area = thumbnail_convert_8bpp(bitmap); bitmap_destroy(bitmap); if (!area) { diff --git a/windows/gui.c b/windows/gui.c index 408cd49d4..0df219002 100644 --- a/windows/gui.c +++ b/windows/gui.c @@ -56,6 +56,8 @@ void win32_run(void) int timeout; /* timeout in miliseconds */ UINT timer_id = 0; + LOG(("Starting messgae dispatcher")); + while (!win32_quit) { /* run the scheduler and discover how long to wait for * the next event. diff --git a/windows/main.c b/windows/main.c index c762c52db..c5bb240fc 100644 --- a/windows/main.c +++ b/windows/main.c @@ -109,7 +109,7 @@ static struct gui_browser_table win32_browser_table = { /** - * Entry point from operating system + * Entry point from windows **/ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hLastInstance, LPSTR lpcli, int ncmd) diff --git a/windows/thumbnail.c b/windows/thumbnail.c index c4ef63c43..1fee8ccf1 100644 --- a/windows/thumbnail.c +++ b/windows/thumbnail.c @@ -20,10 +20,9 @@ #include <windows.h> -#include "content/urldb.h" +#include "utils/log.h" #include "desktop/browser.h" #include "desktop/thumbnail.h" -#include "utils/log.h" #include "image/bitmap.h" #include "windows/bitmap.h" @@ -34,26 +33,24 @@ bool thumbnail_create(hlcache_handle *content, - struct bitmap *bitmap, - nsurl *url) + struct bitmap *bitmap) { int width; int height; HDC hdc, bufferdc, minidc; + struct bitmap *fsbitmap; struct redraw_context ctx = { .interactive = false, .background_images = true, .plot = &win_plotters }; - struct bitmap *fsbitmap; - width = min(content_get_width(content), 1024); height = ((width * bitmap->height) + (bitmap->width / 2)) / bitmap->width; - LOG(("bitmap %p for url %s content %p width %d, height %d", - bitmap, nsurl_access(url), content, width, height)); + LOG(("bitmap %p for content %p width %d, height %d", + bitmap, content, width, height)); /* create two memory device contexts to put the bitmaps in */ bufferdc = CreateCompatibleDC(NULL); @@ -87,9 +84,6 @@ thumbnail_create(hlcache_handle *content, DeleteDC(bufferdc); DeleteDC(minidc); bitmap_destroy(fsbitmap); - - if (url) - urldb_set_thumbnail(url, bitmap); return true; } |