Skip to Content
The Alchemy Project

src/battle_effect/blitter_color_fragments.c

The colour fragments btEffectBuildBlitter (battle_effect_blitter.c) builds canvas blitters from, as it does the others in blitter_fragments.c: each adds four picture pixels to a canvas word at once, forward or reverse, and caps each byte that reaches the cap mask's bit at the brightest canvas level. More…

Macros

NameDescription
#defineFRAGMENT void __attribute__((naked))A fragment: no entry or exit code, since only its body is copied.
#defineCANVAS_WORD_NEXT (((Uint32 *)(canvas += 4))[-1])A current GCC takes no cast as an lvalue.

Functions

NameDescription
FRAGMENTBattleEffectColorForward (void)A byte whose sum reaches 64 has that bit taken off and becomes 63: 0x40 - 0x40 / 64 is 0x3f, ORed over what is left of it.
FRAGMENTBattleEffectColorReverse (void)Additive, four pixels added a word at a time, right to left; a full cell's row takes it twice.

Description

The colour fragments btEffectBuildBlitter (battle_effect_blitter.c) builds canvas blitters from, as it does the others in blitter_fragments.c: each adds four picture pixels to a canvas word at once, forward or reverse, and caps each byte that reaches the cap mask's bit at the brightest canvas level. None of this code runs where it is.

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(), BattleEffectCopyForward(), BattleEffectCopyReverse(), BattleEffectMask(), BattleEffectMax4Forward(), BattleEffectMax4Reverse(), BattleEffectMaxForward(), BattleEffectMaxReverse(), BattleEffectTransparent8Forward(), BattleEffectTransparent8Reverse(), BattleEffectTransparentForward() and BattleEffectTransparentReverse().

Definition at line 21 of file blitter_color_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 26 and 28 of file blitter_color_fragments.c.

Functions in detail

BattleEffectColorForward

FRAGMENT BattleEffectColorForward(void)

A byte whose sum reaches 64 has that bit taken off and becomes 63: 0x40 - 0x40 / 64 is 0x3f, ORed over what is left of it.

References pixel.

Definition at line 33 of file blitter_color_fragments.c.

BattleEffectColorReverse

FRAGMENT BattleEffectColorReverse(void)

Additive, four pixels added a word at a time, right to left; a full cell's row takes it twice.

References pixel.

Definition at line 51 of file blitter_color_fragments.c.