src/battle_effect/blitter_fragments.c
The pieces btEffectBuildBlitter (battle_effect_blitter.c) builds canvas blitters from. More…
Macros
| Name | Description | |
|---|---|---|
#define | FRAGMENT void __attribute__((naked)) | A fragment: no entry or exit code, since only its body is copied. |
#define | CANVAS_WORD_NEXT (((Uint32 *)(canvas += 4))[-1]) | A current GCC takes no cast as an lvalue. |
Functions
| Name | Description | |
|---|---|---|
FRAGMENT | BattleEffectCopyReverse (void) | Copy, one pixel, right to left. |
FRAGMENT | BattleEffectCopyForward (void) | Copy, one pixel, left to right. |
FRAGMENT | BattleEffectCopy8Forward (void) | Copy, a full cell's eight pixels, left to right. |
FRAGMENT | BattleEffectCopy8Reverse (void) | Copy, a full cell's eight pixels, right to left. |
FRAGMENT | BattleEffectTransparentForward (void) | Transparent, one pixel, left to right. |
FRAGMENT | BattleEffectTransparentReverse (void) | Transparent, one pixel, right to left. |
FRAGMENT | BattleEffectTransparent8Forward (void) | Transparent, a full cell's eight pixels, left to right. |
FRAGMENT | BattleEffectTransparent8Reverse (void) | Transparent, a full cell's eight pixels, right to left. |
FRAGMENT | BattleEffectMaxForward (void) | Max, one pixel, left to right. |
FRAGMENT | BattleEffectMaxReverse (void) | Max, one pixel, right to left. |
FRAGMENT | BattleEffectMax4Forward (void) | Max over the four pixels of one canvas word, read once: each canvas byte is taken into cap. |
FRAGMENT | BattleEffectMax4Reverse (void) | Max, four pixels (one canvas word), right to left; a full cell's row takes it twice. |
FRAGMENT | BattleEffectAdditiveForward (void) | Additive, one pixel, left to right. |
FRAGMENT | BattleEffectAdditiveReverse (void) | Additive, one pixel, right to left. |
FRAGMENT | BattleEffectMask (void) | Loads the cap mask the colour fragments use: CANVAS_LEVEL_BRIGHTEST + 1 in every byte. |
Description
The pieces btEffectBuildBlitter (battle_effect_blitter.c) builds canvas
blitters from. None of this code runs where it is: the builder copies its
words into a heap block, one function per canvas size, mirroring, clip and
mode, after the template's entry code (blitter_template.s) has set up the
picture and canvas pointers. So each fragment is a function with no entry or
exit of its own, working on the blitter's registers.
Each pixel fragment combines picture pixels into the canvas: Copy writes
them, Transparent skips zeros, Max keeps the brighter of the two, Additive
adds them a pixel at a time, capped at the brightest canvas level. Forward
fragments read the picture left to right and Reverse ones right to left;
canvas rows stay in tile order. The 8 variants do eight pixels a pass. For
whole cells the additive mode uses the colour fragments
(blitter_color_fragments.c), which add four pixels a word at a time, capped
with the mask BattleEffectMask loads.
Macros in detail
FRAGMENT
#define FRAGMENT void __attribute__((naked))
A fragment: no entry or exit code, since only its body is copied.
Referenced by BattleEffectAdditiveForward(), BattleEffectAdditiveReverse(), BattleEffectColorForward(), BattleEffectColorReverse(), BattleEffectCopy8Forward(), BattleEffectCopy8Reverse(), BattleEffectCopyForward(), BattleEffectCopyReverse(), BattleEffectMask(), BattleEffectMax4Forward(), BattleEffectMax4Reverse(), BattleEffectMaxForward(), BattleEffectMaxReverse(), BattleEffectTransparent8Forward(), BattleEffectTransparent8Reverse(), BattleEffectTransparentForward() and BattleEffectTransparentReverse().
Definition at line 30 of file blitter_fragments.c.
CANVAS_WORD_NEXT
#define CANVAS_WORD_NEXT (((Uint32 *)(canvas += 4))[-1])
#define CANVAS_WORD_NEXT (*((Uint32 *)canvas)++)
A current GCC takes no cast as an lvalue.
Referenced by BattleEffectColorForward(), BattleEffectColorReverse(), BattleEffectMax4Forward() and BattleEffectMax4Reverse().
Definition at lines 35 and 37 of file blitter_fragments.c.
Functions in detail
BattleEffectCopyReverse
FRAGMENT BattleEffectCopyReverse(void)
Copy, one pixel, right to left.
Referenced by btEffectBuildBlitter().
Definition at line 40 of file blitter_fragments.c.
BattleEffectCopyForward
FRAGMENT BattleEffectCopyForward(void)
Copy, one pixel, left to right.
Referenced by btEffectBuildBlitter().
Definition at line 46 of file blitter_fragments.c.
BattleEffectCopy8Forward
FRAGMENT BattleEffectCopy8Forward(void)
Copy, a full cell's eight pixels, left to right.
Referenced by btEffectBuildBlitter().
Definition at line 52 of file blitter_fragments.c.
BattleEffectCopy8Reverse
FRAGMENT BattleEffectCopy8Reverse(void)
Copy, a full cell's eight pixels, right to left.
Referenced by btEffectBuildBlitter().
Definition at line 72 of file blitter_fragments.c.
BattleEffectTransparentForward
FRAGMENT BattleEffectTransparentForward(void)
Transparent, one pixel, left to right.
Referenced by btEffectBuildBlitter().
Definition at line 92 of file blitter_fragments.c.
BattleEffectTransparentReverse
FRAGMENT BattleEffectTransparentReverse(void)
Transparent, one pixel, right to left.
Referenced by btEffectBuildBlitter().
Definition at line 100 of file blitter_fragments.c.
BattleEffectTransparent8Forward
FRAGMENT BattleEffectTransparent8Forward(void)
Transparent, a full cell's eight pixels, left to right.
Referenced by btEffectBuildBlitter().
Definition at line 108 of file blitter_fragments.c.
BattleEffectTransparent8Reverse
FRAGMENT BattleEffectTransparent8Reverse(void)
Transparent, a full cell's eight pixels, right to left.
Referenced by btEffectBuildBlitter().
Definition at line 137 of file blitter_fragments.c.
BattleEffectMaxForward
FRAGMENT BattleEffectMaxForward(void)
Max, one pixel, left to right.
Referenced by btEffectBuildBlitter().
Definition at line 166 of file blitter_fragments.c.
BattleEffectMaxReverse
FRAGMENT BattleEffectMaxReverse(void)
Max, one pixel, right to left.
Referenced by btEffectBuildBlitter().
Definition at line 174 of file blitter_fragments.c.
BattleEffectMax4Forward
FRAGMENT BattleEffectMax4Forward(void)
Max over the four pixels of one canvas word, read once: each canvas byte is taken into cap.
Referenced by btEffectBuildBlitter().
Definition at line 184 of file blitter_fragments.c.
BattleEffectMax4Reverse
FRAGMENT BattleEffectMax4Reverse(void)
Max, four pixels (one canvas word), right to left; a full cell's row takes it twice.
Referenced by btEffectBuildBlitter().
Definition at line 204 of file blitter_fragments.c.
BattleEffectAdditiveForward
FRAGMENT BattleEffectAdditiveForward(void)
Additive, one pixel, left to right.
Referenced by btEffectBuildBlitter().
Definition at line 224 of file blitter_fragments.c.
BattleEffectAdditiveReverse
FRAGMENT BattleEffectAdditiveReverse(void)
Additive, one pixel, right to left.
Referenced by btEffectBuildBlitter().
Definition at line 235 of file blitter_fragments.c.
BattleEffectMask
FRAGMENT BattleEffectMask(void)
Loads the cap mask the colour fragments use: CANVAS_LEVEL_BRIGHTEST + 1 in
every byte.
Referenced by btEffectBuildBlitter().
Definition at line 248 of file blitter_fragments.c.