bool artworks_redraw(struct content *c, struct content_redraw_data *data, const struct rect *clip, const struct redraw_context *ctx) { static const ns_os_vdu_var_list vars = { os_MODEVAR_XEIG_FACTOR, { os_MODEVAR_YEIG_FACTOR, os_MODEVAR_LOG2_BPP, os_VDUVAR_END_LIST } }; artworks_content *aw = (artworks_content *) c; struct awinfo_block info; const char *source_data; unsigned long source_size; os_error *error; os_trfm matrix; int vals[24]; int clip_x0 = clip->x0; int clip_y0 = clip->y0; int clip_x1 = clip->x1; int clip_y1 = clip->y1; if (ctx->plot->flush && !ctx->plot->flush()) return false; /* pick up render addresses again in case they've changed (eg. newer AWRender module loaded since we first loaded this file) */ (void)_swix(AWRender_RenderAddress, _OUT(0) | _OUT(1), &aw->render_routine, &aw->render_workspace); /* Scaled image. Transform units (65536*OS units) */ matrix.entries[0][0] = data->width * 65536 / c->width; matrix.entries[0][1] = 0; matrix.entries[1][0] = 0; matrix.entries[1][1] = data->height * 65536 / c->height; /* Draw units. (x,y) = bottom left */ matrix.entries[2][0] = ro_plot_origin_x * 256 + data->x * 512 - aw->x0 * data->width / c->width; matrix.entries[2][1] = ro_plot_origin_y * 256 - (data->y + data->height) * 512 - aw->y0 * data->height / c->height; info.ditherx = ro_plot_origin_x; info.dithery = ro_plot_origin_y; clip_x0 -= data->x; clip_y0 -= data->y; clip_x1 -= data->x; clip_y1 -= data->y; if (data->scale == 1.0) { info.clip_x0 = (clip_x0 * 512) + aw->x0 - 511; info.clip_y0 = ((c->height - clip_y1) * 512) + aw->y0 - 511; info.clip_x1 = (clip_x1 * 512) + aw->x0 + 511; info.clip_y1 = ((c->height - clip_y0) * 512) + aw->y0 + 511; } else { info.clip_x0 = (clip_x0 * 512 / data->scale) + aw->x0 - 511; info.clip_y0 = ((c->height - (clip_y1 / data->scale)) * 512) + aw->y0 - 511; info.clip_x1 = (clip_x1 * 512 / data->scale) + aw->x0 + 511; info.clip_y1 = ((c->height - (clip_y0 / data->scale)) * 512) + aw->y0 + 511; } info.print_lowx = 0; info.print_lowy = 0; info.print_handle = 0; info.bgcolour = 0x20000000 | data->background_colour; error = xos_read_vdu_variables(PTR_OS_VDU_VAR_LIST(&vars), vals); if (error) { LOG("xos_read_vdu_variables: 0x%x: %s", error->errnum, error->errmess); return false; } error = xwimp_read_palette((os_palette*)&vals[3]); if (error) { LOG("xwimp_read_palette: 0x%x: %s", error->errnum, error->errmess); return false; } source_data = content__get_source_data(c, &source_size); error = awrender_render(source_data, &info, &matrix, vals, &aw->block, &aw->size, 110, /* fully anti-aliased */ 0, source_size, aw->render_routine, aw->render_workspace); if (error) { LOG("awrender_render: 0x%x: %s", error->errnum, error->errmess); return false; } return true; }
bool RiscosGui::init(int argc, char **argv[]) { GNASH_REPORT_FUNCTION; /* wimp_MESSAGE_LIST(4) messages = { { message_MODE_CHANGE, message_DATA_LOAD, message_DATA_OPEN, message_QUIT } };*/ os_error *error; glue.init(argc, argv); error = xwimp_initialise(wimp_VERSION_RO38, "Gnash", (wimp_message_list *)0/*&messages*/, 0, &_task); if (error) { log_debug("%s\n", error->errmess); return false; } if (!create_window()) return false; #ifdef RENDERER_AGG os_VDU_VAR_LIST(2) vduvars = { { os_VDUVAR_SCREEN_START, os_VDUVAR_END_LIST } }; int vduvals[2]; error = xos_read_vdu_variables((const os_vdu_var_list *)&vduvars, vduvals); if (error) { log_debug("%s\n", error->errmess); return false; } os_mode mode; os_mode_selector *mode_block; /* read current screenmode details */ error = xosscreenmode_current(&mode); if (error) { log_debug("%s", error->errmess); return false; } if ((unsigned int)mode >= 256) { mode_block = (os_mode_selector *)mode; _screen_width = mode_block->xres; _screen_height = mode_block->yres; } /** \todo Mode specifiers */ log_debug("Framebuffer address: %p\n", (void *)vduvals[0]); log_debug("Screen Res: %d x %d\n", _screen_width, _screen_height); glue.prepFramebuffer((void *)vduvals[0], _screen_width, _screen_height); #endif _renderer = glue.createRenderHandler(); set_render_handler(_renderer); // hack? _renderer->set_scale(1.0f, 1.0f); return true; }