Skip to content

Commit 857ac75

Browse files
committed
Get rid of fillmask() and fillstretchmask() GFX operators
No longer needed; same functionality can now also be achieved by blitting from a P1_MSB buffer with a custom, "raw" color palette.
1 parent f18e2c6 commit 857ac75

File tree

13 files changed

+137
-2125
lines changed

13 files changed

+137
-2125
lines changed

kos/cpp.hint

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2886,10 +2886,7 @@
28862886
void libvideo_swgfx_preblend__absfill__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t color);\
28872887
void libvideo_swgfx_preblend__absgradient__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t const colors[2][2]);\
28882888
void libvideo_swgfx_preblend__absgradient_h__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t locolor,video_color_t hicolor);\
2889-
void libvideo_swgfx_preblend__absgradient_v__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t locolor,video_color_t hicolor);\
2890-
void libvideo_swgfx_preblend__fillmask__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t const bg_fg_colors[2],struct video_bitmask const*__restrict bm);\
2891-
void libvideo_swgfx_preblend__fillstretchmask_l__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t dst_size_x,video_dim_t dst_size_y,video_color_t const bg_fg_colors[2],video_dim_t src_size_x,video_dim_t src_size_y,struct video_bitmask const*__restrict bm);\
2892-
void libvideo_swgfx_preblend__fillstretchmask_n__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t dst_size_x,video_dim_t dst_size_y,video_color_t const bg_fg_colors[2],video_dim_t src_size_x,video_dim_t src_size_y,struct video_bitmask const*__restrict bm);
2889+
void libvideo_swgfx_preblend__absgradient_v__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t locolor,video_color_t hicolor);
28932890
#define DEFINE_libvideo_swgfx_generic__render_preblend_FOO(n,...)\
28942891
void libvideo_swgfx_preblend__absline_llhh__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t color){}\
28952892
void libvideo_swgfx_preblend__absline_lhhl__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t color){}\
@@ -2900,10 +2897,7 @@
29002897
void libvideo_swgfx_preblend__absfill__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t color){}\
29012898
void libvideo_swgfx_preblend__absgradient__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t const colors[2][2]){}\
29022899
void libvideo_swgfx_preblend__absgradient_h__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t locolor,video_color_t hicolor){}\
2903-
void libvideo_swgfx_preblend__absgradient_v__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t locolor,video_color_t hicolor){}\
2904-
void libvideo_swgfx_preblend__fillmask__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t const bg_fg_colors[2],struct video_bitmask const*__restrict bm){}\
2905-
void libvideo_swgfx_preblend__fillstretchmask_l__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t dst_size_x,video_dim_t dst_size_y,video_color_t const bg_fg_colors[2],video_dim_t src_size_x,video_dim_t src_size_y,struct video_bitmask const*__restrict bm){}\
2906-
void libvideo_swgfx_preblend__fillstretchmask_n__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t dst_size_x,video_dim_t dst_size_y,video_color_t const bg_fg_colors[2],video_dim_t src_size_x,video_dim_t src_size_y,struct video_bitmask const*__restrict bm){}
2900+
void libvideo_swgfx_preblend__absgradient_v__##n(struct video_gfx const*__restrict self,video_coord_t dst_x,video_coord_t dst_y,video_dim_t size_x,video_dim_t size_y,video_color_t locolor,video_color_t hicolor){}
29072901
#define GFX_FOREACH_DEDICATED_PREBLENDMODE(cb)cb(alpha,0,alpha_premultiplied,gfx_preblend_alpha)cb(alpha_factor,0,alpha_premultiplied,gfx_preblend_alpha_factor)cb(alpha_override,0,alpha_premultiplied,gfx_preblend_alpha_override)cb(add,0,add_premultiplied,gfx_preblend_add)
29082902
#define DEFINE_VIDEO_BUFFER_TYPE(name,...) struct video_buffer_ops name={};struct video_buffer_ops const*_##name(void){}
29092903
#define __VIDEO_CODEC_const const

kos/include/libvideo/gfx/gfx.h

Lines changed: 0 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,6 @@ struct video_crect;
7272
struct video_blitter;
7373
struct video_blitter3;
7474

75-
/* Video bitmask descriptor.
76-
*
77-
* Bitmasks can be used to mask filling of pixels in fill/stretch
78-
* operations, such that the corresponding bit selects the source
79-
* color used for that pixel during the fill/stretch.
80-
*
81-
* Bitmasks are expected to encode their bits similar to
82-
* `VIDEO_CODEC_L1_MSB', except that `vbm_skip' allows
83-
* the user to specify a bit-perfect starting offset.
84-
*
85-
* USAGE:
86-
* - Bitmasks are meant for rendering of simple terminal fonts,
87-
* as well as emulation of hardware VGA fonts. As a matter of
88-
* fact: the default VGA terminal font can be rendered when
89-
* treated as a bitmask.
90-
*
91-
* The status of a pixel is calculated as:
92-
* >> uintptr_t bitno = vbm_skip + x + y * vbm_scan;
93-
* >> byte_t byte = ((byte_t const *)vbm_mask)[bitno / NBBY];
94-
* >> shift_t bit = bitno % NBBY;
95-
* >> bool status = (byte >> (NBBY - 1 - bit)) & 1;
96-
*/
97-
struct video_bitmask {
98-
void const *vbm_mask; /* [1..1] Bitmask base pointer */
99-
__uintptr_t vbm_skip; /* # of leading bits to skip */
100-
__size_t vbm_scan; /* # of bits that make up a scanline */
101-
};
102-
10375
struct video_blitter_ops {
10476
/* Blit the contents of another video buffer into this one. */
10577
__ATTR_IN_T(1) void
@@ -263,30 +235,6 @@ struct video_gfx_ops {
263235
video_dim_t __size_x, video_dim_t __size_y,
264236
video_color_t __color);
265237

266-
/* Same as `vgfo_fill()', but only fill in a pixel if masked by `__bm'
267-
* This function is mainly here to facilitate the rendering of glyphs (s.a. fonts/tlft.h) */
268-
269-
/* TODO: This operator needs to go away; mask-fills need to happen using blits,
270-
* and `video_buffer_forbitmask()' needs to go away, also. Instead, bitmasks
271-
* need to use `video_buffer_formem()', which in turn also needs the ability
272-
* to be allocated in V-RAM. */
273-
__ATTR_IN_T(1) __ATTR_IN_T(6) __ATTR_IN_T(7) void
274-
(LIBVIDEO_GFX_CC *vgfo_fillmask)(struct video_gfx const *__restrict __self,
275-
video_offset_t __x, video_offset_t __y,
276-
video_dim_t __size_x, video_dim_t __size_y,
277-
video_color_t const __bg_fg_colors[2],
278-
struct video_bitmask const *__restrict __bm);
279-
280-
/* Same as `vgfo_fillmask()', however perform the blit while up-scaling the given bitmask. */
281-
/* TODO: This one needs to go away, too */
282-
__ATTR_IN_T(1) __ATTR_IN_T(6) __ATTR_IN_T(9) void
283-
(LIBVIDEO_GFX_CC *vgfo_fillstretchmask)(struct video_gfx const *__restrict __self,
284-
video_offset_t __dst_x, video_offset_t __dst_y,
285-
video_dim_t __dst_size_x, video_dim_t __dst_size_y,
286-
video_color_t const __bg_fg_colors[2],
287-
video_dim_t __src_size_x, video_dim_t __src_size_y,
288-
struct video_bitmask const *__restrict __bm);
289-
290238
/* Same as `vgfo_fill', but do so via gradient with colors[y][x] being used
291239
* to essentially do a VIDEO_GFX_F_LINEAR stretch-blit into the specified
292240
* destination rect. */
@@ -813,24 +761,6 @@ video_gfx_rect(struct video_gfx const *__restrict __self,
813761
video_dim_t __size_x, video_dim_t __size_y,
814762
video_color_t __color);
815763

816-
/* Same as `vgfo_fill()', but only fill in a pixel if masked by `__bm'
817-
* This function is mainly here to facilitate the rendering of glyphs (s.a. fonts/tlft.h) */
818-
extern __ATTR_IN(1) __ATTR_IN(7) void
819-
video_gfx_absfillmask(struct video_gfx const *__restrict __self,
820-
video_offset_t __x, video_offset_t __y,
821-
video_dim_t __size_x, video_dim_t __size_y,
822-
video_color_t const __bg_fg_colors[2],
823-
struct video_bitmask const *__restrict __bm);
824-
825-
/* Same as `video_gfx_absfillmask()', however perform the blit while up-scaling the given bitmask. */
826-
extern __ATTR_IN(1) __ATTR_IN(9) void
827-
video_gfx_absfillstretchmask(struct video_gfx const *__restrict __self,
828-
video_offset_t __dst_x, video_offset_t __dst_y,
829-
video_dim_t __dst_size_x, video_dim_t __dst_size_y,
830-
video_color_t const __bg_fg_colors[2],
831-
video_dim_t __src_size_x, video_dim_t __src_size_y,
832-
struct video_bitmask const *__restrict __bm);
833-
834764
/* Same as `video_gfx_fill', but do so via gradient with colors[y][x] being
835765
* used to essentially do a VIDEO_GFX_F_LINEAR stretch-blit into the
836766
* specified destination rect. */
@@ -1091,10 +1021,6 @@ video_gfx_stretch3(struct video_gfx const *__wrdst, video_offset_t __wrdst_x, vi
10911021
video_gfx_fill(self, 0, 0, VIDEO_DIM_MAX, VIDEO_DIM_MAX, color)
10921022
#define video_gfx_rect(self, x, y, size_x, size_y, color) \
10931023
(*(self)->vx_hdr.vxh_ops->vgfo_rect)(self, x, y, size_x, size_y, color)
1094-
#define video_gfx_absfillmask(self, x, y, size_x, size_y, bg_fg_colors, bigtmask) \
1095-
(*(self)->vx_hdr.vxh_ops->vgfo_fillmask)(self, x, y, size_x, size_y, bg_fg_colors, bigtmask)
1096-
#define video_gfx_absfillstretchmask(self, dst_x, dst_y, dst_sizex, dst_sizey, bg_fg_colors, src_size_x, src_size_y, bigtmask) \
1097-
(*(self)->vx_hdr.vxh_ops->vgfo_fillstretchmask)(self, dst_x, dst_y, dst_sizex, dst_sizey, bg_fg_colors, src_size_x, src_size_y, bigtmask)
10981024
#define video_gfx_gradient(self, x, y, size_x, size_y, colors) \
10991025
(*(self)->vx_hdr.vxh_ops->vgfo_gradient)(self, x, y, size_x, size_y, colors)
11001026
#define video_gfx_hgradient(self, x, y, size_x, size_y, locolor, hicolor) \
@@ -1430,24 +1356,6 @@ struct video_gfx {
14301356
video_gfx_rect(this, __x, __y, __size_x, __size_y, __color);
14311357
}
14321358

1433-
/* Fill an area with a solid color. */
1434-
__CXX_CLASSMEMBER void fillmask(video_offset_t __x, video_offset_t __y,
1435-
video_dim_t __size_x, video_dim_t __size_y,
1436-
video_color_t const __bg_fg_colors[2],
1437-
struct video_bitmask const *__restrict __bm) const {
1438-
video_gfx_absfillmask(this, __x, __y, __size_x, __size_y, __bg_fg_colors, __bm);
1439-
}
1440-
1441-
/* Same as `vgfo_fillmask()', however perform the blit while up-scaling the given bitmask. */
1442-
__CXX_CLASSMEMBER void fillstretchmask(video_offset_t __dst_x, video_offset_t __dst_y,
1443-
video_dim_t __dst_size_x, video_dim_t __dst_size_y,
1444-
video_color_t const __bg_fg_colors[2],
1445-
video_dim_t __src_size_x, video_dim_t __src_size_y,
1446-
struct video_bitmask const *__restrict __bm) const {
1447-
video_gfx_absfillstretchmask(this, __dst_x, __dst_y, __dst_size_x, __dst_size_y,
1448-
__bg_fg_colors, __src_size_x, __src_size_y, __bm);
1449-
}
1450-
14511359

14521360
/************************************************************************/
14531361
/* GFX->GFX blitting via context */

0 commit comments

Comments
 (0)