[project @ 2004-11-06 21:03:55 by bursa]
Fix RISC OS DrawFile rendering. Document files. svn path=/import/netsurf/; revision=1349
This commit is contained in:
parent
86e789856c
commit
ef672d1ff0
|
@ -5,19 +5,33 @@
|
|||
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
/** \file
|
||||
* Content for image/x-drawfile (RISC OS implementation).
|
||||
*
|
||||
* The DrawFile module is used to plot the DrawFile.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "oslib/drawfile.h"
|
||||
#include "netsurf/utils/config.h"
|
||||
#include "netsurf/content/content.h"
|
||||
#include "netsurf/riscos/draw.h"
|
||||
#include "netsurf/riscos/gui.h"
|
||||
#include "netsurf/utils/utils.h"
|
||||
#include "netsurf/utils/messages.h"
|
||||
#include "netsurf/utils/log.h"
|
||||
#include "oslib/drawfile.h"
|
||||
|
||||
#ifdef WITH_DRAW
|
||||
|
||||
|
||||
/**
|
||||
* Convert a CONTENT_DRAW for display.
|
||||
*
|
||||
* No conversion is necessary. We merely read the DrawFile dimensions and
|
||||
* bounding box bottom-left.
|
||||
*/
|
||||
|
||||
bool draw_convert(struct content *c, int width, int height)
|
||||
{
|
||||
union content_msg_data msg_data;
|
||||
|
@ -39,8 +53,8 @@ bool draw_convert(struct content *c, int width, int height)
|
|||
=> divide by 512 to convert from draw units */
|
||||
c->width = ((bbox.x1 - bbox.x0) / 512);
|
||||
c->height = ((bbox.y1 - bbox.y0) / 512);
|
||||
c->data.draw.x0 = bbox.x0 / 2;
|
||||
c->data.draw.y0 = bbox.y0 / 2;
|
||||
c->data.draw.x0 = bbox.x0;
|
||||
c->data.draw.y0 = bbox.y0;
|
||||
c->title = malloc(100);
|
||||
if (c->title)
|
||||
snprintf(c->title, 100, messages_get("DrawTitle"), c->width,
|
||||
|
@ -50,28 +64,37 @@ bool draw_convert(struct content *c, int width, int height)
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Destroy a CONTENT_DRAW and free all resources it owns.
|
||||
*/
|
||||
|
||||
void draw_destroy(struct content *c)
|
||||
{
|
||||
free(c->title);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Redraw a CONTENT_DRAW.
|
||||
*/
|
||||
|
||||
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, unsigned long background_colour)
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
os_error *error;
|
||||
os_trfm matrix;
|
||||
|
||||
/* Scaled image. Transform units (65536*OS units) */
|
||||
matrix.entries[0][0] = ((width*65536) / (c->width*2));
|
||||
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*2));
|
||||
matrix.entries[1][1] = height * 65536 / c->height;
|
||||
/* Draw units. (x,y) = bottom left */
|
||||
matrix.entries[2][0] = x * 256 - c->data.draw.x0 * width / c->width;
|
||||
matrix.entries[2][1] = (y - height) * 256 -
|
||||
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*)(c->source_data),
|
||||
|
@ -84,4 +107,5 @@ bool draw_redraw(struct content *c, int x, int y,
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
* Copyright 2003 John M Bell <jmb202@ecs.soton.ac.uk>
|
||||
*/
|
||||
|
||||
/** \file
|
||||
* Content for image/x-drawfile (RISC OS interface).
|
||||
*/
|
||||
|
||||
#ifndef _NETSURF_RISCOS_DRAW_H_
|
||||
#define _NETSURF_RISCOS_DRAW_H_
|
||||
|
||||
|
@ -19,5 +23,6 @@ void draw_destroy(struct content *c);
|
|||
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, unsigned long background_colour);
|
||||
float scale, colour background_colour);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue