summaryrefslogtreecommitdiff
path: root/frontends/amiga/corewindow.c
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/amiga/corewindow.c')
-rw-r--r--frontends/amiga/corewindow.c65
1 files changed, 40 insertions, 25 deletions
diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c
index 0ed16d1ee..42ee866ea 100644
--- a/frontends/amiga/corewindow.c
+++ b/frontends/amiga/corewindow.c
@@ -47,6 +47,7 @@
#include "netsurf/plot_style.h"
#include <proto/exec.h>
+#include <proto/graphics.h>
#include <proto/intuition.h>
#include <proto/layout.h>
#include <proto/utility.h>
@@ -202,15 +203,16 @@ ami_cw_key(struct ami_corewindow *ami_cw, int nskey)
/**
* Redraw functions
*
- * This is slightly over-engineered as it was taken from the main browser/old tree redraws
- * and supports deferred drawing of rectangles and tiling
+ * This is slightly over-engineered as it was taken from the main
+ * browser/old tree redraws and supports deferred drawing of
+ * rectangles and tiling
*/
/**
* Redraw an area of a core window
*
- * \param g a struct ami_corewindow
- * \param r rect (in document co-ordinates)
+ * \param ami_cw An Amiga core window structure
+ * \param r rect (in document co-ordinates)
*/
static void
@@ -219,8 +221,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
struct IBox *bbox;
ULONG pos_x, pos_y;
struct rect draw_rect;
- int tile_size_x = ami_cw->gg.width;
- int tile_size_y = ami_cw->gg.height;
+ int tile_size_x;
+ int tile_size_y;
int tile_x, tile_y, tile_w, tile_h;
int x = r->x0;
int y = r->y0;
@@ -230,7 +232,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
struct redraw_context ctx = {
.interactive = true,
.background_images = true,
- .plot = &amiplot
+ .plot = &amiplot,
+ .priv = ami_cw->gg
};
if(ami_gui_get_space_box((Object *)ami_cw->objects[GID_CW_DRAW], &bbox) != NSERROR_OK) {
@@ -240,8 +243,6 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
ami_cw_scroller_top(ami_cw, &pos_x, &pos_y);
- glob = &ami_cw->gg;
-
if(x - pos_x + width > bbox->Width) width = bbox->Width - (x - pos_x);
if(y - pos_y + height > bbox->Height) height = bbox->Height - (y - pos_y);
@@ -255,6 +256,8 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
y = pos_y;
}
+ ami_plot_ra_get_size(ami_cw->gg, &tile_size_x, &tile_size_y);
+
for(tile_y = y; tile_y < (y + height); tile_y += tile_size_y) {
tile_h = tile_size_y;
if(((y + height) - tile_y) < tile_size_y)
@@ -274,7 +277,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
#ifdef __amigaos4__
BltBitMapTags(BLITA_SrcType, BLITT_BITMAP,
- BLITA_Source, ami_cw->gg.bm,
+ BLITA_Source, ami_plot_ra_get_bitmap(ami_cw->gg),
BLITA_SrcX, 0,
BLITA_SrcY, 0,
BLITA_DestType, BLITT_RASTPORT,
@@ -285,7 +288,7 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
BLITA_Height, tile_h,
TAG_DONE);
#else
- BltBitMapRastPort(ami_cw->gg.bm, 0, 0,
+ BltBitMapRastPort(ami_plot_ra_get_bitmap(ami_cw->gg), 0, 0,
ami_cw->win->RPort, bbox->Left + tile_x - pos_x, bbox->Top + tile_y - pos_y,
tile_w, tile_h, 0xC0);
#endif
@@ -293,15 +296,15 @@ ami_cw_redraw_rect(struct ami_corewindow *ami_cw, struct rect *r)
}
ami_gui_free_space_box(bbox);
- ami_clearclipreg(glob);
- ami_gui_set_default_gg();
+ ami_clearclipreg(ami_cw->gg);
}
/**
* Draw the deferred rectangles
*
- * @param draw set to false to just delete the queue
+ * \param ami_cw An Amiga core window structure to queue redraw
+ * \param draw set to false to just delete the queue
*/
static void ami_cw_redraw_queue(struct ami_corewindow *ami_cw, bool draw)
{
@@ -312,7 +315,7 @@ static void ami_cw_redraw_queue(struct ami_corewindow *ami_cw, bool draw)
if(IsMinListEmpty(ami_cw->deferred_rects)) return;
if(draw == false) {
- LOG("Ignoring deferred box redraw queue");
+ NSLOG(netsurf, INFO, "Ignoring deferred box redraw queue");
} // else should probably show busy pointer
node = (struct nsObject *)GetHead((struct List *)ami_cw->deferred_rects);
@@ -375,7 +378,8 @@ ami_cw_redraw(struct ami_corewindow *ami_cw, const struct rect *restrict r)
nsobj = AddObject(ami_cw->deferred_rects, AMINS_RECT);
nsobj->objstruct = deferred_rect;
} else {
- LOG("Ignoring duplicate or subset of queued box redraw");
+ NSLOG(netsurf, INFO,
+ "Ignoring duplicate or subset of queued box redraw");
}
ami_schedule(1, ami_cw_redraw_cb, ami_cw);
}
@@ -522,7 +526,8 @@ HOOKF(void, ami_cw_idcmp_hook, Object *, object, struct IntuiMessage *)
break;
default:
- LOG("IDCMP hook unhandled event: %ld", msg->Class);
+ NSLOG(netsurf, INFO,
+ "IDCMP hook unhandled event: %ld", msg->Class);
break;
}
}
@@ -794,15 +799,26 @@ static const struct ami_win_event_table ami_cw_table = {
ami_cw_close,
};
+
/**
- * callback from core to request a redraw
+ * callback from core to request an invalidation of a amiga core window area.
+ *
+ * The specified area of the window should now be considered
+ * out of date. If the area is NULL the entire window must be
+ * invalidated.
+ *
+ * \param[in] cw The core window to invalidate.
+ * \param[in] r area to redraw or NULL for the entire window area.
+ * \return NSERROR_OK on success or appropriate error code.
*/
-static void
-ami_cw_redraw_request(struct core_window *cw, const struct rect *r)
+static nserror
+ami_cw_invalidate_area(struct core_window *cw, const struct rect *r)
{
struct ami_corewindow *ami_cw = (struct ami_corewindow *)cw;
ami_cw_redraw(ami_cw, r);
+
+ return NSERROR_OK;
}
@@ -894,7 +910,7 @@ ami_cw_drag_status(struct core_window *cw, core_window_drag_status ds)
struct core_window_callback_table ami_cw_cb_table = {
- .redraw_request = ami_cw_redraw_request,
+ .invalidate = ami_cw_invalidate_area,
.update_size = ami_cw_update_size,
.scroll_visible = ami_cw_scroll_visible,
.get_window_dimensions = ami_cw_get_window_dimensions,
@@ -906,6 +922,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
{
/* setup the core window callback table */
ami_cw->cb_table = &ami_cw_cb_table;
+ ami_cw->drag_status = CORE_WINDOW_DRAG_NONE;
/* clear some vars */
ami_cw->mouse_state = BROWSER_MOUSE_HOVER;
@@ -917,8 +934,7 @@ nserror ami_corewindow_init(struct ami_corewindow *ami_cw)
ami_cw->dragging = false;
/* allocate drawing area etc */
- ami_init_layers(&ami_cw->gg, 100, 100, false); // force tiles to save memory
- ami_cw->gg.shared_pens = ami_AllocMinList();
+ ami_cw->gg = ami_plot_ra_alloc(100, 100, false, true); // force tiles to save memory
ami_cw->deferred_rects = NewObjList();
ami_cw->deferred_rects_pool = ami_memory_itempool_create(sizeof(struct rect));
@@ -988,8 +1004,7 @@ nserror ami_corewindow_fini(struct ami_corewindow *ami_cw)
#endif
/* release off-screen bitmap stuff */
- ami_plot_release_pens(ami_cw->gg.shared_pens);
- ami_free_layers(&ami_cw->gg);
+ ami_plot_ra_free(ami_cw->gg);
/* free the window title */
ami_utf8_free(ami_cw->wintitle);