refactor: 宣言/実装の物理分離 (src/ → impl/) - #11
Merged
Merged
Conversation
ヘッダ/実装分離に備え、impl/ ディレクトリに対するフォーマットチェックを CI に追加。
platform.h, pool_allocator.h, node.h から #ifdef FLEXIMG_IMPLEMENTATION ブロックを抽出し、impl/fleximg/core/ に .inl ファイルとして配置。 fleximg.cpp から .inl ファイルをインクルードする構造に変更。
viewport.h, filters.h から実装ブロックを抽出し、 impl/fleximg/ に .inl ファイルとして配置。
pixel_format.h, 7つのサブフォーマット .h, dda.h, format_converter.h から実装ブロックを抽出。pixel_format.inl を集約ファイルとして作成し、 依存順序を維持した include 構成で .inl ファイルを配置。
11ノードファイル (affine, composite, distributor, filter_node_base, horizontal_blur, matte, ninepatch_source, renderer, sink, source, vertical_blur) から実装ブロックを抽出し impl/fleximg/nodes/ に配置。
- fleximg.cpp から #define FLEXIMG_IMPLEMENTATION を削除 - dda.h, format_converter.h を削除(実装は .inl に移行済み) - pixel_format.h の stale コメントを修正 - ARCHITECTURE.md を新しい impl/ 分離構造に合わせて更新 - CLAUDE.md のディレクトリ構成に impl/ を追加
- 各 example から #define FLEXIMG_IMPLEMENTATION を削除 - platformio.ini の全 example 環境に +<fleximg/fleximg.cpp> を追加 - example は宣言ヘッダのみインクルードし、実装は fleximg.cpp 経由で取り込む
- common.h: FreeRTOS/Arduino/PC の3段階分岐でデバッグディレイを定義 - __has_include で FreeRTOS を検出(ESP-IDF 直接利用にも対応) - FreeRTOS なし Arduino 環境では delay() にフォールバック - PC/WASM では no-op - ninepatch_source_node.inl: setPivot(0, 0) の曖昧性を int_fixed キャストで解消
- filter_node_base.inl: computeInputMargin() の戻り値を int_fast16_t にキャスト - source_node.inl: validWidth の型を int → int_fast16_t に変更
pool_allocator.h に perf_metrics.h のインクルードを追加。 FLEXIMG_DEBUG_PERF_METRICS マクロが stats_ メンバ宣言より前に 定義される必要があるが、fleximg.cpp のインクルード順では pool_allocator.h が perf_metrics.h より先に処理されるため、 stats_ が未宣言のまま .inl 内で参照されていた。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
src/fleximg/を宣言のみ(公開ヘッダ)、impl/fleximg/に実装(.inl)を配置#ifdef FLEXIMG_IMPLEMENTATIONパターンを廃止し、fleximg.cppが宣言ヘッダと.inl実装の両方をインクルードする構成に変更Changes
Phase 0: CI
impl/ディレクトリの clang-format チェックを追加Phase 1-3: 実装分離(26ファイル → .inl)
platform.h,pool_allocator.h,node.hpixel_format.h系(10ファイル),viewport.hfilters.hPhase 4: クリーンアップ
#define FLEXIMG_IMPLEMENTATIONを全箇所から除去dda.h,format_converter.hを削除(実装は.inlに移行済み)追加修正
FLEXIMG_IMPLEMENTATION依存を解消(platformio.iniでfleximg.cppをビルド対象に追加)common.h:__has_includeによる FreeRTOS 自動検出(ESP-IDF 直接利用対応)、Arduino フォールバックninepatch_source_node.inl:setPivot(0, 0)の曖昧性を解消filter_node_base.inl,source_node.inl: implicit int conversion 警告を修正Test plan
pio test -e test_native— 202 test cases, 67,870 assertions passedpio run -e bench_native— SUCCESSbuild.sh) — SUCCESS