blitter: Base horizontal adjust on scanline, not width
When we draw a BMP that has a width that is not a multiple of 8, some black pixels show up on the right, and the left part is truncated. The root cause is that the horizontal adjustment uses the width and not the scanline, so we don't get the correct range of pixels. Code inspection also showed that there was an error in the size of the datalen being returned from `grob::pixels`, because it returnes the size of the object, not the size of the data bitmap. Fixes: #1043 Signed-off-by: Christophe de Dinechin <christophe@dinechin.org>
Before Width: | Height: | Size: 8.2 KiB After Width: | Height: | Size: 8.1 KiB |
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
doc/img/definition_of_e.bmp
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
doc/img/definition_of_pi.bmp
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
doc/img/imaginary_unit.bmp
Normal file
After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 4 KiB After Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.4 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4 KiB |
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
|
@ -430,6 +430,7 @@ struct blitter
|
|||
drawable &= rect(w, h);
|
||||
}
|
||||
|
||||
|
||||
void clip(coord x1, coord y1, coord x2, coord y2)
|
||||
// --------------------------------------------------------------------
|
||||
// Clip an area given in coordinates
|
||||
|
@ -1672,7 +1673,7 @@ inline void blitter::surface<blitter::MONOCHROME_REVERSE>::horizontal_adjust(
|
|||
// On the DM42, we need horizontal adjustment for coordinates
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
size w = width() - 1;
|
||||
size w = scanline - 1;
|
||||
coord ox1 = w - x2;
|
||||
x2 = w - x1;
|
||||
x1 = ox1;
|
||||
|
@ -1697,7 +1698,7 @@ inline void blitter::surface<blitter::RGB_16BPP>::horizontal_adjust(
|
|||
// On the DM42, we need horizontal adjustment for coordinates
|
||||
// ----------------------------------------------------------------------------
|
||||
{
|
||||
size w = width() - 1;
|
||||
size w = scanline - 1;
|
||||
coord ox1 = w - x2;
|
||||
x2 = w - x1;
|
||||
x1 = ox1;
|
||||
|
|
|
@ -79,15 +79,16 @@ static void bitflip(byte *start, uint width, uint height, bool forward)
|
|||
{
|
||||
#ifdef REVERSE_GROBS
|
||||
uint scan = (width + 7) / 8;
|
||||
uint scanline = scan * 8;
|
||||
for (uint y = 0; y < height; y++)
|
||||
{
|
||||
byte *row = start + scan * y;
|
||||
if (forward)
|
||||
for (uint r = 0; r < scan; r++)
|
||||
row[r] = ~((row[r] >> 4) | (row[r] << 4));
|
||||
for (uint x = 0; x < width / 2; x++)
|
||||
for (uint x = 0; x < scanline / 2; x++)
|
||||
{
|
||||
uint r = width - 1 - x;
|
||||
uint r = scanline - 1 - x;
|
||||
uint lo = x / 8;
|
||||
uint ro = r / 8;
|
||||
uint lb = x % 8;
|
||||
|
|
|
@ -173,7 +173,7 @@ struct grob : object
|
|||
if (height)
|
||||
*height = h;
|
||||
if (datalen)
|
||||
*datalen = bytesize(type(), w, h);
|
||||
*datalen = datasize(type(), w, h);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
|