mirror of
https://github.com/Lorenzooone/cc3dsfs.git
synced 2026-09-11 18:15:24 -05:00
Add ability to convert to RGBA directly, if needed
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions
Some checks are pending
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux32 flags:32 name:Linux GCC 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linux64 flags:64 name:Linux GCC x64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm32 flags:arm32 name:Linux GCC ARM 32 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:linuxarm64 flags:arm64 name:Linux GCC ARM 64 os:ubuntu-latest]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:macos name:macOS Apple Silicon os:macos-14]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win32 flags:-A Win32 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 Win32 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:win64 flags:-A x64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 x64 os:windows-2022]) (push) Waiting to run
CD / ${{ matrix.platform.name }} ${{ matrix.config.name }} (map[flags:-DBUILD_SHARED_LIBS=FALSE name:Static], map[artifact_name:winarm64 flags:-A ARM64 -DCMAKE_PARALLEL_MSVC=TRUE name:Windows VS2022 ARM os:windows-2022]) (push) Waiting to run
CD / Create Pi Mono Setup (push) Blocked by required conditions
CD / Publishing (push) Blocked by required conditions
This commit is contained in:
@@ -1075,3 +1075,83 @@ void manualConvertOutputToRGB(VideoOutputData* src, VideoOutputData* dst, size_t
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_rgb_to_rgba(VideoOutputData* src, VideoOutputData* dst, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height) {
|
||||
for (size_t i = 0; i < height; i++) {
|
||||
for (size_t j = 0; j < width; j++) {
|
||||
size_t pixel = ((height - 1 - i) * width) + (width - 1 - j) + pos_x_data + (pos_y_data * width);
|
||||
uint8_t r = src->rgb_video_output_data.screen_data[pixel].r;
|
||||
uint8_t g = src->rgb_video_output_data.screen_data[pixel].g;
|
||||
uint8_t b = src->rgb_video_output_data.screen_data[pixel].b;
|
||||
dst->rgba_video_output_data.screen_data[pixel].r = r;
|
||||
dst->rgba_video_output_data.screen_data[pixel].g = g;
|
||||
dst->rgba_video_output_data.screen_data[pixel].b = b;
|
||||
dst->rgba_video_output_data.screen_data[pixel].alpha = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_rgb16_to_rgba(VideoOutputData* src, VideoOutputData* dst, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height) {
|
||||
for (size_t i = 0; i < height; i++) {
|
||||
for (size_t j = 0; j < width; j++) {
|
||||
size_t pixel = ((height - 1 - i) * width) + (width - 1 - j) + pos_x_data + (pos_y_data * width);
|
||||
uint8_t r = to_8_bit_5(src->rgb16_video_output_data.screen_data[pixel].r);
|
||||
uint8_t g = to_8_bit_6(src->rgb16_video_output_data.screen_data[pixel].g);
|
||||
uint8_t b = to_8_bit_5(src->rgb16_video_output_data.screen_data[pixel].b);
|
||||
dst->rgba_video_output_data.screen_data[pixel].r = r;
|
||||
dst->rgba_video_output_data.screen_data[pixel].g = g;
|
||||
dst->rgba_video_output_data.screen_data[pixel].b = b;
|
||||
dst->rgba_video_output_data.screen_data[pixel].alpha = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_bgr_to_rgba(VideoOutputData* src, VideoOutputData* dst, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height) {
|
||||
for (size_t i = 0; i < height; i++) {
|
||||
for (size_t j = 0; j < width; j++) {
|
||||
size_t pixel = ((height - 1 - i) * width) + (width - 1 - j) + pos_x_data + (pos_y_data * width);
|
||||
uint8_t r = src->bgr_video_output_data.screen_data[pixel].r;
|
||||
uint8_t g = src->bgr_video_output_data.screen_data[pixel].g;
|
||||
uint8_t b = src->bgr_video_output_data.screen_data[pixel].b;
|
||||
dst->rgba_video_output_data.screen_data[pixel].r = r;
|
||||
dst->rgba_video_output_data.screen_data[pixel].g = g;
|
||||
dst->rgba_video_output_data.screen_data[pixel].b = b;
|
||||
dst->rgba_video_output_data.screen_data[pixel].alpha = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void convert_bgr16_to_rgba(VideoOutputData* src, VideoOutputData* dst, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height) {
|
||||
uint16_t* data_16_ptr = (uint16_t*)src;
|
||||
for (size_t i = 0; i < height; i++) {
|
||||
for (size_t j = 0; j < width; j++) {
|
||||
size_t pixel = ((height - 1 - i) * width) + (width - 1 - j) + pos_x_data + (pos_y_data * width);
|
||||
uint8_t r = to_8_bit_5(src->bgr16_video_output_data.screen_data[pixel].r);
|
||||
uint8_t g = to_8_bit_6(src->bgr16_video_output_data.screen_data[pixel].g);
|
||||
uint8_t b = to_8_bit_5(src->bgr16_video_output_data.screen_data[pixel].b);
|
||||
dst->rgba_video_output_data.screen_data[pixel].r = r;
|
||||
dst->rgba_video_output_data.screen_data[pixel].g = g;
|
||||
dst->rgba_video_output_data.screen_data[pixel].b = b;
|
||||
dst->rgba_video_output_data.screen_data[pixel].alpha = 0xFF;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void manualConvertOutputToRGBA(VideoOutputData* src, VideoOutputData* dst, size_t pos_x_data, size_t pos_y_data, size_t width, size_t height, InputVideoDataType video_data_type) {
|
||||
switch (video_data_type) {
|
||||
case VIDEO_DATA_RGB:
|
||||
convert_rgb_to_rgba(src, dst, pos_x_data, pos_y_data, width, height);
|
||||
break;
|
||||
case VIDEO_DATA_RGB16:
|
||||
convert_rgb16_to_rgba(src, dst, pos_x_data, pos_y_data, width, height);
|
||||
break;
|
||||
case VIDEO_DATA_BGR:
|
||||
convert_bgr_to_rgba(src, dst, pos_x_data, pos_y_data, width, height);
|
||||
break;
|
||||
case VIDEO_DATA_BGR16:
|
||||
convert_bgr16_to_rgba(src, dst, pos_x_data, pos_y_data, width, height);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user