Skip to content

Rework blitter functions arguments #185

@tehKaiN

Description

@tehKaiN

Currently, blitCopy() etc require something like 10 args, passing which is a bad idea performance-wise.

It could be replace by passing an arg struct. Instead of

blitCopy(s_pBgSub, 0, 0, s_pBfr->pBack, 0, 0, 320, 128, MINTERM_COPY);
blitCopy(s_pBgSub, 0, 128, s_pBfr->pBack, 0, 128, 320, 128, MINTERM_COPY);

It would be something like

tBlitCopyArgs sArgs = {s_pBgSub, 0, 0, s_pBfr->pBack, 0, 0, 320, 128, MINTERM_COPY};
blitCopyPredefined(&sArgs);
sArgs.uwSrcY = 128;
sArgs.uwDstY = 128;
blitCopyPredefined(&sArgs);

Pros:

  • less stdcall overhead
  • ability to cache repetitive blits

Cons:

  • a bit less readable syntax (completely optional if old functions stay as is)
  • no compile-time checks if all struct fields have been set - especially dangerous if additional field will be added in future. Could be resolved by

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    To do

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions