summaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-06-30 13:02:23 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-06-30 13:02:23 +0000
commitaa2684341170424783f9937d8fe441fb3984d825 (patch)
treeb7b1adaf3867666f15d7bf9bacf804846372eff7 /image
parent38356d46ff15fe669c59bdf6aa96b7f4248d1b6a (diff)
downloadnetsurf-aa2684341170424783f9937d8fe441fb3984d825.tar.gz
netsurf-aa2684341170424783f9937d8fe441fb3984d825.tar.bz2
Improve bitmap plotter API
svn path=/trunk/netsurf/; revision=8195
Diffstat (limited to 'image')
-rw-r--r--image/bmp.c16
-rw-r--r--image/gif.c14
-rw-r--r--image/ico.c16
-rw-r--r--image/jpeg.c13
-rw-r--r--image/mng.c12
-rw-r--r--image/png.c25
-rw-r--r--image/rsvg.c2
7 files changed, 70 insertions, 28 deletions
diff --git a/image/bmp.c b/image/bmp.c
index ac2fbf2b6..b7ca94b9c 100644
--- a/image/bmp.c
+++ b/image/bmp.c
@@ -123,7 +123,7 @@ bool nsbmp_redraw(struct content *c, int x, int y,
return false;
c->bitmap = c->data.bmp.bmp->bitmap;
return plot.bitmap(x, y, width, height, c->bitmap,
- background_colour, c);
+ background_colour, BITMAPF_NONE);
}
@@ -133,13 +133,21 @@ bool nsbmp_redraw_tiled(struct content *c, int x, int y,
float scale, colour background_colour,
bool repeat_x, bool repeat_y)
{
+ bitmap_flags_t flags = BITMAPF_NONE;
if (!c->data.bmp.bmp->decoded)
- if (bmp_decode(c->data.bmp.bmp) != BMP_OK)
+ if (bmp_decode(c->data.bmp.bmp) != BMP_OK)
return false;
+
c->bitmap = c->data.bmp.bmp->bitmap;
- return plot.bitmap_tile(x, y, width, height, c->bitmap,
- background_colour, repeat_x, repeat_y, c);
+
+ if (repeat_x)
+ flags |= BITMAPF_REPEAT_X;
+ if (repeat_y)
+ flags |= BITMAPF_REPEAT_Y;
+
+ return plot.bitmap(x, y, width, height, c->bitmap,
+ background_colour, flags);
}
diff --git a/image/gif.c b/image/gif.c
index 433f7d823..e16275448 100644
--- a/image/gif.c
+++ b/image/gif.c
@@ -160,7 +160,7 @@ bool nsgif_redraw(struct content *c, int x, int y,
return false;
c->bitmap = c->data.gif.gif->frame_image;
return plot.bitmap(x, y, width, height, c->bitmap,
- background_colour, c);
+ background_colour, BITMAPF_NONE);
}
@@ -170,12 +170,20 @@ bool nsgif_redraw_tiled(struct content *c, int x, int y,
float scale, colour background_colour,
bool repeat_x, bool repeat_y)
{
+ bitmap_flags_t flags = BITMAPF_NONE;
+
if (c->data.gif.current_frame != c->data.gif.gif->decoded_frame)
if (nsgif_get_frame(c) != GIF_OK)
return false;
+
c->bitmap = c->data.gif.gif->frame_image;
- return plot.bitmap_tile(x, y, width, height, c->bitmap,
- background_colour, repeat_x, repeat_y, c);
+
+ if (repeat_x)
+ flags |= BITMAPF_REPEAT_X;
+ if (repeat_y)
+ flags |= BITMAPF_REPEAT_Y;
+
+ return plot.bitmap(x, y, width, height, c->bitmap, background_colour, flags);
}
diff --git a/image/ico.c b/image/ico.c
index 28cfcf76e..dc687a0e3 100644
--- a/image/ico.c
+++ b/image/ico.c
@@ -111,7 +111,7 @@ bool nsico_redraw(struct content *c, int x, int y,
return false;
c->bitmap = bmp->bitmap;
return plot.bitmap(x, y, width, height, c->bitmap,
- background_colour, c);
+ background_colour, BITMAPF_NONE);
}
@@ -122,12 +122,20 @@ bool nsico_redraw_tiled(struct content *c, int x, int y,
bool repeat_x, bool repeat_y)
{
struct bmp_image *bmp = ico_find(c->data.ico.ico, width, height);
+ bitmap_flags_t flags = BITMAPF_NONE;
+
if (!bmp->decoded)
- if (bmp_decode(bmp) != BMP_OK)
+ if (bmp_decode(bmp) != BMP_OK)
return false;
+
c->bitmap = bmp->bitmap;
- return plot.bitmap_tile(x, y, width, height, c->bitmap,
- background_colour, repeat_x, repeat_y, c);
+
+ if (repeat_x)
+ flags |= BITMAPF_REPEAT_X;
+ if (repeat_y)
+ flags |= BITMAPF_REPEAT_Y;
+
+ return plot.bitmap(x, y, width, height, c->bitmap, background_colour, flags);
}
diff --git a/image/jpeg.c b/image/jpeg.c
index 41cd3db74..ec93f7c73 100644
--- a/image/jpeg.c
+++ b/image/jpeg.c
@@ -242,7 +242,7 @@ bool nsjpeg_redraw(struct content *c, int x, int y,
float scale, colour background_colour)
{
return plot.bitmap(x, y, width, height,
- c->bitmap, background_colour, c);
+ c->bitmap, background_colour, BITMAPF_NONE);
}
@@ -256,9 +256,16 @@ bool nsjpeg_redraw_tiled(struct content *c, int x, int y,
float scale, colour background_colour,
bool repeat_x, bool repeat_y)
{
- return plot.bitmap_tile(x, y, width, height,
+ bitmap_flags_t flags = BITMAPF_NONE;
+
+ if (repeat_x)
+ flags |= BITMAPF_REPEAT_X;
+ if (repeat_y)
+ flags |= BITMAPF_REPEAT_Y;
+
+ return plot.bitmap(x, y, width, height,
c->bitmap, background_colour,
- repeat_x, repeat_y, c);
+ flags);
}
diff --git a/image/mng.c b/image/mng.c
index 08de81724..4f19d7202 100644
--- a/image/mng.c
+++ b/image/mng.c
@@ -542,7 +542,7 @@ bool nsmng_redraw(struct content *c, int x, int y,
}
ret = plot.bitmap(x, y, width, height,
- c->bitmap, background_colour, c);
+ c->bitmap, background_colour, BITMAPF_NONE);
/* Check if we need to restart the animation
*/
@@ -560,6 +560,7 @@ bool nsmng_redraw_tiled(struct content *c, int x, int y,
bool repeat_x, bool repeat_y)
{
bool ret;
+ bitmap_flags_t flags = BITMAPF_NONE;
/* mark image as having been requested to display */
c->data.mng.displayed = true;
@@ -569,9 +570,14 @@ bool nsmng_redraw_tiled(struct content *c, int x, int y,
c->data.mng.opaque_test_pending = false;
}
- ret = plot.bitmap_tile(x, y, width, height,
+ if (repeat_x)
+ flags |= BITMAPF_REPEAT_X;
+ if (repeat_y)
+ flags |= BITMAPF_REPEAT_Y;
+
+ ret = plot.bitmap(x, y, width, height,
c->bitmap, background_colour,
- repeat_x, repeat_y, c);
+ flags);
/* Check if we need to restart the animation
*/
diff --git a/image/png.c b/image/png.c
index 7fb6358a3..34c517d90 100644
--- a/image/png.c
+++ b/image/png.c
@@ -270,12 +270,11 @@ bool nspng_redraw(struct content *c, int x, int y,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale, colour background_colour)
{
- if (c->bitmap != NULL) {
- return plot.bitmap(x, y, width, height, c->bitmap,
- background_colour, c);
- }
+ if (c->bitmap == NULL)
+ return true;
- return true;
+ return plot.bitmap(x, y, width, height, c->bitmap,
+ background_colour, BITMAPF_NONE);
}
bool nspng_redraw_tiled(struct content *c, int x, int y, int width, int height,
@@ -283,12 +282,18 @@ bool nspng_redraw_tiled(struct content *c, int x, int y, int width, int height,
float scale, colour background_colour,
bool repeat_x, bool repeat_y)
{
- if (c->bitmap != NULL) {
- return plot.bitmap_tile(x, y, width, height, c->bitmap,
- background_colour, repeat_x, repeat_y, c);
- }
+ bitmap_flags_t flags = 0;
- return true;
+ if (c->bitmap == NULL)
+ return true;
+
+ if (repeat_x)
+ flags |= BITMAPF_REPEAT_X;
+ if (repeat_y)
+ flags |= BITMAPF_REPEAT_Y;
+
+ return plot.bitmap(x, y, width, height, c->bitmap,
+ background_colour, flags);
}
#endif
diff --git a/image/rsvg.c b/image/rsvg.c
index 9b408c4e5..b1d597052 100644
--- a/image/rsvg.c
+++ b/image/rsvg.c
@@ -183,7 +183,7 @@ 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,
float scale, colour background_colour)
{
- plot.bitmap(x, y, width, height, c->bitmap, background_colour, c);
+ plot.bitmap(x, y, width, height, c->bitmap, background_colour, BITMAPF_NONE);
return true;
}