Commit 57a37916 authored by Alexei Podtelezhnikov's avatar Alexei Podtelezhnikov

[graph] Handle mono bitmaps in the main blender.

* graph/gblany.h (_gblender_blit_mono_*): Implement it.
* graph/gblblit.c (gblender_blit_init): Recognize mono bitmaps.
* graph/gblblit.h (GBlenderSourceFormat): Add GBLENDER_SOURCE_MONO.
parent e2ea6d2e
2021-01-25 Alexei Podtelezhnikov <apodtele@gmail.com>
[graph] Handle mono bitmaps in the main blender.
  • @wl Hi Werner! Technically after this commit we do not need the legacy blender (grblit.c). There are no cases to handle there, except weird number of grays. Do you mind if I remove it from the default build?

  • I don't mind :-) If problems occur I guess it can be resurrected quite easily.

Please register or sign in to reply
* graph/gblany.h (_gblender_blit_mono_*): Implement it.
* graph/gblblit.c (gblender_blit_init): Recognize mono bitmaps.
* graph/gblblit.h (GBlenderSourceFormat): Add GBLENDER_SOURCE_MONO.
2021-01-24 Alexei Podtelezhnikov <apodtele@gmail.com>
* Makefile (FT_INCLUDES): Drop `$(TOP_DIR)/src/dlg`.
......
......@@ -476,6 +476,48 @@ GCONCAT( _gblender_blit_bgra_, GDST_TYPE )( GBlenderBlit blit,
}
static void
GCONCAT( _gblender_blit_mono_, GDST_TYPE )( GBlenderBlit blit,
grColor color )
{
int h = blit->height;
unsigned char* dst_line = blit->dst_line + blit->dst_x*GDST_INCR;
const unsigned char* src_line = blit->src_line + ( blit->src_x >> 3 );
unsigned int src_mask = 0x80 >> ( blit->src_x & 7 );
do
{
const unsigned char* src = src_line;
unsigned int a8 = *src;
unsigned int msk = src_mask;
unsigned char* dst = dst_line;
int w = blit->width;
do
{
if ( !msk )
{
a8 = *++src;
msk = 0x80;
}
if ( a8 & msk )
{
GDST_COPY(dst);
}
msk >>= 1;
dst += GDST_INCR;
}
while (--w > 0);
src_line += blit->src_pitch;
dst_line += blit->dst_pitch;
}
while (--h > 0);
}
static const GBlenderBlitFunc
GCONCAT( blit_funcs_, GDST_TYPE )[GBLENDER_SOURCE_MAX] =
{
......@@ -484,7 +526,8 @@ GCONCAT( blit_funcs_, GDST_TYPE )[GBLENDER_SOURCE_MAX] =
GCONCAT( _gblender_blit_hbgr_, GDST_TYPE ),
GCONCAT( _gblender_blit_vrgb_, GDST_TYPE ),
GCONCAT( _gblender_blit_vbgr_, GDST_TYPE ),
GCONCAT( _gblender_blit_bgra_, GDST_TYPE )
GCONCAT( _gblender_blit_bgra_, GDST_TYPE ),
GCONCAT( _gblender_blit_mono_, GDST_TYPE )
};
......
......@@ -262,9 +262,6 @@ gblender_blit_init( GBlenderBlit blit,
int dst_height = target->rows;
if ( glyph->grays != 256 )
return -2;
switch ( glyph->mode )
{
case gr_pixel_mode_gray: src_format = GBLENDER_SOURCE_GRAY8;
......@@ -288,6 +285,8 @@ gblender_blit_init( GBlenderBlit blit,
break;
case gr_pixel_mode_bgra: src_format = GBLENDER_SOURCE_BGRA;
break;
case gr_pixel_mode_mono: src_format = GBLENDER_SOURCE_MONO;
break;
default:
return -2;
}
......
......@@ -17,6 +17,7 @@ typedef enum
GBLENDER_SOURCE_VRGB,
GBLENDER_SOURCE_VBGR,
GBLENDER_SOURCE_BGRA,
GBLENDER_SOURCE_MONO,
GBLENDER_SOURCE_MAX
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment