Pass clip rect to browser_window_redraw as struct.
svn path=/trunk/netsurf/; revision=11648
This commit is contained in:
parent
27b6096dcd
commit
fedcbf6656
|
@ -123,8 +123,9 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view )
|
|||
|
||||
- (void)drawRect:(NSRect)dirtyRect;
|
||||
{
|
||||
struct rect clip;
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
|
||||
current_redraw_browser = browser;
|
||||
cocoa_set_font_scale_factor( browser->scale );
|
||||
|
||||
|
@ -135,11 +136,12 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view )
|
|||
[self getRectsBeingDrawn: &rects count: &count];
|
||||
|
||||
for (NSInteger i = 0; i < count; i++) {
|
||||
browser_window_redraw(browser, 0, 0,
|
||||
cocoa_pt_to_px( NSMinX( rects[i] ) ),
|
||||
cocoa_pt_to_px( NSMinY( rects[i] ) ),
|
||||
cocoa_pt_to_px( NSMaxX( rects[i] ) ),
|
||||
cocoa_pt_to_px( NSMaxY( rects[i] ) ));
|
||||
clip.x0 = cocoa_pt_to_px( NSMinX( rects[i] ) );
|
||||
clip.y0 = cocoa_pt_to_px( NSMinY( rects[i] ) );
|
||||
clip.x1 = cocoa_pt_to_px( NSMaxX( rects[i] ) );
|
||||
clip.y1 = cocoa_pt_to_px( NSMaxY( rects[i] ) );
|
||||
|
||||
browser_window_redraw(browser, 0, 0, clip);
|
||||
}
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
|
|
|
@ -89,10 +89,8 @@ static void browser_window_find_target_internal(struct browser_window *bw,
|
|||
int *rdepth, struct browser_window **bw_target);
|
||||
|
||||
/* exported interface, documented in browser.h */
|
||||
bool browser_window_redraw(struct browser_window *bw,
|
||||
int x, int y,
|
||||
int clip_x0, int clip_y0,
|
||||
int clip_x1, int clip_y1)
|
||||
bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
struct rect clip)
|
||||
{
|
||||
int width = 0;
|
||||
int height = 0;
|
||||
|
@ -102,10 +100,11 @@ bool browser_window_redraw(struct browser_window *bw,
|
|||
return false;
|
||||
}
|
||||
|
||||
plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
|
||||
plot.clip(clip.x0, clip.y0, clip.x1, clip.y1);
|
||||
|
||||
if (bw->current_content == NULL) {
|
||||
return plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white);
|
||||
return plot.rectangle(clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
plot_style_fill_white);
|
||||
|
||||
}
|
||||
|
||||
|
@ -115,7 +114,7 @@ bool browser_window_redraw(struct browser_window *bw,
|
|||
}
|
||||
|
||||
return content_redraw(bw->current_content, x, y, width, height,
|
||||
clip_x0, clip_y0, clip_x1, clip_y1,
|
||||
clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
bw->scale, 0xFFFFFF);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "desktop/gui.h"
|
||||
#include "desktop/mouse.h"
|
||||
#include "desktop/shape.h"
|
||||
#include "render/html.h"
|
||||
|
||||
struct box;
|
||||
|
@ -256,13 +257,10 @@ bool browser_window_stop_available(struct browser_window *bw);
|
|||
*
|
||||
* Calls the redraw function for the content,
|
||||
*
|
||||
* \param bw The window to redraw
|
||||
* \param x coordinate for top-left of redraw
|
||||
* \param y coordinate for top-left of redraw
|
||||
* \param clip_x0 clip rectangle left
|
||||
* \param clip_y0 clip rectangle top
|
||||
* \param clip_x1 clip rectangle right
|
||||
* \param clip_y1 clip rectangle bottom
|
||||
* \param bw The window to redraw
|
||||
* \param x coordinate for top-left of redraw
|
||||
* \param y coordinate for top-left of redraw
|
||||
* \param clip clip rectangle coordinates
|
||||
* \return true if successful, false otherwise
|
||||
*
|
||||
* x, y and clip_* are coordinates from the top left of the canvas area.
|
||||
|
@ -271,10 +269,8 @@ bool browser_window_stop_available(struct browser_window *bw);
|
|||
* the bottom right corner of the clip rectangle is (clip_x1, clip_y1).
|
||||
* Units for x, y and clip_* are pixels.
|
||||
*/
|
||||
bool browser_window_redraw(struct browser_window *bw,
|
||||
int x, int y,
|
||||
int clip_x0, int clip_y0,
|
||||
int clip_x1, int clip_y1);
|
||||
bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
struct rect clip);
|
||||
|
||||
/* In platform specific hotlist.c. */
|
||||
void hotlist_visited(struct hlcache_handle *c);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "desktop/plotters.h"
|
||||
#include "desktop/netsurf.h"
|
||||
#include "desktop/options.h"
|
||||
#include "desktop/shape.h"
|
||||
#include "utils/log.h"
|
||||
#include "utils/url.h"
|
||||
#include "utils/messages.h"
|
||||
|
@ -302,6 +303,7 @@ fb_redraw(fbtk_widget_t *widget,
|
|||
{
|
||||
int x;
|
||||
int y;
|
||||
struct rect clip;
|
||||
|
||||
LOG(("%d,%d to %d,%d",
|
||||
bwidget->redraw_box.x0,
|
||||
|
@ -323,10 +325,14 @@ fb_redraw(fbtk_widget_t *widget,
|
|||
/* redraw bounding box is relative to window */
|
||||
current_redraw_browser = bw;
|
||||
|
||||
clip.x0 = bwidget->redraw_box.x0;
|
||||
clip.y0 = bwidget->redraw_box.y0;
|
||||
clip.x1 = bwidget->redraw_box.x1;
|
||||
clip.y1 = bwidget->redraw_box.y1;
|
||||
|
||||
browser_window_redraw(bw,
|
||||
x - bwidget->scrollx, y - bwidget->scrolly,
|
||||
bwidget->redraw_box.x0, bwidget->redraw_box.y0,
|
||||
bwidget->redraw_box.x1, bwidget->redraw_box.y1);
|
||||
clip);
|
||||
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
|
|
11
gtk/window.c
11
gtk/window.c
|
@ -157,6 +157,7 @@ static gboolean nsgtk_window_expose_event(GtkWidget *widget,
|
|||
{
|
||||
struct gui_window *g = data;
|
||||
struct gui_window *z;
|
||||
struct rect clip;
|
||||
|
||||
assert(g);
|
||||
assert(g->bw);
|
||||
|
@ -178,10 +179,12 @@ static gboolean nsgtk_window_expose_event(GtkWidget *widget,
|
|||
nsgtk_plot_set_scale(g->bw->scale);
|
||||
current_redraw_browser = g->bw;
|
||||
|
||||
browser_window_redraw(g->bw, 0, 0,
|
||||
event->area.x, event->area.y,
|
||||
event->area.x + event->area.width,
|
||||
event->area.y + event->area.height);
|
||||
clip.x0 = event->area.x;
|
||||
clip.y0 = event->area.y;
|
||||
clip.x1 = event->area.x + event->area.width;
|
||||
clip.y1 = event->area.y + event->area.height;
|
||||
|
||||
browser_window_redraw(g->bw, 0, 0, clip);
|
||||
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
|
|
|
@ -1455,7 +1455,7 @@ void ro_gui_window_redraw(wimp_draw *redraw)
|
|||
return;
|
||||
}
|
||||
while (more) {
|
||||
int clip_x0, clip_y0, clip_x1, clip_y1;
|
||||
struct rect clip;
|
||||
|
||||
/* OS's redraw request coordinates are in screen coordinates,
|
||||
* with an origin at the bottom left of the screen.
|
||||
|
@ -1468,17 +1468,18 @@ void ro_gui_window_redraw(wimp_draw *redraw)
|
|||
/* Convert OS redraw rectangle request coordinates into NetSurf
|
||||
* coordinates. NetSurf coordinates have origin at top left of
|
||||
* document and units are in px. */
|
||||
clip_x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; /* left */
|
||||
clip_y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; /* top */
|
||||
clip_x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; /* right */
|
||||
clip_y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; /* bottom */
|
||||
clip.x0 = (redraw->clip.x0 - ro_plot_origin_x) / 2; /* left */
|
||||
clip.y0 = (ro_plot_origin_y - redraw->clip.y1) / 2; /* top */
|
||||
clip.x1 = (redraw->clip.x1 - ro_plot_origin_x) / 2; /* right */
|
||||
clip.y1 = (ro_plot_origin_y - redraw->clip.y0) / 2; /* bottom */
|
||||
|
||||
if (ro_gui_current_redraw_gui->option.buffer_everything)
|
||||
ro_gui_buffer_open(redraw);
|
||||
|
||||
plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white);
|
||||
plot.rectangle(clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
plot_style_fill_white);
|
||||
|
||||
browser_window_redraw(g->bw, 0, 0, clip_x0, clip_y0, clip_x1, clip_y1);
|
||||
browser_window_redraw(g->bw, 0, 0, clip);
|
||||
|
||||
if (ro_gui_current_redraw_gui->option.buffer_everything)
|
||||
ro_gui_buffer_close();
|
||||
|
@ -1530,7 +1531,7 @@ void ro_gui_window_update_boxes(void) {
|
|||
osbool more;
|
||||
bool use_buffer;
|
||||
wimp_draw update;
|
||||
int clip_x0, clip_y0, clip_x1, clip_y1;
|
||||
struct rect clip;
|
||||
os_error *error;
|
||||
struct update_box *cur;
|
||||
struct gui_window *g;
|
||||
|
@ -1568,17 +1569,18 @@ void ro_gui_window_update_boxes(void) {
|
|||
ro_plot_set_scale(g->bw->scale);
|
||||
|
||||
while (more) {
|
||||
clip_x0 = (update.clip.x0 - ro_plot_origin_x) / 2;
|
||||
clip_y0 = (ro_plot_origin_y - update.clip.y1) / 2;
|
||||
clip_x1 = (update.clip.x1 - ro_plot_origin_x) / 2;
|
||||
clip_y1 = (ro_plot_origin_y - update.clip.y0) / 2;
|
||||
clip.x0 = (update.clip.x0 - ro_plot_origin_x) / 2;
|
||||
clip.y0 = (ro_plot_origin_y - update.clip.y1) / 2;
|
||||
clip.x1 = (update.clip.x1 - ro_plot_origin_x) / 2;
|
||||
clip.y1 = (ro_plot_origin_y - update.clip.y0) / 2;
|
||||
|
||||
if (use_buffer)
|
||||
ro_gui_buffer_open(&update);
|
||||
|
||||
plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white);
|
||||
plot.rectangle(clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
plot_style_fill_white);
|
||||
|
||||
browser_window_redraw(g->bw, 0, 0, clip_x0, clip_y0, clip_x1, clip_y1);
|
||||
browser_window_redraw(g->bw, 0, 0, clip);
|
||||
|
||||
if (use_buffer)
|
||||
ro_gui_buffer_close();
|
||||
|
|
|
@ -879,18 +879,21 @@ nsws_drawable_mouseup(struct gui_window *gw,
|
|||
static LRESULT
|
||||
nsws_drawable_paint(struct gui_window *gw, HWND hwnd)
|
||||
{
|
||||
struct rect clip;
|
||||
PAINTSTRUCT ps;
|
||||
|
||||
plot_hdc = BeginPaint(hwnd, &ps);
|
||||
|
||||
if (gw != NULL) {
|
||||
clip.x0 = ps.rcPaint.left;
|
||||
clip.y0 = ps.rcPaint.top;
|
||||
clip.x1 = ps.rcPaint.right;
|
||||
clip.y1 = ps.rcPaint.bottom;
|
||||
|
||||
browser_window_redraw(gw->bw,
|
||||
-gw->scrollx / gw->bw->scale,
|
||||
-gw->scrolly / gw->bw->scale,
|
||||
ps.rcPaint.left,
|
||||
ps.rcPaint.top,
|
||||
ps.rcPaint.right,
|
||||
ps.rcPaint.bottom);
|
||||
clip);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue