summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2011-02-12 19:26:49 +0000
committerOle Loots <ole@monochrom.net>2011-02-12 19:26:49 +0000
commit51daecb26cf6621f2021594e63d33fe71b4d0326 (patch)
tree1d1727efd8709ea59635dc704a397c5d7ca525c1
parent5487b42cb783dca4c39cb865efa43e6c897ea61e (diff)
downloadnetsurf-51daecb26cf6621f2021594e63d33fe71b4d0326.tar.gz
netsurf-51daecb26cf6621f2021594e63d33fe71b4d0326.tar.bz2
Optimized drawing of repeating 1px sized bitmaps.
svn path=/trunk/netsurf/; revision=11651
-rwxr-xr-xatari/plot.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/atari/plot.c b/atari/plot.c
index 1dd807356..2bfe37923 100755
--- a/atari/plot.c
+++ b/atari/plot.c
@@ -150,12 +150,31 @@ static bool plot_bitmap(int x, int y, int width, int height,
struct bitmap * bm = NULL;
bool repeat_x = (flags & BITMAPF_REPEAT_X);
bool repeat_y = (flags & BITMAPF_REPEAT_Y);
-
+ int bmpw,bmph;
+ struct s_clipping clip;
+
if( option_suppress_images != 0 ) {
return( true );
}
- if( width != bitmap_get_width(bitmap) || height != bitmap_get_height( bitmap) ) {
+ bmpw = bitmap_get_width(bitmap);
+ bmph = bitmap_get_height(bitmap);
+
+ if ( repeat_x || repeat_y ) {
+ plotter_get_clip( plotter, &clip );
+ if( repeat_x && width == 1 && repeat_y && height == 1 ){
+ width = MAX( width, clip.x1 - x );
+ height = MAX( height, clip.y1 - y );
+ }
+ else if( repeat_x && width == 1 ){
+ width = MAX( width, clip.x1 - x);
+ }
+ else if( repeat_y && height == 1){
+ height = MAX( height, clip.y1 - y );
+ }
+ }
+
+ if( width != bmpw || height != bmph ) {
assert( plotter->bitmap_resize(plotter, bitmap, width, height ) == 0);
bm = bitmap->resized;
} else {
@@ -170,8 +189,6 @@ static bool plot_bitmap(int x, int y, int width, int height,
plotter->bitmap( plotter, bm, x, y, bg, flags );
} else {
int xf,yf;
- struct s_clipping clip;
- plotter_get_clip( plotter, &clip );
int xoff = x;
int yoff = y;
/* for now, repeating just works in the rigth / down direction */
@@ -181,6 +198,7 @@ static bool plot_bitmap(int x, int y, int width, int height,
if(repeat_y == true )
yoff = clip.y0;
*/
+
for( xf = xoff; xf < clip.x1; xf += width ) {
for( yf = yoff; yf < clip.y1; yf += height ) {
plotter->bitmap( plotter, bm, xf, yf, bg, flags );