Exemplo n.º 1
0
static void drawfile_redraw(const drawable_choices *choices,
                            wimp_draw              *draw,
                            drawable_t             *drawable,
                            int                     x,
                            int                     y)
{
  int                     flatness;
  const drawfile_diagram *diagram;
  os_trfm                *trfm;

  diagram = drawable->image->image;

  trfm = &drawable->details.drawfile.trfm;

  trfm->entries[2][0] = x * draw_OS_UNIT;
  trfm->entries[2][1] = y * draw_OS_UNIT;

  flatness = choices->drawfile.flatness;

  (void) xdrawfile_render((flatness == -1) ? 0 : drawfile_RENDER_GIVEN_FLATNESS,
                           diagram,
                           drawable->image->display.file_size,
                           trfm,
                          &draw->clip,
                           flatness);
}
Exemplo n.º 2
0
bool draw_redraw(struct content *c, int x, int y,
		int width, int height,
		int clip_x0, int clip_y0, int clip_x1, int clip_y1,
		float scale, colour background_colour)
{
	os_trfm matrix;
	const char *source_data;
	unsigned long source_size;
	const void *data;
	os_error *error;

	if (plot.flush && !plot.flush())
		return false;

	if (!c->width || !c->height)
		return false;

	source_data = content__get_source_data(c, &source_size);
	data = source_data;

	/* Scaled image. Transform units (65536*OS units) */
	matrix.entries[0][0] = width * 65536 / c->width;
	matrix.entries[0][1] = 0;
	matrix.entries[1][0] = 0;
	matrix.entries[1][1] = height * 65536 / c->height;
	/* Draw units. (x,y) = bottom left */
	matrix.entries[2][0] = ro_plot_origin_x * 256 + x * 512 -
			c->data.draw.x0 * width / c->width;
	matrix.entries[2][1] = ro_plot_origin_y * 256 - (y + height) * 512 -
			c->data.draw.y0 * height / c->height;

	error = xdrawfile_render(0, (drawfile_diagram *) data,
			(int) source_size, &matrix, 0, 0);
	if (error) {
		LOG(("xdrawfile_render: 0x%x: %s",
				error->errnum, error->errmess));
		return false;
	}

	return true;
}