Files
Sprinter-SDCC/libc/gfx/gfx_fill_rect256.c
T
snark13 4a081501d8 libc: сплит «1 функция = 1 модуль» — вся библиотека, wildcard-сборка
- bios/conio/env/errno/gfx/io/mem/mouse/stdio/stdlib/string/sys/time/
  video разложены по модулям: общие статики и helpers — в internal
  _-модулях (_conio.h/_mouse.h/_gfx.h/_palette.h/_atexit.h/_time.h)
- lib/Makefile: LIBC_C = wildcard libc/*/*.c — гранулярность файлов
  = гранулярность DCE линкера
- эффект _CODE: gfx_text 6986→2568 Б, gfx_mous −1745, gfx_demo/d16
  −542; ранее timedir −3270, ls −3098, stattest −2995
- комментарии оставшихся модулей переведены на русский; puts: убран
  мёртвый pchars; videomode_raw разложен на get/set
- docs/libc-split-asm-cases.md — правила asm-связок между модулями;
  docs/libc-roadmap.md — план этапа
- восстановлен examples/mdview/SAMPLE.MD (нужен make floppy)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 16:08:58 +03:00

29 lines
1.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* gfx_fill_rect256 — залитый прямоугольник w×h от (x,y) (mode 0x81).
*/
#include "_gfx.h"
void gfx_fill_rect256(int x, int y, int w, int h, uint8_t color)
{
if (w <= 0 || h <= 0) return;
/* Ориентация с меньшим числом accel-burst'ов. Один burst красит
* до 256 смежных байт (горизонталь) или до 256 пикселей колонки.
* построчно (hlines): h × ceil(w/256) burst'ов
* поколоночно (vlines): w × ceil(h/256) — при h ≤ 256 это w
* Вертикаль выигрывает на высоких узких, горизонталь — на низких
* широких. */
int h_bursts = h * ((w + 255) >> 8);
int v_bursts = w * ((h + 255) >> 8);
_gfx_w3_video_begin();
if (h_bursts <= v_bursts) {
for (int yy = 0; yy < h; yy++)
_gfx_hline256_raw(x, y + yy, w, color);
} else {
for (int xx = 0; xx < w; xx++)
_gfx_vline256_raw(x + xx, y, h, color);
}
_gfx_w3_video_end();
}