f1c79eabde
Branch phase11b-cpp — refactor композитора на ООП.
Что сделано в этом коммите:
- CMakeLists.txt: CMAKE_CXX_STANDARD 17, language=CXX
- include/cuframes_composer/cpp/cuda_raii.hpp: CudaBuffer + CudaStream
как RAII обёртки (cuMemAlloc/cuMemFree, cuStreamCreate/Destroy).
Non-copyable, movable. Zero-copy: handle CUdeviceptr передаётся
идентично C-коду.
- cpp/types.hpp: Rect (pixel coords) + NV12Ref (общий read-write
референс на Y/UV plane'ы output буфера — composer + cells + decorations
делят его без копий).
- cpp/decoration.hpp: абстрактный Decoration с draw(stream, dst, parent_rect).
- cpp/cell.hpp: абстрактный Cell с draw() = draw_content() +
iterate decorations. Композиция через add_decoration().
Что НЕ сделано (следующие коммиты):
- CameraCell, WidgetCell, BlankCell (cell-content реализации)
- LabelDecoration, BorderDecoration (с FreeType/cugrid)
- Layout (контейнер cells + apply_template)
- Composer класс (owner SourcePool + Layout + OutputSurface)
- extern "C" ABI shim для совместимости с control.c, grid_record.c
- Удаление старых composer.c / overlay.c / layouts.c
- Восстановление функционала JSON templates + auto-labels
Производительность: virtual call overhead 1 indirect call per cell per
frame (negligible), никаких heap allocations в hot path, CUDA pipeline
1:1 идентичен C-версии.
Refs: #195 (Phase 11b C++ refactor)
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
34 lines
1.2 KiB
C++
34 lines
1.2 KiB
C++
/* Decoration — украшение поверх cell (Phase 11b).
|
||
*
|
||
* Cell держит vector<unique_ptr<Decoration>> и вызывает draw() каждого
|
||
* после своего content-рендера. Decorations знают только Rect cell'а
|
||
* (для позиционирования относительно неё) и пишут в тот же NV12Ref.
|
||
*
|
||
* Типы (минимум):
|
||
* LabelDecoration — текстовая подпись (FreeType atlas), позиция = угол cell
|
||
* BorderDecoration — рамка thickness px (4 fill_nv12 — top/bottom/left/right)
|
||
*
|
||
* Расширяется: BadgeDecoration, MotionIndicator, RecordingDot и т.д.
|
||
*
|
||
* Лицензия: LGPL-2.1+
|
||
*/
|
||
|
||
#ifndef CUFRAMES_COMPOSER_CPP_DECORATION_HPP
|
||
#define CUFRAMES_COMPOSER_CPP_DECORATION_HPP
|
||
|
||
#include "types.hpp"
|
||
|
||
namespace cfc {
|
||
|
||
class Decoration {
|
||
public:
|
||
virtual ~Decoration() = default;
|
||
|
||
/* Нарисовать поверх parent_rect. NV12Ref общий с cell'ом. */
|
||
virtual void draw(CUstream stream, NV12Ref& dst, const Rect& parent_rect) = 0;
|
||
};
|
||
|
||
} // namespace cfc
|
||
|
||
#endif /* CUFRAMES_COMPOSER_CPP_DECORATION_HPP */
|