mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-18 16:49:18 +03:00
Pass clip rect as struct through content_redraw api. Update the front ends to use this. Note only RO build tested.
svn path=/trunk/netsurf/; revision=11670
This commit is contained in:
parent
db2f823e99
commit
fe7921a387
@ -188,8 +188,7 @@ void amiga_icon_destroy(struct content *c)
|
||||
*/
|
||||
|
||||
bool amiga_icon_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
return plot.bitmap(x, y, width, height,
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include <stdbool.h>
|
||||
#include "content/hlcache.h"
|
||||
|
||||
struct rect;
|
||||
|
||||
struct content_amiga_icon_data {
|
||||
/* empty */
|
||||
};
|
||||
@ -36,8 +38,7 @@ struct content_amiga_icon_data {
|
||||
bool amiga_icon_convert(struct content *c);
|
||||
void amiga_icon_destroy(struct content *c);
|
||||
bool amiga_icon_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool amiga_icon_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -36,6 +36,12 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
const char *url)
|
||||
{
|
||||
struct BitScaleArgs bsa;
|
||||
struct rect clip;
|
||||
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = content_get_width(content);
|
||||
clip.y1 = content_get_width(content);
|
||||
|
||||
bitmap->nativebm = p96AllocBitMap(bitmap->width, bitmap->height, 32,
|
||||
BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
|
||||
@ -47,8 +53,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
current_redraw_browser = curbw;
|
||||
plot = amiplot;
|
||||
content_redraw(content, 0, 0, content_get_width(content),
|
||||
content_get_width(content), 0, 0, content_get_width(content),
|
||||
content_get_width(content), 1.0, 0xFFFFFF);
|
||||
content_get_width(content), &clip, 1.0, 0xFFFFFF);
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
if(GfxBase->LibNode.lib_Version >= 53) // AutoDoc says v52, but this function isn't in OS4.0, so checking for v53 (OS4.1)
|
||||
|
@ -849,7 +849,7 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff )
|
||||
LGRECT work;
|
||||
CMP_BROWSER b = gw->browser;
|
||||
GRECT area;
|
||||
int clip_x0, clip_x1, clip_y0, clip_y1;
|
||||
struct rect clip;
|
||||
|
||||
LOG(("%s : %d,%d - %d,%d\n", b->bw->name, b->redraw.area.x0,
|
||||
b->redraw.area.y0, b->redraw.area.x1, b->redraw.area.y1
|
||||
@ -862,16 +862,16 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff )
|
||||
current_redraw_browser = b->bw;
|
||||
|
||||
if(content_get_type(b->bw->current_content) == CONTENT_HTML ) {
|
||||
clip_x0 = b->redraw.area.x0;
|
||||
clip_y0 = b->redraw.area.y0;
|
||||
clip_x1 = b->redraw.area.x1;
|
||||
clip_y1 = b->redraw.area.y1;
|
||||
clip.x0 = b->redraw.area.x0;
|
||||
clip.y0 = b->redraw.area.y0;
|
||||
clip.x1 = b->redraw.area.x1;
|
||||
clip.y1 = b->redraw.area.y1;
|
||||
} else {
|
||||
/* totally different coords, I don't understand why! */
|
||||
clip_x0 = b->redraw.area.x0 + b->scroll.current.x;
|
||||
clip_y0 = b->redraw.area.y0 + b->scroll.current.y;
|
||||
clip_x1 = b->redraw.area.x1 + b->scroll.current.x;
|
||||
clip_y1 = b->redraw.area.y1 + b->scroll.current.y;
|
||||
clip.x0 = b->redraw.area.x0 + b->scroll.current.x;
|
||||
clip.y0 = b->redraw.area.y0 + b->scroll.current.y;
|
||||
clip.x1 = b->redraw.area.x1 + b->scroll.current.x;
|
||||
clip.y1 = b->redraw.area.y1 + b->scroll.current.y;
|
||||
/* must clear the surface: */
|
||||
plot.clip( b->redraw.area.x0, b->redraw.area.y0,
|
||||
b->redraw.area.x1, b->redraw.area.y1
|
||||
@ -889,8 +889,7 @@ static void browser_redraw_content( struct gui_window * gw, int xoff, int yoff )
|
||||
-b->scroll.current.x, -b->scroll.current.y,
|
||||
content_get_width( b->bw->current_content),
|
||||
content_get_height( b->bw->current_content),
|
||||
clip_x0, clip_y0,
|
||||
clip_x1, clip_y1,
|
||||
&clip,
|
||||
b->bw->scale, 0xFFFFFF
|
||||
);
|
||||
current_redraw_browser = NULL;
|
||||
|
@ -66,6 +66,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
float width;
|
||||
float height;
|
||||
int depth;
|
||||
struct rect clip;
|
||||
|
||||
assert(content);
|
||||
assert(bitmap);
|
||||
@ -125,11 +126,15 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
content_get_width(content),
|
||||
plot_style_fill_white);
|
||||
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = content_get_width(content);
|
||||
clip.y1 = content_get_width(content);
|
||||
|
||||
/* render the content */
|
||||
content_redraw(content, 0, 0,
|
||||
content_get_width(content), content_get_width(content),
|
||||
0, 0,
|
||||
content_get_width(content), content_get_width(content),
|
||||
&clip,
|
||||
1.0, 0xFFFFFF);
|
||||
|
||||
view->Sync();
|
||||
|
@ -918,6 +918,7 @@ void nsbeos_window_expose_event(BView *view, gui_window *g, BMessage *message)
|
||||
BRect updateRect;
|
||||
hlcache_handle *c;
|
||||
float scale = g->bw->scale;
|
||||
struct rect clip;
|
||||
|
||||
assert(g);
|
||||
assert(g->bw);
|
||||
@ -953,13 +954,15 @@ void nsbeos_window_expose_event(BView *view, gui_window *g, BMessage *message)
|
||||
plot = nsbeos_plotters;
|
||||
nsbeos_plot_set_scale(g->bw->scale);
|
||||
current_redraw_browser = g->bw;
|
||||
|
||||
clip.x0 = (int)updateRect.left;
|
||||
clip.y0 = (int)updateRect.top;
|
||||
clip.x1 = (int)updateRect.right + 1;
|
||||
clip.y1 = (int)updateRect.bottom + 1;
|
||||
content_redraw(c, 0, 0,
|
||||
(view->Bounds().Width() + 1) * scale,
|
||||
(view->Bounds().Height() + 1) * scale,
|
||||
(int)updateRect.left,
|
||||
(int)updateRect.top,
|
||||
(int)updateRect.right + 1,
|
||||
(int)updateRect.bottom + 1,
|
||||
&clip,
|
||||
g->bw->scale, 0xFFFFFF);
|
||||
current_redraw_browser = NULL;
|
||||
|
||||
|
@ -39,13 +39,19 @@ bool thumbnail_create(struct hlcache_handle *content, struct bitmap *bitmap,
|
||||
size_t width = MIN( content_get_width( content ), 1024 );
|
||||
size_t height = MIN( content_get_height( content ), 768 );
|
||||
|
||||
struct rect clip;
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = content_get_width( content );
|
||||
clip.y1 = content_get_height( content );
|
||||
|
||||
CGContextTranslateCTM( bitmapContext, 0, bitmap_get_height( bitmap ) );
|
||||
CGContextScaleCTM( bitmapContext, (CGFloat)bitmap_get_width( bitmap ) / width, -(CGFloat)bitmap_get_height( bitmap ) / height );
|
||||
|
||||
[NSGraphicsContext setCurrentContext: [NSGraphicsContext graphicsContextWithGraphicsPort: bitmapContext flipped: YES]];
|
||||
|
||||
content_redraw( content, 0, 0, content_get_width( content ), content_get_height( content ),
|
||||
0, 0, content_get_width( content ), content_get_height( content ),
|
||||
&clip,
|
||||
1.0, 0xFFFFFFFF );
|
||||
|
||||
[NSGraphicsContext setCurrentContext: nil];
|
||||
|
@ -275,12 +275,10 @@ struct handler_entry {
|
||||
void (*mouse_action)(struct content *c, struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
bool (*redraw)(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool (*redraw_tiled)(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
void (*open)(struct content *c, struct browser_window *bw,
|
||||
@ -879,19 +877,16 @@ void content_request_redraw(struct hlcache_handle *h,
|
||||
* \param y coordinate for top-left of redraw
|
||||
* \param width render width (not used for HTML redraw)
|
||||
* \param height render height (not used for HTML redraw)
|
||||
* \param clip_x0 clip rectangle left
|
||||
* \param clip_y0 clip rectangle top
|
||||
* \param clip_x1 clip rectangle right
|
||||
* \param clip_y1 clip rectangle bottom
|
||||
* \param clip clip rectangle
|
||||
* \param scale scale for redraw
|
||||
* \param background_colour the background colour
|
||||
* \return true if successful, false otherwise
|
||||
*
|
||||
* x, y and clip_* are coordinates from the top left of the canvas area.
|
||||
* x, y and clip are coordinates from the top left of the canvas area.
|
||||
*
|
||||
* The top left corner of the clip rectangle is (clip_x0, clip_y0) and
|
||||
* the bottom right corner of the clip rectangle is (clip_x1, clip_y1).
|
||||
* Units for x, y and clip_* are pixels.
|
||||
* The top left corner of the clip rectangle is (x0, y0) and
|
||||
* the bottom right corner of the clip rectangle is (x1, y1).
|
||||
* Units for x, y and clip are pixels.
|
||||
*
|
||||
* Content scaling is handled differently for contents with and without
|
||||
* intrinsic dimensions.
|
||||
@ -906,8 +901,7 @@ void content_request_redraw(struct hlcache_handle *h,
|
||||
*/
|
||||
|
||||
bool content_redraw(hlcache_handle *h, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
struct content *c = hlcache_handle_get_content(h);
|
||||
@ -923,8 +917,7 @@ bool content_redraw(hlcache_handle *h, int x, int y,
|
||||
}
|
||||
|
||||
return handler_map[c->type].redraw(c, x, y, width, height,
|
||||
clip_x0, clip_y0, clip_x1, clip_y1, scale,
|
||||
background_colour);
|
||||
clip, scale, background_colour);
|
||||
}
|
||||
|
||||
|
||||
@ -936,8 +929,7 @@ bool content_redraw(hlcache_handle *h, int x, int y,
|
||||
*/
|
||||
|
||||
bool content_redraw_tiled(hlcache_handle *h, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
@ -953,8 +945,8 @@ bool content_redraw_tiled(hlcache_handle *h, int x, int y,
|
||||
return true;
|
||||
if (handler_map[c->type].redraw_tiled) {
|
||||
return handler_map[c->type].redraw_tiled(c, x, y, width, height,
|
||||
clip_x0, clip_y0, clip_x1, clip_y1, scale,
|
||||
background_colour, repeat_x, repeat_y);
|
||||
clip, scale, background_colour,
|
||||
repeat_x, repeat_y);
|
||||
} else {
|
||||
/* ensure we have a redrawable content */
|
||||
if ((!handler_map[c->type].redraw) || (width == 0) ||
|
||||
@ -963,20 +955,19 @@ bool content_redraw_tiled(hlcache_handle *h, int x, int y,
|
||||
/* simple optimisation for no repeat (common for backgrounds) */
|
||||
if ((!repeat_x) && (!repeat_y))
|
||||
return handler_map[c->type].redraw(c, x, y, width,
|
||||
height, clip_x0, clip_y0, clip_x1, clip_y1,
|
||||
scale, background_colour);
|
||||
height, clip, scale, background_colour);
|
||||
/* find the redraw boundaries to loop within*/
|
||||
x0 = x;
|
||||
if (repeat_x) {
|
||||
for (; x0 > clip_x0; x0 -= width);
|
||||
x1 = clip_x1;
|
||||
for (; x0 > clip->x0; x0 -= width);
|
||||
x1 = clip->x1;
|
||||
} else {
|
||||
x1 = x + 1;
|
||||
}
|
||||
y0 = y;
|
||||
if (repeat_y) {
|
||||
for (; y0 > clip_y0; y0 -= height);
|
||||
y1 = clip_y1;
|
||||
for (; y0 > clip->y0; y0 -= height);
|
||||
y1 = clip->y1;
|
||||
} else {
|
||||
y1 = y + 1;
|
||||
}
|
||||
@ -984,9 +975,7 @@ bool content_redraw_tiled(hlcache_handle *h, int x, int y,
|
||||
for (y = y0; y < y1; y += height)
|
||||
for (x = x0; x < x1; x += width)
|
||||
if (!handler_map[c->type].redraw(c, x, y,
|
||||
width, height,
|
||||
clip_x0, clip_y0,
|
||||
clip_x1, clip_y1,
|
||||
width, height, clip,
|
||||
scale, background_colour))
|
||||
return false;
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ struct content;
|
||||
struct llcache_handle;
|
||||
struct hlcache_handle;
|
||||
struct object_params;
|
||||
struct rect;
|
||||
|
||||
/** Status of a content */
|
||||
typedef enum {
|
||||
@ -124,12 +125,10 @@ void content_mouse_track(struct hlcache_handle *h, struct browser_window *bw,
|
||||
void content_mouse_action(struct hlcache_handle *h, struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y);
|
||||
bool content_redraw(struct hlcache_handle *h, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool content_redraw_tiled(struct hlcache_handle *h, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
void content_open(struct hlcache_handle *h, struct browser_window *bw,
|
||||
|
@ -120,8 +120,7 @@ bool browser_window_redraw(struct browser_window *bw, int x, int y,
|
||||
}
|
||||
|
||||
return content_redraw(bw->current_content, x, y, width, height,
|
||||
clip.x0, clip.y0, clip.x1, clip.y1,
|
||||
bw->scale, 0xFFFFFF);
|
||||
&clip, bw->scale, 0xFFFFFF);
|
||||
}
|
||||
|
||||
/* exported interface, documented in browser.h */
|
||||
|
@ -120,32 +120,28 @@ bool print_set_up(hlcache_handle *content,
|
||||
bool print_draw_next_page(const struct printer *printer,
|
||||
struct print_settings *settings)
|
||||
{
|
||||
int clip_x1, clip_y1;
|
||||
struct rect clip;
|
||||
|
||||
plot = *(printer->plotter);
|
||||
html_redraw_printing_top_cropped = INT_MAX;
|
||||
|
||||
clip_x1 = page_content_width * settings->scale;
|
||||
clip_y1 = page_content_height * settings->scale;
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = page_content_width * settings->scale;
|
||||
clip.y1 = page_content_height * settings->scale;
|
||||
|
||||
html_redraw_printing = true;
|
||||
html_redraw_printing_border = clip_y1;
|
||||
html_redraw_printing_border = clip.y1;
|
||||
|
||||
printer->print_next_page();
|
||||
if (!content_redraw(printed_content,
|
||||
0,
|
||||
-done_height,
|
||||
0,0,
|
||||
0,
|
||||
0,
|
||||
clip_x1,
|
||||
clip_y1,
|
||||
settings->scale, 0xffffff))
|
||||
if (!content_redraw(printed_content, 0, -done_height,
|
||||
0, 0,
|
||||
&clip, settings->scale, 0xffffff))
|
||||
return false;
|
||||
|
||||
done_height += page_content_height -
|
||||
(html_redraw_printing_top_cropped != INT_MAX ?
|
||||
clip_y1 - html_redraw_printing_top_cropped : 0) /
|
||||
clip.y1 - html_redraw_printing_top_cropped : 0) /
|
||||
settings->scale;
|
||||
|
||||
return true;
|
||||
|
@ -1623,7 +1623,7 @@ static void tree_draw_node_element(struct tree *tree,
|
||||
plot.clip(c.x0, c.y0, c.x1, c.y1);
|
||||
content_redraw(icon , x, y + icon_inset,
|
||||
TREE_ICON_SIZE, TREE_ICON_SIZE,
|
||||
c.x0, c.y0, c.x1, c.y1, 1, 0);
|
||||
&c, 1, 0);
|
||||
|
||||
/* Restore previous clipping area */
|
||||
plot.clip(clip.x0, clip.y0, clip.x1, clip.y1);
|
||||
|
@ -51,6 +51,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
int cwidth, cheight;
|
||||
struct rect clip;
|
||||
gint width;
|
||||
gint height;
|
||||
gint depth;
|
||||
@ -60,6 +61,11 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
assert(content);
|
||||
assert(bitmap);
|
||||
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = content_get_width(content);
|
||||
clip.y1 = content_get_width(content);
|
||||
|
||||
cwidth = min(content_get_width(content), 1024);
|
||||
cheight = min(content_get_height(content), 768);
|
||||
|
||||
@ -100,13 +106,12 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
#endif
|
||||
plot.rectangle(0, 0, cwidth, cwidth, plot_style_fill_white);
|
||||
|
||||
plot.clip(0, 0, content_get_width(content), content_get_width(content));
|
||||
plot.clip(clip.x0, clip.y0, clip.x1, clip.y1);
|
||||
|
||||
/* render the content */
|
||||
content_redraw(content, 0, 0, content_get_width(content),
|
||||
content_get_width(content),
|
||||
0, 0, content_get_width(content),
|
||||
content_get_width(content), 1.0, 0xFFFFFF);
|
||||
&clip, 1.0, 0xFFFFFF);
|
||||
|
||||
/* resample the large plot down to the size of our thumbnail */
|
||||
big = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, 0, 0, 0, 0,
|
||||
|
@ -117,8 +117,7 @@ bool nsbmp_convert(struct content *c)
|
||||
|
||||
|
||||
bool nsbmp_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
|
||||
@ -132,8 +131,7 @@ bool nsbmp_redraw(struct content *c, int x, int y,
|
||||
|
||||
|
||||
bool nsbmp_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@
|
||||
struct content;
|
||||
struct bitmap;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct content_bmp_data {
|
||||
bmp_image *bmp; /** BMP image data */
|
||||
@ -45,12 +46,10 @@ bool nsbmp_create(struct content *c, const struct http_parameter *params);
|
||||
bool nsbmp_convert(struct content *c);
|
||||
void nsbmp_destroy(struct content *c);
|
||||
bool nsbmp_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nsbmp_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool nsbmp_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -152,8 +152,7 @@ void nsgif_invalidate(void *bitmap, void *private_word)
|
||||
}
|
||||
|
||||
bool nsgif_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
if (c->data.gif.current_frame != c->data.gif.gif->decoded_frame)
|
||||
@ -168,8 +167,7 @@ bool nsgif_redraw(struct content *c, int x, int y,
|
||||
|
||||
|
||||
bool nsgif_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
struct content;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct content_gif_data {
|
||||
struct gif_animation *gif; /**< GIF animation data */
|
||||
@ -42,12 +43,10 @@ bool nsgif_create(struct content *c, const struct http_parameter *params);
|
||||
bool nsgif_convert(struct content *c);
|
||||
void nsgif_destroy(struct content *c);
|
||||
bool nsgif_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nsgif_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool nsgif_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -105,8 +105,7 @@ bool nsico_convert(struct content *c)
|
||||
}
|
||||
|
||||
bool nsico_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
struct bmp_image *bmp = ico_find(c->data.ico.ico, width, height);
|
||||
@ -140,8 +139,7 @@ bool nsico_set_bitmap_from_size(hlcache_handle *h, int width, int height)
|
||||
}
|
||||
|
||||
bool nsico_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
struct content;
|
||||
struct hlcache_handle;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct content_ico_data {
|
||||
struct ico_collection *ico; /** ICO collection data */
|
||||
@ -41,12 +42,10 @@ bool nsico_create(struct content *c, const struct http_parameter *params);
|
||||
bool nsico_convert(struct content *c);
|
||||
void nsico_destroy(struct content *c);
|
||||
bool nsico_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nsico_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool nsico_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -244,8 +244,7 @@ void nsjpeg_term_source(j_decompress_ptr cinfo)
|
||||
*/
|
||||
|
||||
bool nsjpeg_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
return plot.bitmap(x, y, width, height,
|
||||
@ -258,8 +257,7 @@ bool nsjpeg_redraw(struct content *c, int x, int y,
|
||||
*/
|
||||
|
||||
bool nsjpeg_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
struct bitmap;
|
||||
struct content;
|
||||
struct rect;
|
||||
|
||||
struct content_jpeg_data {
|
||||
int dummy; /* NOT USED but to satisfy Norcroft */
|
||||
@ -38,12 +39,10 @@ struct content_jpeg_data {
|
||||
bool nsjpeg_convert(struct content *c);
|
||||
void nsjpeg_destroy(struct content *c);
|
||||
bool nsjpeg_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nsjpeg_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool nsjpeg_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -524,8 +524,7 @@ void nsmng_destroy(struct content *c)
|
||||
|
||||
|
||||
bool nsmng_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
bool ret;
|
||||
@ -551,8 +550,7 @@ bool nsmng_redraw(struct content *c, int x, int y,
|
||||
|
||||
|
||||
bool nsmng_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
struct content;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct content_mng_data {
|
||||
bool opaque_test_pending;
|
||||
@ -46,12 +47,10 @@ bool nsmng_process_data(struct content *c, const char *data, unsigned int size);
|
||||
bool nsmng_convert(struct content *c);
|
||||
void nsmng_destroy(struct content *c);
|
||||
bool nsmng_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nsmng_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool nsmng_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -136,8 +136,7 @@ void nssprite_destroy(struct content *c)
|
||||
*/
|
||||
|
||||
bool nssprite_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
return plot.bitmap(x, y, width, height,
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
struct content;
|
||||
struct rect;
|
||||
|
||||
struct content_nssprite_data {
|
||||
struct rosprite_area* sprite_area;
|
||||
@ -37,8 +38,7 @@ struct content_nssprite_data {
|
||||
bool nssprite_convert(struct content *c);
|
||||
void nssprite_destroy(struct content *c);
|
||||
bool nssprite_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nssprite_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -305,8 +305,7 @@ void nspng_destroy(struct content *c)
|
||||
|
||||
|
||||
bool nspng_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
assert(c->bitmap != NULL);
|
||||
@ -315,8 +314,8 @@ bool nspng_redraw(struct content *c, int x, int y,
|
||||
background_colour, BITMAPF_NONE);
|
||||
}
|
||||
|
||||
bool nspng_redraw_tiled(struct content *c, int x, int y, int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
bool nspng_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -32,6 +32,7 @@
|
||||
struct content;
|
||||
struct bitmap;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct content_png_data {
|
||||
png_structp png;
|
||||
@ -47,11 +48,10 @@ bool nspng_process_data(struct content *c, const char *data, unsigned int size);
|
||||
bool nspng_convert(struct content *c);
|
||||
void nspng_destroy(struct content *c);
|
||||
bool nspng_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool nspng_redraw_tiled(struct content *c, int x, int y, int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
bool nspng_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool nspng_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -180,16 +180,16 @@ bool rsvg_convert(struct content *c)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rsvg_redraw(struct content *c, int x, int y, int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
bool rsvg_redraw(struct content *c, int x, int y,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
plot.bitmap(x, y, width, height, c->bitmap, background_colour, BITMAPF_NONE);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool rsvg_redraw_tiled(struct content *c, int x, int y, int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
bool rsvg_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
struct content;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct content_rsvg_data {
|
||||
RsvgHandle *rsvgh; /**< Context handle for RSVG renderer */
|
||||
@ -47,12 +48,10 @@ bool rsvg_process_data(struct content *c, const char *data, unsigned int size);
|
||||
bool rsvg_convert(struct content *c);
|
||||
void rsvg_destroy(struct content *c);
|
||||
bool rsvg_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool rsvg_redraw_tiled(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour,
|
||||
bool repeat_x, bool repeat_y);
|
||||
bool rsvg_clone(const struct content *old, struct content *new_content);
|
||||
|
@ -107,8 +107,7 @@ void svg_reformat(struct content *c, int width, int height)
|
||||
*/
|
||||
|
||||
bool svg_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
float transform[6];
|
||||
|
@ -28,6 +28,7 @@
|
||||
struct content;
|
||||
struct http_parameter;
|
||||
struct svgtiny_diagram;
|
||||
struct rect;
|
||||
|
||||
struct content_svg_data {
|
||||
struct svgtiny_diagram *diagram;
|
||||
@ -39,8 +40,7 @@ bool svg_convert(struct content *c);
|
||||
void svg_destroy(struct content *c);
|
||||
void svg_reformat(struct content *c, int width, int height);
|
||||
bool svg_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool svg_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -130,8 +130,7 @@ void webp_destroy(struct content *c)
|
||||
*/
|
||||
|
||||
bool webp_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
return plot.bitmap(x, y, width, height,
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
struct content;
|
||||
struct rect;
|
||||
|
||||
struct content_webp_data {
|
||||
/* empty */
|
||||
@ -37,8 +38,7 @@ struct content_webp_data {
|
||||
bool webp_convert(struct content *c);
|
||||
void webp_destroy(struct content *c);
|
||||
bool webp_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool webp_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <string.h>
|
||||
#include "content/content_protected.h"
|
||||
#include "content/hlcache.h"
|
||||
#include "desktop/shape.h"
|
||||
#include "render/favicon.h"
|
||||
#include "render/html.h"
|
||||
#include "utils/log.h"
|
||||
@ -247,10 +248,17 @@ nserror favicon_callback(hlcache_handle *icon,
|
||||
}
|
||||
|
||||
#ifdef WITH_GIF
|
||||
if (consider_redraw && (c->data.html.favicon != NULL) && (content_get_type(c->data.html.favicon) == CONTENT_GIF)) {
|
||||
if (consider_redraw && (c->data.html.favicon != NULL) &&
|
||||
(content_get_type(c->data.html.favicon) ==
|
||||
CONTENT_GIF)) {
|
||||
union content_msg_data msg_data;
|
||||
/* This is needed in order to cause animated GIFs to update their bitmap */
|
||||
content_redraw(c->data.html.favicon, 0, 0, -1, -1, 0, 0, 0, 0, 1.0, 0);
|
||||
struct rect clip;
|
||||
/* This is needed in order to cause animated GIFs to update
|
||||
* their bitmap */
|
||||
clip.x0 = clip.y0 = 0;
|
||||
clip.x1 = clip.y1 = 0;
|
||||
content_redraw(c->data.html.favicon, 0, 0, -1, -1, &clip,
|
||||
1.0, 0);
|
||||
content_broadcast(c, CONTENT_MSG_FAVICON_REFRESH, msg_data);
|
||||
}
|
||||
#endif
|
||||
|
@ -209,8 +209,7 @@ void html_redraw_a_box(struct hlcache_handle *h, struct box *box);
|
||||
|
||||
/* in render/html_redraw.c */
|
||||
bool html_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
|
||||
/* in render/html_interaction.c */
|
||||
|
@ -101,10 +101,7 @@ bool html_redraw_debug = false;
|
||||
* \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
|
||||
* \param clip_y0 clip rectangle
|
||||
* \param clip_x1 clip rectangle
|
||||
* \param clip_y1 clip rectangle
|
||||
* \param clip clip rectangle
|
||||
* \param scale scale for redraw
|
||||
* \param background_colour the background colour
|
||||
* \return true if successful, false otherwise
|
||||
@ -113,8 +110,7 @@ bool html_redraw_debug = false;
|
||||
*/
|
||||
|
||||
bool html_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
struct box *box;
|
||||
@ -145,26 +141,21 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
/* check if the redraw rectangle is completely inside of the
|
||||
select menu */
|
||||
select_only = form_clip_inside_select_menu(control, scale,
|
||||
clip_x0, clip_y0, clip_x1, clip_y1);
|
||||
clip->x0, clip->y0, clip->x1, clip->y1);
|
||||
}
|
||||
|
||||
if (!select_only) {
|
||||
struct rect clip;
|
||||
clip.x0 = clip_x0;
|
||||
clip.y0 = clip_y0;
|
||||
clip.x1 = clip_x1;
|
||||
clip.y1 = clip_y1;
|
||||
/* clear to background colour */
|
||||
result = plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
|
||||
result = plot.clip(clip->x0, clip->y0, clip->x1, clip->y1);
|
||||
|
||||
if (c->data.html.background_colour != NS_TRANSPARENT)
|
||||
pstyle_fill_bg.fill_colour =
|
||||
c->data.html.background_colour;
|
||||
|
||||
result &= plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1,
|
||||
result &= plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
|
||||
&pstyle_fill_bg);
|
||||
|
||||
result &= html_redraw_box(box, x, y, clip,
|
||||
result &= html_redraw_box(box, x, y, *clip,
|
||||
scale, pstyle_fill_bg.fill_colour);
|
||||
}
|
||||
|
||||
@ -180,7 +171,7 @@ bool html_redraw(struct content *c, int x, int y,
|
||||
current_redraw_browser->visible_select_menu,
|
||||
x + menu_x, y + menu_y,
|
||||
current_redraw_browser->scale,
|
||||
clip_x0, clip_y0, clip_x1, clip_y1);
|
||||
clip->x0, clip->y0, clip->x1, clip->y1);
|
||||
}
|
||||
|
||||
if (want_knockout)
|
||||
@ -667,7 +658,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
|
||||
if (!content_redraw(box->object,
|
||||
x_scrolled + padding_left,
|
||||
y_scrolled + padding_top,
|
||||
width, height, r.x0, r.y0, r.x1, r.y1, scale,
|
||||
width, height, &r, scale,
|
||||
current_background_color))
|
||||
return false;
|
||||
|
||||
@ -2191,9 +2182,7 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
|
||||
if (!content_redraw_tiled(
|
||||
background->background, x, y,
|
||||
ceilf(width * scale),
|
||||
ceilf(height * scale),
|
||||
clip.x0, clip.y0,
|
||||
clip.x1, clip.y1,
|
||||
ceilf(height * scale), &clip,
|
||||
scale, *background_colour,
|
||||
repeat_x, repeat_y))
|
||||
return false;
|
||||
@ -2334,9 +2323,7 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
|
||||
return false;
|
||||
if (!content_redraw_tiled(box->background, x, y,
|
||||
ceilf(width * scale),
|
||||
ceilf(height * scale),
|
||||
clip.x0, clip.y0,
|
||||
clip.x1, clip.y1,
|
||||
ceilf(height * scale), &clip,
|
||||
scale, *background_colour,
|
||||
repeat_x, repeat_y))
|
||||
return false;
|
||||
|
@ -537,10 +537,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw,
|
||||
* \param y coordinate for top-left of redraw
|
||||
* \param width available width
|
||||
* \param height available height
|
||||
* \param clip_x0 clip rectangle
|
||||
* \param clip_y0 clip rectangle
|
||||
* \param clip_x1 clip rectangle
|
||||
* \param clip_y1 clip rectangle
|
||||
* \param clip clip rectangle
|
||||
* \param scale scale for redraw
|
||||
* \param background_colour the background colour
|
||||
* \return true if successful, false otherwise
|
||||
@ -549,8 +546,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw,
|
||||
*/
|
||||
|
||||
bool textplain_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
struct browser_window *bw = current_redraw_browser;
|
||||
@ -559,18 +555,12 @@ bool textplain_redraw(struct content *c, int x, int y,
|
||||
unsigned long line_count = c->data.textplain.physical_line_count;
|
||||
float line_height = textplain_line_height();
|
||||
float scaled_line_height = line_height * scale;
|
||||
long line0 = clip_y0 / scaled_line_height - 1;
|
||||
long line1 = clip_y1 / scaled_line_height + 1;
|
||||
long line0 = clip->y0 / scaled_line_height - 1;
|
||||
long line1 = clip->y1 / scaled_line_height + 1;
|
||||
struct textplain_line *line = c->data.textplain.physical_line;
|
||||
struct rect clip;
|
||||
size_t length;
|
||||
plot_style_t *plot_style_highlight;
|
||||
|
||||
clip.x0 = clip_x0;
|
||||
clip.y0 = clip_y0;
|
||||
clip.x1 = clip_x1;
|
||||
clip.y1 = clip_y1;
|
||||
|
||||
if (line0 < 0)
|
||||
line0 = 0;
|
||||
if (line1 < 0)
|
||||
@ -582,7 +572,8 @@ bool textplain_redraw(struct content *c, int x, int y,
|
||||
if (line1 < line0)
|
||||
line1 = line0;
|
||||
|
||||
if (!plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white))
|
||||
if (!plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
|
||||
plot_style_fill_white))
|
||||
return false;
|
||||
|
||||
if (!line)
|
||||
@ -623,7 +614,7 @@ bool textplain_redraw(struct content *c, int x, int y,
|
||||
line[lineno].start + offset, false,
|
||||
&textplain_style,
|
||||
tx, y + (lineno * scaled_line_height),
|
||||
&clip, line_height, scale, false))
|
||||
clip, line_height, scale, false))
|
||||
return false;
|
||||
|
||||
if (next_offset >= length)
|
||||
|
@ -30,6 +30,7 @@
|
||||
struct content;
|
||||
struct hlcache_handle;
|
||||
struct http_parameter;
|
||||
struct rect;
|
||||
|
||||
struct textplain_line {
|
||||
size_t start;
|
||||
@ -58,8 +59,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw,
|
||||
void textplain_reformat(struct content *c, int width, int height);
|
||||
void textplain_destroy(struct content *c);
|
||||
bool textplain_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool textplain_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -224,8 +224,7 @@ void artworks_destroy(struct content *c)
|
||||
*/
|
||||
|
||||
bool artworks_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
static const ns_os_vdu_var_list vars = {
|
||||
@ -243,6 +242,11 @@ bool artworks_redraw(struct content *c, int x, int y,
|
||||
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 (plot.flush && !plot.flush())
|
||||
return false;
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#define _NETSURF_RISCOS_ARTWORKS_H_
|
||||
|
||||
struct content;
|
||||
struct rect;
|
||||
|
||||
struct content_artworks_data {
|
||||
int x0, y0, x1, y1;
|
||||
@ -41,8 +42,7 @@ struct content_artworks_data {
|
||||
bool artworks_convert(struct content *c);
|
||||
void artworks_destroy(struct content *c);
|
||||
bool artworks_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool artworks_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -105,8 +105,7 @@ 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,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
os_trfm matrix;
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
struct content;
|
||||
struct rect;
|
||||
|
||||
struct content_draw_data {
|
||||
int x0, y0;
|
||||
@ -37,8 +38,7 @@ struct content_draw_data {
|
||||
bool draw_convert(struct content *c);
|
||||
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,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool draw_clone(const struct content *old, struct content *new_content);
|
||||
|
||||
|
@ -245,12 +245,11 @@ void plugin_destroy(struct content *c)
|
||||
* \param y Top of content box
|
||||
* \param width Width of content box
|
||||
* \param height Height of content box
|
||||
* \param clip[xy][01] Clipping rectangle
|
||||
* \param clip Clipping rectangle
|
||||
* \param scale Scale of page (1.0 = 100%)
|
||||
*/
|
||||
bool plugin_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
/* do nothing */
|
||||
|
@ -31,6 +31,7 @@ struct browser_window;
|
||||
struct content;
|
||||
struct object_params;
|
||||
struct plugin_stream;
|
||||
struct rect;
|
||||
|
||||
/* We have one content per instance of a plugin */
|
||||
struct content_plugin_data {
|
||||
@ -58,8 +59,7 @@ bool plugin_convert(struct content *c, int width, int height);
|
||||
void plugin_reformat(struct content *c, int width, int height);
|
||||
void plugin_destroy(struct content *c);
|
||||
bool plugin_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
void plugin_open(struct content *c, struct browser_window *bw,
|
||||
struct content *page, unsigned int index, struct box *box,
|
||||
|
@ -635,7 +635,7 @@ bool print_document(struct gui_window *g, const char *filename)
|
||||
print_active = true;
|
||||
|
||||
do {
|
||||
int clip_x0, clip_y0, clip_x1, clip_y1;
|
||||
struct rect clip;
|
||||
os_box b;
|
||||
os_hom_trfm t;
|
||||
os_coord p;
|
||||
@ -697,14 +697,14 @@ bool print_document(struct gui_window *g, const char *filename)
|
||||
while (more) {
|
||||
LOG(("redrawing area: [(%d, %d), (%d, %d)]",
|
||||
b.x0, b.y0, b.x1, b.y1));
|
||||
clip_x0 = (b.x0 - ro_plot_origin_x) / 2;
|
||||
clip_y0 = (ro_plot_origin_y - b.y1) / 2;
|
||||
clip_x1 = (b.x1 - ro_plot_origin_x) / 2;
|
||||
clip_y1 = (ro_plot_origin_y - b.y0) / 2;
|
||||
clip.x0 = (b.x0 - ro_plot_origin_x) / 2;
|
||||
clip.y0 = (ro_plot_origin_y - b.y1) / 2;
|
||||
clip.x1 = (b.x1 - ro_plot_origin_x) / 2;
|
||||
clip.y1 = (ro_plot_origin_y - b.y0) / 2;
|
||||
if (!content_redraw(h, 0, 0,
|
||||
content_get_width(h),
|
||||
content_get_height(h),
|
||||
clip_x0, clip_y0, clip_x1, clip_y1,
|
||||
&clip,
|
||||
print_scale,
|
||||
0xFFFFFF)) {
|
||||
error_message = "redraw error";
|
||||
@ -805,6 +805,7 @@ error:
|
||||
const char *print_declare_fonts(hlcache_handle *h)
|
||||
{
|
||||
unsigned int i;
|
||||
struct rect clip;
|
||||
const char *error_message = 0;
|
||||
os_error *error;
|
||||
|
||||
@ -813,10 +814,13 @@ const char *print_declare_fonts(hlcache_handle *h)
|
||||
print_fonts_count = 0;
|
||||
print_fonts_error = 0;
|
||||
|
||||
clip.x0 = clip.y0 = INT_MIN;
|
||||
clip.x1 = clip.y1 = INT_MAX;
|
||||
|
||||
plot = print_fonts_plotters;
|
||||
if (!content_redraw(h, 0, 0, content_get_width(h),
|
||||
content_get_height(h),
|
||||
INT_MIN, INT_MIN, INT_MAX, INT_MAX, 1, 0xffffff)) {
|
||||
&clip, 1, 0xffffff)) {
|
||||
if (print_fonts_error)
|
||||
return print_fonts_error;
|
||||
return "Declaring fonts failed.";
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "content/content.h"
|
||||
#include "content/hlcache.h"
|
||||
#include "desktop/plotters.h"
|
||||
#include "desktop/shape.h"
|
||||
#include "riscos/bitmap.h"
|
||||
#include "riscos/gui.h"
|
||||
#include "riscos/save_draw.h"
|
||||
@ -89,6 +90,7 @@ bool save_as_draw(hlcache_handle *h, const char *path)
|
||||
{
|
||||
pencil_code code;
|
||||
char *drawfile_buffer;
|
||||
struct rect clip;
|
||||
size_t drawfile_size;
|
||||
os_error *error;
|
||||
|
||||
@ -101,10 +103,13 @@ bool save_as_draw(hlcache_handle *h, const char *path)
|
||||
ro_save_draw_width = content_get_width(h);
|
||||
ro_save_draw_height = content_get_height(h);
|
||||
|
||||
clip.x0 = clip.y0 = INT_MIN;
|
||||
clip.x1 = clip.y1 = INT_MAX;
|
||||
|
||||
plot = ro_save_draw_plotters;
|
||||
if (!content_redraw(h, 0, -ro_save_draw_height,
|
||||
ro_save_draw_width, ro_save_draw_height,
|
||||
INT_MIN, INT_MIN, INT_MAX, INT_MAX,
|
||||
&clip,
|
||||
1,
|
||||
0xFFFFFF))
|
||||
{
|
||||
|
@ -112,8 +112,7 @@ void sprite_destroy(struct content *c)
|
||||
*/
|
||||
|
||||
bool sprite_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour)
|
||||
{
|
||||
if (plot.flush && !plot.flush())
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
#ifdef WITH_SPRITE
|
||||
struct content;
|
||||
struct rect;
|
||||
|
||||
struct content_sprite_data {
|
||||
void *data;
|
||||
@ -37,8 +38,7 @@ struct content_sprite_data {
|
||||
bool sprite_convert(struct content *c);
|
||||
void sprite_destroy(struct content *c);
|
||||
bool sprite_redraw(struct content *c, int x, int y,
|
||||
int width, int height,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
int width, int height, struct rect *clip,
|
||||
float scale, colour background_colour);
|
||||
bool sprite_clone(const struct content *old, struct content *new_content);
|
||||
#endif
|
||||
|
@ -83,6 +83,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
{
|
||||
float scale = 1.0;
|
||||
struct thumbnail_save_area *save_area;
|
||||
struct rect clip;
|
||||
osspriteop_area *sprite_area = NULL;
|
||||
osspriteop_header *sprite_header = NULL;
|
||||
_kernel_oserror *error;
|
||||
@ -130,8 +131,12 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap,
|
||||
colourtrans_set_gcol(os_COLOUR_WHITE, colourtrans_SET_BG_GCOL,
|
||||
os_ACTION_OVERWRITE, 0);
|
||||
os_clg();
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = bitmap->width;
|
||||
clip.y1 = bitmap->height;
|
||||
content_redraw(content, 0, 0, bitmap->width, bitmap->height,
|
||||
0, 0, bitmap->width, bitmap->height, scale, 0xFFFFFF);
|
||||
&clip, scale, 0xFFFFFF);
|
||||
thumbnail_restore_output(save_area);
|
||||
rufl_invalidate_cache();
|
||||
|
||||
|
@ -39,10 +39,16 @@ thumbnail_create(hlcache_handle *content,
|
||||
HDC hdc, bufferdc, minidc;
|
||||
|
||||
struct bitmap *fsbitmap;
|
||||
struct rect clip;
|
||||
|
||||
width = min(content_get_width(content), 800);
|
||||
height = min(content_get_height(content), 600);
|
||||
|
||||
clip.x0 = 0;
|
||||
clip.y0 = 0;
|
||||
clip.x1 = width;
|
||||
clip.y1 = height;
|
||||
|
||||
LOG(("bitmap %p for url %s content %p width %d, height %d",
|
||||
bitmap, url, content, width, height));
|
||||
|
||||
@ -65,8 +71,7 @@ thumbnail_create(hlcache_handle *content,
|
||||
|
||||
hdc = plot_hdc;
|
||||
plot_hdc = bufferdc;
|
||||
content_redraw(content, 0, 0, width, height, 0, 0,
|
||||
width, height, 1.0, 0xFFFFFF);
|
||||
content_redraw(content, 0, 0, width, height, &clip, 1.0, 0xFFFFFF);
|
||||
plot_hdc = hdc;
|
||||
|
||||
/* scale bitmap bufferbm into minibm */
|
||||
|
Loading…
Reference in New Issue
Block a user