summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2011-02-11 00:14:22 +0000
committerVincent Sanders <vince@netsurf-browser.org>2011-02-11 00:14:22 +0000
commit9a183018ea9c7d58a6aa71a2afb92271c4207e01 (patch)
tree469c6efd35b035c954b13d2624377ede29858e74
parent2a8e8a5cf10a22d47dd7ba8701b2b97b317c26ff (diff)
downloadnetsurf-9a183018ea9c7d58a6aa71a2afb92271c4207e01.tar.gz
netsurf-9a183018ea9c7d58a6aa71a2afb92271c4207e01.tar.bz2
improve browser_window_redraw width and height handling
svn path=/trunk/netsurf/; revision=11642
-rw-r--r--cocoa/BrowserView.m2
-rw-r--r--desktop/browser.c9
-rw-r--r--desktop/browser.h3
-rw-r--r--framebuffer/gui.c5
-rw-r--r--gtk/window.c15
-rw-r--r--windows/gui.c2
6 files changed, 9 insertions, 27 deletions
diff --git a/cocoa/BrowserView.m b/cocoa/BrowserView.m
index 4e728c867..d9d594aa9 100644
--- a/cocoa/BrowserView.m
+++ b/cocoa/BrowserView.m
@@ -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] ) ),
diff --git a/desktop/browser.c b/desktop/browser.c
index 1ffc12e29..553baefc3 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -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,
diff --git a/desktop/browser.h b/desktop/browser.h
index 2c16c9732..e2410ae95 100644
--- a/desktop/browser.h
+++ b/desktop/browser.h
@@ -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);
diff --git a/framebuffer/gui.c b/framebuffer/gui.c
index f389d85d7..b9fbb69d3 100644
--- a/framebuffer/gui.c
+++ b/framebuffer/gui.c
@@ -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);
diff --git a/gtk/window.c b/gtk/window.c
index 06bc97df0..488423bcb 100644
--- a/gtk/window.c
+++ b/gtk/window.c
@@ -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);
diff --git a/windows/gui.c b/windows/gui.c
index d5b31a82f..bb0307eba 100644
--- a/windows/gui.c
+++ b/windows/gui.c
@@ -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,