Skip to content

Commit 8b88b8f

Browse files
authored
Merge pull request #20 from m5stack/develop
0.0.11
2 parents e711155 + 1b235e0 commit 8b88b8f

File tree

8 files changed

+14303
-14103
lines changed

8 files changed

+14303
-14103
lines changed

library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"type": "git",
1111
"url": "https://github.com/m5stack/M5GFX.git"
1212
},
13-
"version": "0.0.10",
13+
"version": "0.0.11",
1414
"framework": "arduino",
1515
"platforms": "espressif32"
1616
}

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=M5GFX
2-
version=0.0.10
2+
version=0.0.11
33
author=M5Stack
44
maintainer=M5Stack
55
sentence=Library for M5Stack All Display

src/M5AtomDisplay.h

Lines changed: 23 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,19 @@ class M5AtomDisplay : public lgfx::LGFX_Device
6767
}
6868

6969
{
70-
static constexpr int X_SCALE_MAX = 16;
71-
static constexpr int Y_SCALE_MAX = 16;
70+
static constexpr int SCALE_MAX = 16;
71+
72+
if (output_width)
73+
{
74+
if (output_width > 1920) { output_width = 1920; }
75+
if (logical_width > output_width) { logical_width = output_width; }
76+
}
77+
if (output_height)
78+
{
79+
if (output_height > 1920) { output_height = 1920; }
80+
if (logical_height > output_height) { logical_height = output_height; }
81+
}
82+
7283
if (logical_width == 0)
7384
{
7485
if (logical_height == 0)
@@ -91,62 +102,33 @@ class M5AtomDisplay : public lgfx::LGFX_Device
91102
{
92103
x_scale = 1;
93104
y_scale = 1;
94-
uint32_t prev_total = 0;
95-
float prev_aspect = INT_MAX;
96-
for (int ys = 1; ys <= Y_SCALE_MAX; ++ys)
105+
for (int scale = 2; scale <= SCALE_MAX; ++scale)
97106
{
98-
uint32_t scale_height = ys * logical_height;
99-
if (scale_height > 1920)
100-
{
101-
break;
102-
}
103-
for (int xs = 1; xs <= X_SCALE_MAX; ++xs)
104-
{
105-
uint32_t scale_width = xs * logical_width;
106-
if (scale_width > 1920)
107-
{
108-
break;
109-
}
110-
uint32_t total = scale_width * scale_height;
111-
if (total <= 384000 || total > 1024000) continue;
112-
float aspect = fabsf(1.67f - (float)scale_width / scale_height);
113-
if (prev_total < total && prev_aspect >= aspect )
114-
{
115-
prev_total = total;
116-
prev_aspect = aspect + 0.001f;
117-
x_scale = xs;
118-
y_scale = ys;
119-
}
120-
}
107+
uint32_t scale_height = scale * logical_height;
108+
uint32_t scale_width = scale * logical_width;
109+
uint32_t total = scale_width * scale_height;
110+
if (scale_width > 1920 || scale_height > 1920 || total >= 1024000) { break; }
111+
x_scale = scale;
112+
y_scale = scale;
121113
}
122114
output_width = x_scale * logical_width;
123115
output_height = y_scale * logical_height;
124116
}
125117
else
126118
{
127-
if (output_width)
128-
{
129-
if (output_width > 1920) { output_width = 1920; }
130-
if (logical_width > output_width) { logical_width > output_width; }
131-
}
132-
if (output_height)
133-
{
134-
if (output_height > 1920) { output_height = 1920; }
135-
if (logical_height > output_height) { logical_height > output_height; }
136-
}
137-
138119
if (y_scale == 0)
139120
{
140121
y_scale = output_height / logical_height;
141122
}
142-
if (y_scale > Y_SCALE_MAX) { y_scale = Y_SCALE_MAX; }
123+
if (y_scale > SCALE_MAX) { y_scale = SCALE_MAX; }
124+
while (logical_height * y_scale > output_height) { --y_scale; }
143125

144126
if (x_scale == 0)
145127
{
146128
x_scale = output_width / logical_width;
147129
}
148130
uint32_t w = output_width / x_scale;
149-
while (x_scale > X_SCALE_MAX || w * x_scale != output_width)
131+
while (x_scale > SCALE_MAX || w * x_scale != output_width || logical_width * x_scale > output_width)
150132
{
151133
w = output_width / --x_scale;
152134
}

src/lgfx/v1/gitTagVersion.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#define LGFX_VERSION_MAJOR 1
22
#define LGFX_VERSION_MINOR 0
3-
#define LGFX_VERSION_PATCH 6
3+
#define LGFX_VERSION_PATCH 7
44
#define LOVYANGFX_VERSION F( LGFX_VERSION_MAJOR "." LGFX_VERSION_MINOR "." LGFX_VERSION_PATCH )

0 commit comments

Comments
 (0)