Pass canvas to gr_bm_pixel

This commit is contained in:
Kp 2017-01-01 00:45:44 +00:00
parent 2be580df0c
commit 774dedd21d
6 changed files with 13 additions and 12 deletions

View file

@ -279,7 +279,7 @@ void gr_bm_ubitblt(unsigned w, unsigned h, int dx, int dy, int sx, int sy, const
for (uint_fast32_t y1 = 0; y1 != h; ++y1)
for (uint_fast32_t x1 = 0; x1 != w; ++x1)
gr_bm_pixel(dest, dx+x1, dy+y1, gr_gpixel(src,sx+x1,sy+y1) );
gr_bm_pixel(*grd_curcanv, dest, dx + x1, dy + y1, gr_gpixel(src, sx + x1, sy + y1));
}
#endif
@ -370,7 +370,7 @@ void gr_bm_ubitbltm(unsigned w, unsigned h, unsigned dx, unsigned dy, unsigned s
for (uint_fast32_t y1 = 0; y1 != h; ++y1)
for (uint_fast32_t x1 = 0; x1 != w; ++x1)
if ((c=gr_gpixel(src,sx+x1,sy+y1))!=255)
gr_bm_pixel(dest, dx+x1, dy+y1,c );
gr_bm_pixel(*grd_curcanv, dest, dx + x1, dy + y1, c);
}
#endif

View file

@ -72,11 +72,11 @@ static inline void gr_bm_upixel(grs_canvas &canvas, grs_bitmap &bm, const uint_f
}
}
void gr_bm_pixel(grs_bitmap &bm, uint_fast32_t x, uint_fast32_t y, uint8_t color )
void gr_bm_pixel(grs_canvas &canvas, grs_bitmap &bm, const uint_fast32_t x, const uint_fast32_t y, const uint8_t color)
{
if (unlikely(x >= bm.bm_w || y >= bm.bm_h))
return;
gr_bm_upixel(*grd_curcanv, bm, x, y, color);
gr_bm_upixel(canvas, bm, x, y, color);
}
}

View file

@ -469,12 +469,12 @@ void gr_rle_expand_scanline_generic(grs_bitmap &dest, int dx, int dy, const ubyt
if ( x1+count > x2 ) {
count = x2-x1+1;
for ( int j=0; j<count; j++ )
gr_bm_pixel(dest, dx++, dy, color );
gr_bm_pixel(*grd_curcanv, dest, dx++, dy, color);
return;
}
for ( int j=0; j<count; j++ )
gr_bm_pixel(dest, dx++, dy, color );
gr_bm_pixel(*grd_curcanv, dest, dx++, dy, color);
i += count;
while( i <= x2 ) {
@ -490,12 +490,12 @@ void gr_rle_expand_scanline_generic(grs_bitmap &dest, int dx, int dy, const ubyt
// we know have '*count' pixels of 'color'.
if ( i+count <= x2 ) {
for ( int j=0; j<count; j++ )
gr_bm_pixel(dest, dx++, dy, color );
gr_bm_pixel(*grd_curcanv, dest, dx++, dy, color);
i += count;
} else {
count = x2-i+1;
for ( int j=0; j<count; j++ )
gr_bm_pixel(dest, dx++, dy, color );
gr_bm_pixel(*grd_curcanv, dest, dx++, dy, color);
i += count;
}
}

View file

@ -162,12 +162,13 @@ grs_subbitmap_ptr gr_create_sub_bitmap(grs_bitmap &bm, uint16_t x, uint16_t y, u
// Free the bitmap's data
void gr_init_bitmap_data (grs_bitmap &bm);
void gr_bm_pixel(grs_bitmap &bm, uint_fast32_t x, uint_fast32_t y, uint8_t color);
#if !DXX_USE_OGL
void gr_bm_ubitblt(unsigned w, unsigned h, int dx, int dy, int sx, int sy, const grs_bitmap &src, grs_bitmap &dest);
void gr_bm_ubitbltm(unsigned w, unsigned h, unsigned dx, unsigned dy, unsigned sx, unsigned sy, const grs_bitmap &src, grs_bitmap &dest);
#define gr_bm_pixel(C,B,X,Y,C2) gr_bm_pixel(B,X,Y,C2)
#define gr_settransblend(A,B,C) gr_settransblend(A,B)
#endif
void gr_bm_pixel(grs_canvas &, grs_bitmap &bm, uint_fast32_t x, uint_fast32_t y, uint8_t color);
void gr_set_bitmap_data(grs_bitmap &bm, const uint8_t *data);
}

View file

@ -271,10 +271,10 @@ static int pcx_read_bitmap_file(struct PCX_PHYSFS_file *const pcxphysfs, grs_mai
return PCX_ERROR_READING;
}
for (i=0;i<count;i++)
gr_bm_pixel(bmp, col+i, row, data );
gr_bm_pixel(*grd_curcanv, bmp, col+i, row, data);
col += count;
} else {
gr_bm_pixel(bmp, col, row, data );
gr_bm_pixel(*grd_curcanv, bmp, col, row, data);
col++;
}
}

View file

@ -496,7 +496,7 @@ static int convert_rgb15(grs_bitmap &bm,iff_bitmap_header &bmheader)
#if defined(DXX_BUILD_DESCENT_I)
for (int y=0; y < bm.bm_h; y++) {
for (int x=0; x < bmheader.w; x++)
gr_bm_pixel(bm, x, y, INDEX_TO_15BPP(bm.get_bitmap_data()[y * bmheader.w + x]));
gr_bm_pixel(*grd_curcanv, bm, x, y, INDEX_TO_15BPP(bm.get_bitmap_data()[y * bmheader.w + x]));
}
#elif defined(DXX_BUILD_DESCENT_II)
uint16_t *new_data;