[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freetype2-demos] master b4e28d5: * graph/gblblit.c (gblender_blit_init)
From: |
Alexei Podtelezhnikov |
Subject: |
[freetype2-demos] master b4e28d5: * graph/gblblit.c (gblender_blit_init): Switch to lookup table. |
Date: |
Fri, 14 Jun 2019 22:53:52 -0400 (EDT) |
branch: master
commit b4e28d5cb56acb9de0df9d0e7adfda877afbd978
Author: Alexei Podtelezhnikov <address@hidden>
Commit: Alexei Podtelezhnikov <address@hidden>
* graph/gblblit.c (gblender_blit_init): Switch to lookup table.
* graph/gblany.h: Updated.
---
ChangeLog | 7 +++-
graph/gblany.h | 12 +++++++
graph/gblblit.c | 99 ++++++++-------------------------------------------------
3 files changed, 31 insertions(+), 87 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 4e38c02..7a7a52d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,9 @@
-2019-06-10 Alexei Podtelezhnikov <address@hidden>
+2019-06-14 Alexei Podtelezhnikov <address@hidden>
+
+ * graph/gblblit.c (gblender_blit_init): Switch to lookup table.
+ * graph/gblany.h: Updated.
+
+2019-06-12 Alexei Podtelezhnikov <address@hidden>
* src/ttdebug.c (RunIns): Return error like `TT_RunIns'.
(Abort): Add error messages.
diff --git a/graph/gblany.h b/graph/gblany.h
index 21a1721..7ae46a4 100644
--- a/graph/gblany.h
+++ b/graph/gblany.h
@@ -125,6 +125,18 @@ GCONCAT( _gblender_blit_bgra_, GDST_TYPE )( GBlenderBlit
blit,
}
+static const GBlenderBlitFunc
+GCONCAT( blit_funcs_, GDST_TYPE )[GBLENDER_SOURCE_MAX] =
+{
+ GCONCAT( _gblender_blit_gray8_, GDST_TYPE ),
+ GCONCAT( _gblender_blit_hrgb_, GDST_TYPE ),
+ GCONCAT( _gblender_blit_hbgr_, GDST_TYPE ),
+ GCONCAT( _gblender_blit_vrgb_, GDST_TYPE ),
+ GCONCAT( _gblender_blit_vbgr_, GDST_TYPE ),
+ GCONCAT( _gblender_blit_bgra_, GDST_TYPE )
+};
+
+
/* unset the macros, to prevent accidental re-use
*/
diff --git a/graph/gblblit.c b/graph/gblblit.c
index 4ac0640..6baabdd 100644
--- a/graph/gblblit.c
+++ b/graph/gblblit.c
@@ -190,6 +190,17 @@
/* */
+static const GBlenderBlitFunc*
+blit_funcs[GBLENDER_TARGET_MAX] =
+{
+ blit_funcs_gray8,
+ blit_funcs_rgb32,
+ blit_funcs_rgb24,
+ blit_funcs_rgb565,
+ blit_funcs_bgr565
+};
+
+
static void
_gblender_blit_dummy( GBlenderBlit blit,
GBlenderPixel color )
@@ -218,96 +229,12 @@ gblender_blit_init( GBlenderBlit blit,
int src_x = 0;
int src_y = 0;
int delta;
- GBlenderBlitFunc blit_func = 0;
- switch ( src_format )
- {
- case GBLENDER_SOURCE_GRAY8:
- switch ( dst_format )
- {
- case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_gray8_rgb32;
break;
- case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_gray8_rgb24;
break;
- case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_gray8_rgb565;
break;
- case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_gray8_bgr565;
break;
- case GBLENDER_TARGET_GRAY8: blit_func = _gblender_blit_gray8_gray8;
break;
- default:
- ;
- }
- break;
-
- case GBLENDER_SOURCE_HRGB:
- switch ( dst_format )
- {
- case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_hrgb_rgb32;
break;
- case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_hrgb_rgb24;
break;
- case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_hrgb_rgb565;
break;
- case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_hrgb_bgr565;
break;
- case GBLENDER_TARGET_GRAY8: blit_func = _gblender_blit_hrgb_gray8;
break;
- default:
- ;
- }
- break;
-
- case GBLENDER_SOURCE_HBGR:
- switch ( dst_format )
- {
- case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_hbgr_rgb32;
break;
- case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_hbgr_rgb24;
break;
- case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_hbgr_rgb565;
break;
- case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_hbgr_bgr565;
break;
- case GBLENDER_TARGET_GRAY8: blit_func = _gblender_blit_hbgr_gray8;
break;
- default:
- ;
- }
- break;
-
- case GBLENDER_SOURCE_VRGB:
- switch ( dst_format )
- {
- case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_vrgb_rgb32;
break;
- case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_vrgb_rgb24;
break;
- case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_vrgb_rgb565;
break;
- case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_vrgb_bgr565;
break;
- case GBLENDER_TARGET_GRAY8: blit_func = _gblender_blit_vrgb_gray8;
break;
- default:
- ;
- }
- break;
-
- case GBLENDER_SOURCE_VBGR:
- switch ( dst_format )
- {
- case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_vbgr_rgb32;
break;
- case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_vbgr_rgb24;
break;
- case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_vbgr_rgb565;
break;
- case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_vbgr_bgr565;
break;
- case GBLENDER_TARGET_GRAY8: blit_func = _gblender_blit_vbgr_gray8;
break;
- default:
- ;
- }
- break;
-
- case GBLENDER_SOURCE_BGRA:
- switch ( dst_format )
- {
- case GBLENDER_TARGET_RGB32: blit_func = _gblender_blit_bgra_rgb32;
break;
- case GBLENDER_TARGET_RGB24: blit_func = _gblender_blit_bgra_rgb24;
break;
- case GBLENDER_TARGET_RGB565: blit_func = _gblender_blit_bgra_rgb565;
break;
- case GBLENDER_TARGET_BGR565: blit_func = _gblender_blit_bgra_bgr565;
break;
- case GBLENDER_TARGET_GRAY8: blit_func = _gblender_blit_bgra_gray8;
break;
- default:
- ;
- }
- break;
-
- default:
- ;
- }
blit->blender = blender;
- blit->blit_func = blit_func;
+ blit->blit_func = blit_funcs[dst_format][src_format];
- if ( blit_func == 0 )
+ if ( blit->blit_func == 0 )
{
/* unsupported blit mode
*/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freetype2-demos] master b4e28d5: * graph/gblblit.c (gblender_blit_init): Switch to lookup table.,
Alexei Podtelezhnikov <=