mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 05:27:00 +03:00
Remove knockout from html_redraw, and use it in browser_window_redraw and thumbnail_redraw.
svn path=/trunk/netsurf/; revision=11746
This commit is contained in:
parent
1b5d9f07c8
commit
cd40c260b9
@ -48,6 +48,7 @@
|
||||
#include "desktop/history_core.h"
|
||||
#include "desktop/hotlist.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/knockout.h"
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "desktop/textinput.h"
|
||||
@ -94,20 +95,26 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
{
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
bool plot_ok = true;
|
||||
|
||||
if (bw == NULL) {
|
||||
LOG(("NULL browser window"));
|
||||
return false;
|
||||
}
|
||||
|
||||
plot.clip(clip);
|
||||
|
||||
if (bw->current_content == NULL) {
|
||||
/* Browser window has no content, render blank fill */
|
||||
plot.clip(clip);
|
||||
return plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
|
||||
plot_style_fill_white);
|
||||
|
||||
}
|
||||
|
||||
/* Browser window has content */
|
||||
if (plot.option_knockout)
|
||||
knockout_plot_start(&plot);
|
||||
|
||||
plot.clip(clip);
|
||||
|
||||
if (content_get_type(bw->current_content) != CONTENT_HTML) {
|
||||
/* Set render area according to scale */
|
||||
width = content_get_width(bw->current_content) * bw->scale;
|
||||
@ -115,12 +122,18 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
|
||||
/* Non-HTML may not fill viewport to extents, so plot white
|
||||
* background fill */
|
||||
plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
|
||||
plot_style_fill_white);
|
||||
plot_ok &= plot.rectangle(clip->x0, clip->y0,
|
||||
clip->x1, clip->y1, plot_style_fill_white);
|
||||
}
|
||||
|
||||
return content_redraw(bw->current_content, x, y, width, height,
|
||||
clip, bw->scale, 0xFFFFFF);
|
||||
/* Render the content */
|
||||
plot_ok &= content_redraw(bw->current_content, x, y, width, height,
|
||||
clip, bw->scale, 0xFFFFFF);
|
||||
|
||||
if (plot.option_knockout)
|
||||
knockout_plot_end();
|
||||
|
||||
return plot_ok;
|
||||
}
|
||||
|
||||
/* exported interface, documented in browser.h */
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "content/content.h"
|
||||
#include "content/hlcache.h"
|
||||
#include "desktop/browser.h"
|
||||
#include "desktop/knockout.h"
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/plotters.h"
|
||||
#include "desktop/thumbnail.h"
|
||||
@ -38,9 +39,13 @@ bool thumbnail_redraw(struct hlcache_handle *content,
|
||||
{
|
||||
struct rect clip;
|
||||
float scale;
|
||||
bool plot_ok = true;
|
||||
|
||||
assert(content);
|
||||
|
||||
if (plot.option_knockout)
|
||||
knockout_plot_start(&plot);
|
||||
|
||||
/* No selection */
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
@ -53,15 +58,20 @@ bool thumbnail_redraw(struct hlcache_handle *content,
|
||||
plot.clip(&clip);
|
||||
|
||||
/* Plot white background */
|
||||
plot.rectangle(clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
plot_ok &= plot.rectangle(clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
plot_style_fill_white);
|
||||
|
||||
/* Find the scale we're using */
|
||||
scale = thumbnail_get_redraw_scale(content, width);
|
||||
|
||||
/* Render the content */
|
||||
return content_redraw(content, 0, 0, width, height, &clip, scale,
|
||||
0xFFFFFF);
|
||||
plot_ok &= content_redraw(content, 0, 0, width, height, &clip, scale,
|
||||
0xFFFFFF);
|
||||
|
||||
if (plot.option_knockout)
|
||||
knockout_plot_end();
|
||||
|
||||
return plot_ok;
|
||||
}
|
||||
|
||||
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "css/utils.h"
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/plotters.h"
|
||||
#include "desktop/knockout.h"
|
||||
#include "desktop/selection.h"
|
||||
#include "desktop/textinput.h"
|
||||
#include "desktop/options.h"
|
||||
@ -116,7 +115,7 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
struct box *box;
|
||||
bool result = true, want_knockout;
|
||||
bool result = true;
|
||||
bool select, select_only;
|
||||
plot_style_t pstyle_fill_bg = {
|
||||
.fill_type = PLOT_OP_TYPE_SOLID,
|
||||
@ -126,10 +125,6 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
box = c->data.html.layout;
|
||||
assert(box);
|
||||
|
||||
want_knockout = plot.option_knockout;
|
||||
if (want_knockout)
|
||||
knockout_plot_start(&plot);
|
||||
|
||||
/* The select menu needs special treating because, when opened, it
|
||||
* reaches beyond its layout box.
|
||||
*/
|
||||
@ -174,9 +169,6 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
x + menu_x, y + menu_y,
|
||||
current_redraw_browser->scale, clip);
|
||||
}
|
||||
|
||||
if (want_knockout)
|
||||
knockout_plot_end();
|
||||
|
||||
return result;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user