Alexei Podtelezhnikov pushed to branch master at FreeType / FreeType Demo Programs
Commits:
-
57a37916
by Alexei Podtelezhnikov at 2021-01-25T13:59:47-05:00
4 changed files:
Changes:
1 |
+2021-01-25 Alexei Podtelezhnikov <apodtele@gmail.com>
|
|
2 |
+ |
|
3 |
+ [graph] Handle mono bitmaps in the main blender.
|
|
4 |
+ |
|
5 |
+ * graph/gblany.h (_gblender_blit_mono_*): Implement it.
|
|
6 |
+ * graph/gblblit.c (gblender_blit_init): Recognize mono bitmaps.
|
|
7 |
+ * graph/gblblit.h (GBlenderSourceFormat): Add GBLENDER_SOURCE_MONO.
|
|
8 |
+ |
|
1 | 9 |
2021-01-24 Alexei Podtelezhnikov <apodtele@gmail.com>
|
2 | 10 |
|
3 | 11 |
* Makefile (FT_INCLUDES): Drop `$(TOP_DIR)/src/dlg`.
|
... | ... | @@ -476,6 +476,48 @@ GCONCAT( _gblender_blit_bgra_, GDST_TYPE )( GBlenderBlit blit, |
476 | 476 |
}
|
477 | 477 |
|
478 | 478 |
|
479 |
+static void
|
|
480 |
+GCONCAT( _gblender_blit_mono_, GDST_TYPE )( GBlenderBlit blit,
|
|
481 |
+ grColor color )
|
|
482 |
+{
|
|
483 |
+ int h = blit->height;
|
|
484 |
+ unsigned char* dst_line = blit->dst_line + blit->dst_x*GDST_INCR;
|
|
485 |
+ const unsigned char* src_line = blit->src_line + ( blit->src_x >> 3 );
|
|
486 |
+ unsigned int src_mask = 0x80 >> ( blit->src_x & 7 );
|
|
487 |
+ |
|
488 |
+ do
|
|
489 |
+ {
|
|
490 |
+ const unsigned char* src = src_line;
|
|
491 |
+ unsigned int a8 = *src;
|
|
492 |
+ unsigned int msk = src_mask;
|
|
493 |
+ unsigned char* dst = dst_line;
|
|
494 |
+ int w = blit->width;
|
|
495 |
+ |
|
496 |
+ do
|
|
497 |
+ {
|
|
498 |
+ if ( !msk )
|
|
499 |
+ {
|
|
500 |
+ a8 = *++src;
|
|
501 |
+ msk = 0x80;
|
|
502 |
+ }
|
|
503 |
+ |
|
504 |
+ if ( a8 & msk )
|
|
505 |
+ {
|
|
506 |
+ GDST_COPY(dst);
|
|
507 |
+ }
|
|
508 |
+ |
|
509 |
+ msk >>= 1;
|
|
510 |
+ dst += GDST_INCR;
|
|
511 |
+ }
|
|
512 |
+ while (--w > 0);
|
|
513 |
+ |
|
514 |
+ src_line += blit->src_pitch;
|
|
515 |
+ dst_line += blit->dst_pitch;
|
|
516 |
+ }
|
|
517 |
+ while (--h > 0);
|
|
518 |
+}
|
|
519 |
+ |
|
520 |
+ |
|
479 | 521 |
static const GBlenderBlitFunc
|
480 | 522 |
GCONCAT( blit_funcs_, GDST_TYPE )[GBLENDER_SOURCE_MAX] =
|
481 | 523 |
{
|
... | ... | @@ -484,7 +526,8 @@ GCONCAT( blit_funcs_, GDST_TYPE )[GBLENDER_SOURCE_MAX] = |
484 | 526 |
GCONCAT( _gblender_blit_hbgr_, GDST_TYPE ),
|
485 | 527 |
GCONCAT( _gblender_blit_vrgb_, GDST_TYPE ),
|
486 | 528 |
GCONCAT( _gblender_blit_vbgr_, GDST_TYPE ),
|
487 |
- GCONCAT( _gblender_blit_bgra_, GDST_TYPE )
|
|
529 |
+ GCONCAT( _gblender_blit_bgra_, GDST_TYPE ),
|
|
530 |
+ GCONCAT( _gblender_blit_mono_, GDST_TYPE )
|
|
488 | 531 |
};
|
489 | 532 |
|
490 | 533 |
|
... | ... | @@ -262,9 +262,6 @@ gblender_blit_init( GBlenderBlit blit, |
262 | 262 |
int dst_height = target->rows;
|
263 | 263 |
|
264 | 264 |
|
265 |
- if ( glyph->grays != 256 )
|
|
266 |
- return -2;
|
|
267 |
- |
|
268 | 265 |
switch ( glyph->mode )
|
269 | 266 |
{
|
270 | 267 |
case gr_pixel_mode_gray: src_format = GBLENDER_SOURCE_GRAY8;
|
... | ... | @@ -288,6 +285,8 @@ gblender_blit_init( GBlenderBlit blit, |
288 | 285 |
break;
|
289 | 286 |
case gr_pixel_mode_bgra: src_format = GBLENDER_SOURCE_BGRA;
|
290 | 287 |
break;
|
288 |
+ case gr_pixel_mode_mono: src_format = GBLENDER_SOURCE_MONO;
|
|
289 |
+ break;
|
|
291 | 290 |
default:
|
292 | 291 |
return -2;
|
293 | 292 |
}
|
... | ... | @@ -17,6 +17,7 @@ typedef enum |
17 | 17 |
GBLENDER_SOURCE_VRGB,
|
18 | 18 |
GBLENDER_SOURCE_VBGR,
|
19 | 19 |
GBLENDER_SOURCE_BGRA,
|
20 |
+ GBLENDER_SOURCE_MONO,
|
|
20 | 21 |
|
21 | 22 |
GBLENDER_SOURCE_MAX
|
22 | 23 |
|