improve browser_window_redraw width and height handling

svn path=/trunk/netsurf/; revision=11642
This commit is contained in:
Vincent Sanders 2011-02-11 00:14:22 +00:00
parent 2a8e8a5cf1
commit 9a183018ea
6 changed files with 9 additions and 27 deletions

View File

@ -136,8 +136,6 @@ static inline NSRect cocoa_get_caret_rect( BrowserView *view )
for (NSInteger i = 0; i < count; i++) {
browser_window_redraw(browser, 0, 0,
cocoa_pt_to_px( NSWidth( frame ) ),
cocoa_pt_to_px( NSHeight( frame ) ),
cocoa_pt_to_px( NSMinX( rects[i] ) ),
cocoa_pt_to_px( NSMinY( rects[i] ) ),
cocoa_pt_to_px( NSMaxX( rects[i] ) ),

View File

@ -91,10 +91,12 @@ static void browser_window_find_target_internal(struct browser_window *bw,
/* exported interface, documented in browser.h */
bool browser_window_redraw(struct browser_window *bw,
int x, int y,
int width, int height,
int clip_x0, int clip_y0,
int clip_x1, int clip_y1)
{
int width = 0;
int height = 0;
if (bw == NULL) {
LOG(("NULL browser window"));
return false;
@ -106,6 +108,11 @@ bool browser_window_redraw(struct browser_window *bw,
return plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white);
}
if (content_get_type(bw->current_content) != CONTENT_HTML) {
width = content_get_width(bw->current_content) * bw->scale;
height = content_get_height(bw->current_content) * bw->scale;
}
return content_redraw(bw->current_content, x, y, width, height,
clip_x0, clip_y0, clip_x1, clip_y1,

View File

@ -259,8 +259,6 @@ bool browser_window_stop_available(struct browser_window *bw);
* \param bw The window to redraw
* \param x coordinate for top-left of redraw
* \param y coordinate for top-left of redraw
* \param width available width (not used for HTML redraw)
* \param height available height (not used for HTML redraw)
* \param clip_x0 clip rectangle left
* \param clip_y0 clip rectangle top
* \param clip_x1 clip rectangle right
@ -275,7 +273,6 @@ bool browser_window_stop_available(struct browser_window *bw);
*/
bool browser_window_redraw(struct browser_window *bw,
int x, int y,
int width, int height,
int clip_x0, int clip_y0,
int clip_x1, int clip_y1);

View File

@ -302,8 +302,6 @@ fb_redraw(fbtk_widget_t *widget,
{
int x;
int y;
int width;
int height;
LOG(("%d,%d to %d,%d",
bwidget->redraw_box.x0,
@ -311,8 +309,6 @@ fb_redraw(fbtk_widget_t *widget,
bwidget->redraw_box.x1,
bwidget->redraw_box.y1));
height = fbtk_get_height(widget);
width = fbtk_get_width(widget);
x = fbtk_get_absx(widget);
y = fbtk_get_absy(widget);
@ -329,7 +325,6 @@ fb_redraw(fbtk_widget_t *widget,
browser_window_redraw(bw,
x - bwidget->scrollx, y - bwidget->scrolly,
width, height,
bwidget->redraw_box.x0, bwidget->redraw_box.y0,
bwidget->redraw_box.x1, bwidget->redraw_box.y1);

View File

@ -157,8 +157,6 @@ static gboolean nsgtk_window_expose_event(GtkWidget *widget,
{
struct gui_window *g = data;
struct gui_window *z;
int width = 0;
int height = 0;
assert(g);
assert(g->bw);
@ -168,17 +166,6 @@ static gboolean nsgtk_window_expose_event(GtkWidget *widget,
assert(z);
assert(GTK_WIDGET(g->layout) == widget);
/* set the width and height to use */
if (g->bw->current_content != NULL) {
width = content_get_width(g->bw->current_content);
height = content_get_height(g->bw->current_content);
if (content_get_type(g->bw->current_content) != CONTENT_HTML) {
/* HTML rendering handles scale itself */
width *= g->bw->scale;
height *= g->bw->scale;
}
}
current_widget = (GtkWidget *)g->layout;
current_drawable = g->layout->bin_window;
@ -191,7 +178,7 @@ 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, width, height,
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);

View File

@ -887,8 +887,6 @@ nsws_drawable_paint(struct gui_window *gw, HWND hwnd)
browser_window_redraw(gw->bw,
-gw->scrollx / gw->bw->scale,
-gw->scrolly / gw->bw->scale,
gw->width,
gw->height,
ps.rcPaint.left,
ps.rcPaint.top,
ps.rcPaint.right,