mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-17 17:52:43 +03:00
change browser history to use bitmap render interface for thumbnails
This commit is contained in:
parent
8ccbc960d3
commit
ee78742363
@ -41,7 +41,6 @@
|
|||||||
#include "desktop/browser_history.h"
|
#include "desktop/browser_history.h"
|
||||||
#include "desktop/browser_private.h"
|
#include "desktop/browser_private.h"
|
||||||
#include "desktop/plotters.h"
|
#include "desktop/plotters.h"
|
||||||
#include "desktop/thumbnail.h"
|
|
||||||
#include "desktop/font.h"
|
#include "desktop/font.h"
|
||||||
|
|
||||||
#define WIDTH 100
|
#define WIDTH 100
|
||||||
@ -281,13 +280,18 @@ browser_window_history__redraw_entry(struct history *history,
|
|||||||
rect.y0 = y0 + yoffset;
|
rect.y0 = y0 + yoffset;
|
||||||
rect.x1 = x1 + xoffset;
|
rect.x1 = x1 + xoffset;
|
||||||
rect.y1 = y1 + yoffset;
|
rect.y1 = y1 + yoffset;
|
||||||
if(!plot->clip(&rect))
|
if (!plot->clip(&rect)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!plot->bitmap(entry->x + xoffset, entry->y + yoffset, WIDTH, HEIGHT,
|
/* Only attempt to plot bitmap if it is present */
|
||||||
entry->bitmap, 0xffffff, 0))
|
if (entry->bitmap != NULL) {
|
||||||
return false;
|
plot->bitmap(entry->x + xoffset,
|
||||||
|
entry->y + yoffset,
|
||||||
|
WIDTH, HEIGHT,
|
||||||
|
entry->bitmap, 0xffffff, 0);
|
||||||
|
}
|
||||||
if (!plot->rectangle(entry->x - 1 + xoffset,
|
if (!plot->rectangle(entry->x - 1 + xoffset,
|
||||||
entry->y - 1 + yoffset,
|
entry->y - 1 + yoffset,
|
||||||
entry->x + xoffset + WIDTH,
|
entry->x + xoffset + WIDTH,
|
||||||
@ -466,6 +470,7 @@ nserror browser_window_history_add(struct browser_window *bw,
|
|||||||
nsurl *nsurl = hlcache_handle_get_url(content);
|
nsurl *nsurl = hlcache_handle_get_url(content);
|
||||||
char *title;
|
char *title;
|
||||||
struct bitmap *bitmap;
|
struct bitmap *bitmap;
|
||||||
|
nserror ret;
|
||||||
|
|
||||||
assert(bw);
|
assert(bw);
|
||||||
assert(bw->history);
|
assert(bw->history);
|
||||||
@ -516,7 +521,8 @@ nserror browser_window_history_add(struct browser_window *bw,
|
|||||||
BITMAP_NEW | BITMAP_CLEAR_MEMORY |
|
BITMAP_NEW | BITMAP_CLEAR_MEMORY |
|
||||||
BITMAP_OPAQUE);
|
BITMAP_OPAQUE);
|
||||||
if (bitmap != NULL) {
|
if (bitmap != NULL) {
|
||||||
if (thumbnail_create(content, bitmap)) {
|
ret = guit->bitmap->render(bitmap, content);
|
||||||
|
if (ret == NSERROR_OK) {
|
||||||
/* Successful thumbnail so register it
|
/* Successful thumbnail so register it
|
||||||
* with the url.
|
* with the url.
|
||||||
*/
|
*/
|
||||||
@ -525,7 +531,7 @@ nserror browser_window_history_add(struct browser_window *bw,
|
|||||||
/* Thumbnailing failed. Ignore it
|
/* Thumbnailing failed. Ignore it
|
||||||
* silently but clean up bitmap.
|
* silently but clean up bitmap.
|
||||||
*/
|
*/
|
||||||
LOG(("Thumbnail bitmap creation failed"));
|
LOG(("Thumbnail renderfailed"));
|
||||||
guit->bitmap->destroy(bitmap);
|
guit->bitmap->destroy(bitmap);
|
||||||
bitmap = NULL;
|
bitmap = NULL;
|
||||||
}
|
}
|
||||||
@ -565,7 +571,7 @@ nserror browser_window_history_update(struct browser_window *bw,
|
|||||||
free(history->current->page.title);
|
free(history->current->page.title);
|
||||||
history->current->page.title = title;
|
history->current->page.title = title;
|
||||||
|
|
||||||
thumbnail_create(content, history->current->bitmap);
|
guit->bitmap->render(history->current->bitmap, content);
|
||||||
|
|
||||||
return NSERROR_OK;
|
return NSERROR_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user