fix: apply clang-format to all source files

Fixes formatting violations that were causing CI failures.
Applied clang-format-14 to ensure consistent code formatting
across the codebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
scawful
2025-11-20 01:35:33 -05:00
parent c2bb90a3f1
commit fa3da8fc27
600 changed files with 32605 additions and 27962 deletions

View File

@@ -2,14 +2,14 @@
#define YAZE_APP_GFX_BPP_FORMAT_MANAGER_H
#include <SDL.h>
#include <vector>
#include <unordered_map>
#include <memory>
#include <string>
#include <unordered_map>
#include <vector>
#include "app/gfx/core/bitmap.h"
#include "app/gfx/types/snes_palette.h"
#include "app/gfx/debug/performance/performance_profiler.h"
#include "app/gfx/types/snes_palette.h"
namespace yaze {
namespace gfx {
@@ -18,10 +18,10 @@ namespace gfx {
* @brief BPP format enumeration for SNES graphics
*/
enum class BppFormat {
kBpp2 = 2, ///< 2 bits per pixel (4 colors)
kBpp3 = 3, ///< 3 bits per pixel (8 colors)
kBpp4 = 4, ///< 4 bits per pixel (16 colors)
kBpp8 = 8 ///< 8 bits per pixel (256 colors)
kBpp2 = 2, ///< 2 bits per pixel (4 colors)
kBpp3 = 3, ///< 3 bits per pixel (8 colors)
kBpp4 = 4, ///< 4 bits per pixel (16 colors)
kBpp8 = 8 ///< 8 bits per pixel (256 colors)
};
/**
@@ -36,14 +36,20 @@ struct BppFormatInfo {
int bytes_per_sheet;
bool is_compressed;
std::string description;
BppFormatInfo() = default;
BppFormatInfo(BppFormat fmt, const std::string& n, int bpp, int max_col,
int bytes_tile, int bytes_sheet, bool compressed, const std::string& desc)
: format(fmt), name(n), bits_per_pixel(bpp), max_colors(max_col),
bytes_per_tile(bytes_tile), bytes_per_sheet(bytes_sheet),
is_compressed(compressed), description(desc) {}
BppFormatInfo(BppFormat fmt, const std::string& n, int bpp, int max_col,
int bytes_tile, int bytes_sheet, bool compressed,
const std::string& desc)
: format(fmt),
name(n),
bits_per_pixel(bpp),
max_colors(max_col),
bytes_per_tile(bytes_tile),
bytes_per_sheet(bytes_sheet),
is_compressed(compressed),
description(desc) {}
};
/**
@@ -60,11 +66,16 @@ struct GraphicsSheetAnalysis {
size_t original_size;
size_t current_size;
std::vector<int> tile_usage_pattern;
GraphicsSheetAnalysis() : sheet_id(-1), original_format(BppFormat::kBpp8),
current_format(BppFormat::kBpp8), was_converted(false),
palette_entries_used(0), compression_ratio(1.0f),
original_size(0), current_size(0) {}
GraphicsSheetAnalysis()
: sheet_id(-1),
original_format(BppFormat::kBpp8),
current_format(BppFormat::kBpp8),
was_converted(false),
palette_entries_used(0),
compression_ratio(1.0f),
original_size(0),
current_size(0) {}
};
/**
@@ -97,25 +108,25 @@ struct GraphicsSheetAnalysis {
class BppFormatManager {
public:
static BppFormatManager& Get();
/**
* @brief Initialize the BPP format manager
*/
void Initialize();
/**
* @brief Get BPP format information
* @param format BPP format to get info for
* @return Format information structure
*/
const BppFormatInfo& GetFormatInfo(BppFormat format) const;
/**
* @brief Get all available BPP formats
* @return Vector of all supported BPP formats
*/
std::vector<BppFormat> GetAvailableFormats() const;
/**
* @brief Convert bitmap data between BPP formats
* @param data Source bitmap data
@@ -126,9 +137,9 @@ class BppFormatManager {
* @return Converted bitmap data
*/
std::vector<uint8_t> ConvertFormat(const std::vector<uint8_t>& data,
BppFormat from_format, BppFormat to_format,
int width, int height);
BppFormat from_format, BppFormat to_format,
int width, int height);
/**
* @brief Analyze graphics sheet to determine original and current BPP formats
* @param sheet_data Graphics sheet data
@@ -136,10 +147,10 @@ class BppFormatManager {
* @param palette Palette data for analysis
* @return Analysis result with format information
*/
GraphicsSheetAnalysis AnalyzeGraphicsSheet(const std::vector<uint8_t>& sheet_data,
int sheet_id,
const SnesPalette& palette);
GraphicsSheetAnalysis AnalyzeGraphicsSheet(
const std::vector<uint8_t>& sheet_data, int sheet_id,
const SnesPalette& palette);
/**
* @brief Detect BPP format from bitmap data
* @param data Bitmap data to analyze
@@ -147,8 +158,9 @@ class BppFormatManager {
* @param height Bitmap height
* @return Detected BPP format
*/
BppFormat DetectFormat(const std::vector<uint8_t>& data, int width, int height);
BppFormat DetectFormat(const std::vector<uint8_t>& data, int width,
int height);
/**
* @brief Optimize palette for specific BPP format
* @param palette Source palette
@@ -157,20 +169,20 @@ class BppFormatManager {
* @return Optimized palette
*/
SnesPalette OptimizePaletteForFormat(const SnesPalette& palette,
BppFormat target_format,
const std::vector<int>& used_colors);
BppFormat target_format,
const std::vector<int>& used_colors);
/**
* @brief Get conversion statistics
* @return Map of conversion operation statistics
*/
std::unordered_map<std::string, int> GetConversionStats() const;
/**
* @brief Clear conversion cache
*/
void ClearCache();
/**
* @brief Get memory usage statistics
* @return Memory usage information
@@ -180,42 +192,50 @@ class BppFormatManager {
private:
BppFormatManager() = default;
~BppFormatManager() = default;
// Format information storage
std::unordered_map<BppFormat, BppFormatInfo> format_info_;
// Conversion cache for performance
std::unordered_map<std::string, std::vector<uint8_t>> conversion_cache_;
// Analysis cache
std::unordered_map<int, GraphicsSheetAnalysis> analysis_cache_;
// Statistics tracking
std::unordered_map<std::string, int> conversion_stats_;
// Memory usage tracking
size_t cache_memory_usage_;
size_t max_cache_size_;
// Helper methods
void InitializeFormatInfo();
std::string GenerateCacheKey(const std::vector<uint8_t>& data,
BppFormat from_format, BppFormat to_format,
int width, int height);
BppFormat AnalyzeColorDepth(const std::vector<uint8_t>& data, int width, int height);
std::vector<uint8_t> Convert2BppTo8Bpp(const std::vector<uint8_t>& data, int width, int height);
std::vector<uint8_t> Convert3BppTo8Bpp(const std::vector<uint8_t>& data, int width, int height);
std::vector<uint8_t> Convert4BppTo8Bpp(const std::vector<uint8_t>& data, int width, int height);
std::vector<uint8_t> Convert8BppTo2Bpp(const std::vector<uint8_t>& data, int width, int height);
std::vector<uint8_t> Convert8BppTo3Bpp(const std::vector<uint8_t>& data, int width, int height);
std::vector<uint8_t> Convert8BppTo4Bpp(const std::vector<uint8_t>& data, int width, int height);
std::string GenerateCacheKey(const std::vector<uint8_t>& data,
BppFormat from_format, BppFormat to_format,
int width, int height);
BppFormat AnalyzeColorDepth(const std::vector<uint8_t>& data, int width,
int height);
std::vector<uint8_t> Convert2BppTo8Bpp(const std::vector<uint8_t>& data,
int width, int height);
std::vector<uint8_t> Convert3BppTo8Bpp(const std::vector<uint8_t>& data,
int width, int height);
std::vector<uint8_t> Convert4BppTo8Bpp(const std::vector<uint8_t>& data,
int width, int height);
std::vector<uint8_t> Convert8BppTo2Bpp(const std::vector<uint8_t>& data,
int width, int height);
std::vector<uint8_t> Convert8BppTo3Bpp(const std::vector<uint8_t>& data,
int width, int height);
std::vector<uint8_t> Convert8BppTo4Bpp(const std::vector<uint8_t>& data,
int width, int height);
// Analysis helpers
int CountUsedColors(const std::vector<uint8_t>& data, int max_colors);
float CalculateCompressionRatio(const std::vector<uint8_t>& original,
const std::vector<uint8_t>& compressed);
std::vector<int> AnalyzeTileUsagePattern(const std::vector<uint8_t>& data,
int width, int height, int tile_size);
float CalculateCompressionRatio(const std::vector<uint8_t>& original,
const std::vector<uint8_t>& compressed);
std::vector<int> AnalyzeTileUsagePattern(const std::vector<uint8_t>& data,
int width, int height,
int tile_size);
};
/**
@@ -223,11 +243,12 @@ class BppFormatManager {
*/
class BppConversionScope {
public:
BppConversionScope(BppFormat from_format, BppFormat to_format, int width, int height);
BppConversionScope(BppFormat from_format, BppFormat to_format, int width,
int height);
~BppConversionScope();
std::vector<uint8_t> Convert(const std::vector<uint8_t>& data);
private:
BppFormat from_format_;
BppFormat to_format_;