Skip to content

Commit 271da53

Browse files
authoredApr 30, 2023
Define structs and data types (#2)
* Define structs and data types * Add suggested changes
1 parent d8fb9b0 commit 271da53

File tree

6 files changed

+43
-4
lines changed

6 files changed

+43
-4
lines changed
 

‎.clang-format

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ BreakBeforeBraces: Attach
66
ColumnLimit: 160
77
SpaceAfterTemplateKeyword: true
88
Standard: c++20
9-
TabWidth: 4
10-
IndentWidth: 4
9+
TabWidth: 2
10+
IndentWidth: 2
1111
UseTab: Always
1212
AllowShortEnumsOnASingleLine: true
1313
AllowShortCaseLabelsOnASingleLine: true

‎.editorconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[*]
22
insert_final_newline = true
33
charset = utf-8
4-
indent_size = 4
4+
indent_size = 2
55
indent_style = tab
66
# Optional: git will commit as lf, this will only affect local files
77
end_of_line = lf

‎CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ project(image-exporter)
88

99
add_executable(${PROJECT_NAME})
1010
target_sources(${PROJECT_NAME} PRIVATE
11+
src/export.h
12+
src/export.cpp
1113
src/main.cpp
1214
)
1315

‎src/export.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include "export.h"

‎src/export.h

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#pragma once
2+
3+
#include <vector>
4+
#include <span>
5+
#include <cstdint>
6+
7+
using std::uint8_t;
8+
using std::uint32_t;
9+
10+
struct Rgba
11+
{
12+
uint8_t r{0}, g{0}, b{0}, a{0};
13+
};
14+
15+
struct Extent
16+
{
17+
uint32_t width{0}, height{0};
18+
};
19+
20+
struct Image
21+
{
22+
std::vector<Rgba> pixels;
23+
Extent extent;
24+
};
25+
26+
Image upscale(std::span<Rgba const> input, uint32_t scale);

‎src/main.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
1-
int main() {}
1+
#include "export.h"
2+
3+
constexpr uint32_t image_width_v = 512;
4+
constexpr uint32_t image_height_v = 512;
5+
constexpr uint32_t input_extent_v = 1;
6+
constexpr uint32_t output_extent_v = 32;
7+
8+
int main()
9+
{
10+
return 0;
11+
}

0 commit comments

Comments
 (0)
Please sign in to comment.